Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support topic remaps in ros2 bag convert YAML #1026

Open
asymingt opened this issue Jun 20, 2022 · 3 comments
Open

Support topic remaps in ros2 bag convert YAML #1026

asymingt opened this issue Jun 20, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@asymingt
Copy link
Contributor

asymingt commented Jun 20, 2022

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.

@asymingt asymingt added the enhancement New feature or request label Jun 20, 2022
@asymingt asymingt changed the title Support topic remapping in ros2 bag convert YAML syntax Support topic remaps in ros2 bag convert YAML Jun 20, 2022
@MichaelOrlov
Copy link
Contributor

@asymingt Thank your for new feature request.
As usual PRs are welcome for consideration.
Form my side as a help with design and implementation I created draft #1028

@asymingt
Copy link
Contributor Author

Thanks @MichaelOrlov -- I see you've added the mechanics of rewriting, and it appears as if new key in YAML parsing needs to be added, along with some unit tests. I'll see if I can find some cycles to fill in the missing blanks.

@asymingt
Copy link
Contributor Author

@MichaelOrlov can you maybe take a look at my PR (#1030) to try and help me understand how I'm using rcl_remap_topic_name incorrectly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants