Prepare a dataset

rosetta_port turns bags into a LeRobot dataset. Every option is on the rosetta_port page.

Port

ros2 run rosetta rosetta_port \
    --raw-dir datasets/bags \
    --contract robot.yaml \
    --repo-id my_org/my_dataset \
    --root datasets/lerobot

The dataset lands in datasets/lerobot/my_org/my_dataset. Each bag directory under --raw-dir becomes one episode. The porter runs the same alignment code as live inference, so a dataset frame is what the robot would see at runtime.

Check the result

ls datasets/lerobot/my_org/my_dataset/meta/

info.json lists the features and their shapes. rosetta_contract.yaml is the contract the porter used.

Revise and port again

Edit the contract and run the same command with a new --repo-id. A new key, a different fps, a different alignment or a different image size doesn’t need a new recording.

Port in parallel

Split the bags into shards. Each process takes every nth bag.

for i in 0 1 2 3; do
  ros2 run rosetta rosetta_port --raw-dir datasets/bags --contract robot.yaml \
      --repo-id my_org/my_dataset --root datasets/lerobot \
      --num-shards 4 --shard-index $i &
done
wait

Push to the Hugging Face Hub

ros2 run rosetta rosetta_port ... --repo-id <hf_user>/<name> --push-to-hub

The upload is private unless you add --hub-public.

If an episode fails

The porter logs FAILED for that bag and moves on. An observation topic missing from the bag, or present with no messages, fails the episode. A missing action, reward or signal topic doesn’t: the key is zero-filled with a warning. Check the bag with ros2 bag info against the topic names in the contract.