Definitions.ros2rag 1019 Bytes
Newer Older
René Schöne's avatar
René Schöne committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
 * Version 2020-05-28
 */
// --- update definitions ---
read Joint.CurrentPosition using ParseLinkState, LinkStateToIntPosition ;
write RobotArm.AppropriateSpeed using CreateSpeedMessage, SerializeRobotConfig ;

// --- dependency definitions ---
RobotArm.AppropriateSpeed canDependOn Joint.CurrentPosition as dependency1 ;

// --- mapping definitions ---
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();
  { int i = 0; }
  return IntPosition.of((int) p.getPositionX(), (int) p.getPositionY(), (int) p.getPositionZ());
:}

CreateSpeedMessage maps double speed to config.Robotconfig.RobotConfig {:
  return config.Robotconfig.RobotConfig.newBuilder()
    .setSpeed(speed)
    .build();
:}