GitLab update scheduled for Friday, January 21th between 08:15 and 08:45 CET. If unpleasant, please contact René or Martin.

Definitions.ros2rag 1.1 KB
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
/**
 * 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)
29
30
    .setLoopTrajectory(true)
    .setPlanningMode(config.Robotconfig.RobotConfig.PlanningMode.CARTESIAN)
René Schöne's avatar
René Schöne committed
31
32
    .build();
:}