Test.ros2rag 1018 Bytes
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
11
12
13
14
15
16
17
18
19
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();
René Schöne's avatar
René Schöne committed
20
  return IntPosition.of((int) (10 * p.getPositionX()), (int) (10 * p.getPositionY()), (int) (10 * p.getPositionZ()));
21
:}
22

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