Rosetta

Rosetta connects your ROS 2 robot to robot-learning frameworks such as LeRobot.

Your robot publishes data streams. A policy wants frames. The contract is as yaml file to define this transformation from streams to frames. Rosetta applies the transforms defined in the contract identically for both data preparation and when you go to run your policy live.

robot_type: so_arm101
robot_interface: ros2
fps: 50
observations:
  observation.images.wrist:                          # key: what the model calls it
    channel: {topic: /wrist_camera/image_raw,        # channel: topic, type, QoS
              type: sensor_msgs/msg/Image}
    align: {strategy: hold, timeline: header}        # align: when
    apply: [resize: [480, 480]]                      # apply: how values change
  observation.state:
    channel: {topic: /joint_states, type: sensor_msgs/msg/JointState}
    align: {strategy: hold, timeline: header}
    select: [position.shoulder_pan_joint, position.elbow_flex_joint]   # select: which fields
    apply: [rad2deg]
actions:
  action:
    channel: {topic: /forward_position_controller/commands,
              type: std_msgs/msg/Float64MultiArray, safety: hold}
    align: {strategy: hold, timeline: receive}
    select: [shoulder_pan.pos, elbow_flex.pos]
    apply: [clamp: {min: -3.14159, max: 3.14159}, rad2deg]

In just five simple steps you can go from data collection to running a policy on your robot.

ros2 launch rosetta episode_recorder_launch.py contract_path:=robot.yaml         # 1 record
$EDITOR robot.yaml                                                                # 2 define
ros2 run rosetta rosetta_port --raw-dir bags --contract robot.yaml --repo-id my  # 3 prepare
lerobot-train --dataset.repo_id=my --policy.type=act                              # 4 train
ros2 launch rosetta policy_runner_launch.py contract_path:=robot.yaml pretrained_name_or_path:=ckpt  # 5 deploy

New here? Install, then follow From bags to a moving arm.

Explanation