rosetta_port
Turns a directory of bags into a training dataset through a contract.
ros2 run rosetta rosetta_port --raw-dir <bags> --contract <robot.yaml> [options]
Options
Option |
Default |
Meaning |
|---|---|---|
|
required |
Directory searched recursively for bag directories. |
|
required |
Contract YAML. |
|
the |
Dataset id. |
|
the framework’s cache |
Parent directory. The dataset lands at |
|
|
Dataset writer, by entry-point name. |
|
none |
Total shards for a parallel run. |
|
none |
This shard. Required with |
|
embed |
Skip the |
LeRobot writer options:
Option |
Default |
Meaning |
|---|---|---|
|
off |
Upload after writing. Private unless |
|
off |
|
|
|
Comma list. |
|
|
Video codec. |
|
off |
Encode video while writing. |
Writer-specific options the LeRobot writer ignores: --past-steps,
--future-steps, --image-indices, --samples-per-shard.
Behavior
A bag directory is any directory holding
metadata.yaml. One bag is one episode. Episodes are ported in sorted path order. No bag directory under--raw-diris an error.The bag’s
storage_identifierpicks the rosbag2 reader. Any installed storage plugin works.Shard
iofntakes every nth bag starting ati. An empty shard writes nothing and exits normally.The first bag’s embedded contract is compared with
--contract. If they differ, the porter logsBag was recorded with a different contract than --contract; using --contract for decoding and embedding.A bag missing an observation topic, or holding one with no messages, fails that episode. A bag missing an action, reward or signal topic ports with that key zero-filled and a warning.
A contract source whose type has no decoder, built-in or custom, fails every episode at open.
A failed episode is discarded and the run continues. If every bag fails, the run exits with an error. The dataset directory and its
meta/are created before the first episode, so they’ll be on disk. Delete them before retrying: the LeRobot writer refuses to open an existing dataset directory.The task string per frame is the newest
tasksmessage at or before the tick, or else the prompt stored in the bag’s metadata.
Output
With the LeRobot writer, a LeRobot v3 dataset at <root>/<repo-id>. Features
are the contract keys plus is_first, is_last and is_terminal.
robot_type and fps come from the contract. meta/rosetta_contract.yaml
holds the contract text unless you passed --no-embed-contract.