Skip to content
Snippets Groups Projects
Select Git revision
  • e455e10b4702d86a21f737eab4dfba5dc52dd190
  • master default protected
2 results

RelAstBase.parser

Blame
  • Test.ros2rag 1.21 KiB
    /* Version 2020-04-17 */
    // --- 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 {:
      TestCounter.INSTANCE.numberParseLinkState += 1;
      return panda.Linkstate.PandaLinkState.parseFrom(bytes);
    :}
    
    SerializeRobotConfig maps config.Robotconfig.RobotConfig rc to byte[] {:
      TestCounter.INSTANCE.numberSerializeRobotConfig += 1;
      return rc.toByteArray();
    :}
    
    LinkStateToIntPosition maps panda.Linkstate.PandaLinkState pls to IntPosition {:
      TestCounter.INSTANCE.numberLinkStateToIntPosition += 1;
      panda.Linkstate.PandaLinkState.Position p = pls.getPos();
      return IntPosition.of((int) (10 * p.getPositionX()), (int) (10 * p.getPositionY()), (int) (10 * p.getPositionZ()));
    :}
    
    CreateSpeedMessage maps double speed to config.Robotconfig.RobotConfig {:
      TestCounter.INSTANCE.numberCreateSpeedMessage += 1;
      return config.Robotconfig.RobotConfig.newBuilder()
        .setSpeed(speed)
        .build();
    :}