-
Notifications
You must be signed in to change notification settings - Fork 287
Description
Description
It would be useful to be able to specify topic remaps in the ros2 bag converter YAML syntax. So, for example if we recorded some topics /input and /output in our experimental run, when we ros2 bag convert ... the bag we can remap /output -> /original/output. In replay we might have some algorithm that consumes /input to produce a new /output, which we could then compare to /original/output in a metrics pipeline. I realize we can do this in a launch context when ros2 bag play ... is called. However, this mixes data preparation steps with launch files.
Related Issues
No. But this is connected more broadly to bag migration, in the sense that bag migration updates structure, while topic remapping updates location. Both are required steps to prepare recorded data for re-use in replay. Bag migration appears to not yet be available in rosbag2.
Completion Criteria
Supporting YAML syntax for declaring topic remaps to be done before the topic filter is applied when converting a bag using the ros2 bag convert tool, and specifying a output filter YAML. The remaps should work exactly like --remap in ros2 play and hopefully support wildcards.
Implementation Notes / Suggestions
The YAML syntax for an output filter might support the remap keyword. The example below is equivalent for ros2 bag play --remap /output:=/old/output into a new bag, and then running the converter. Now the converter does this for you.
output_bags:
- uri: /tmp/recorded.bag
storage_id: sqlite3
topics: ["/input", "/output"]
remappings: [ # applied after the topic filter before writing to the bag
"/output:=/old/output" # same syntax as '--ros-args -r /output:=/old/output'
]Testing Notes / Suggestions
It should be trivial to setup an example where some arbitrary test message is remapped from some old to some new topic, and verify that the converted bag contains the original message on the new topic. A more advanced test might also include wildcard mapping.