Example.ros2rag 1.07 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
8
RobotArm.AppropriateSpeed canDependOn Joint.CurrentPosition as dependency1 ;
RobotArm.AppropriateSpeed canDependOn RobotArm.AttributeTestSource as dependency2 ;
9
10

// --- 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
:}