Test.ros2rag 1.21 KB
Newer Older
1
2
/* Version 2020-04-17 */
// --- update definitions ---
3
read Joint.CurrentPosition using ParseLinkState, LinkStateToIntPosition ;
René Schöne's avatar
René Schöne committed
4
write RobotArm.AppropriateSpeed using CreateSpeedMessage, SerializeRobotConfig ;
5
6

// --- dependency definitions ---
René Schöne's avatar
René Schöne committed
7
RobotArm.AppropriateSpeed canDependOn Joint.CurrentPosition as dependency1 ;
8
9

// --- mapping definitions ---
10
ParseLinkState maps byte[] bytes to panda.Linkstate.PandaLinkState {:
11
  TestCounter.INSTANCE.numberParseLinkState += 1;
12
13
14
15
  return panda.Linkstate.PandaLinkState.parseFrom(bytes);
:}

SerializeRobotConfig maps config.Robotconfig.RobotConfig rc to byte[] {:
16
  TestCounter.INSTANCE.numberSerializeRobotConfig += 1;
17
18
19
20
  return rc.toByteArray();
:}

LinkStateToIntPosition maps panda.Linkstate.PandaLinkState pls to IntPosition {:
21
  TestCounter.INSTANCE.numberLinkStateToIntPosition += 1;
22
  panda.Linkstate.PandaLinkState.Position p = pls.getPos();
René Schöne's avatar
René Schöne committed
23
  return IntPosition.of((int) (10 * p.getPositionX()), (int) (10 * p.getPositionY()), (int) (10 * p.getPositionZ()));
24
:}
25

26
CreateSpeedMessage maps double speed to config.Robotconfig.RobotConfig {:
27
  TestCounter.INSTANCE.numberCreateSpeedMessage += 1;
28
29
  return config.Robotconfig.RobotConfig.newBuilder()
    .setSpeed(speed)
30
    .build();
31
:}