Example.ros2rag 1.08 KB
Newer Older
1
2
/* Version 2020-04-17 */
// --- update definitions ---
3
4
read Joint.CurrentPosition using ParseLinkState, LinkStateToIntPosition ;
write RobotArm._AppropriateSpeed using CreateSpeedMessage, SerializeRobotConfig ;
5
6
7
8
9
10

// --- dependency definitions ---
RobotArm._AppropriateSpeed canDependOn Joint.CurrentPosition as dependency1 ;
RobotArm._AppropriateSpeed canDependOn RobotArm._AttributeTestSource as dependency2 ;

// --- mapping definitions ---
11
12
13
14
15
16
17
18
19
20
ParseLinkState maps byte[] bytes to panda.Linkstate.PandaLinkState {:
  return panda.Linkstate.PandaLinkState.parseFrom(bytes);
:}

SerializeRobotConfig maps config.Robotconfig.RobotConfig rc to byte[] {:
  return rc.toByteArray();
:}

LinkStateToIntPosition maps panda.Linkstate.PandaLinkState pls to IntPosition {:
  panda.Linkstate.PandaLinkState.Position p = pls.getPos();
21
  { int i = 0; }
22
  return IntPosition.of((int) p.getPositionX(), (int) p.getPositionY(), (int) p.getPositionZ());
23
:}
24

25
26
27
CreateSpeedMessage maps double speed to config.Robotconfig.RobotConfig {:
  return config.Robotconfig.RobotConfig.newBuilder()
    .setSpeed(speed)
28
    .build();
29
:}