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

add topic remapping option to rosbag2 play #388

Merged
merged 1 commit into from
Apr 29, 2020

Conversation

ketatam
Copy link
Contributor

@ketatam ketatam commented Apr 22, 2020

With the option --remap or -m it's now possible to do topic remapping in rosbag2 play.
This is done by passing the remapping options to the play node.

Closes #326.

void play(const StorageOptions & storage_options, const PlayOptions & play_options);
void play(
const StorageOptions & storage_options, const PlayOptions & play_options,
const std::vector<std::string> & topic_remapping_options = {});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it would be more appropriate to add topic_name_map to PlayOptions/RecordOptions rather than adding new arguments to the API?

@@ -52,6 +52,10 @@ def add_arguments(self, parser, cli_name): # noqa: D102
'-l', '--loop', action='store_true',
help='enables loop playback when playing a bagfile: it starts back at the beginning '
'on reaching the end and plays indefinitely.')
parser.add_argument(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we call this --ros-args (and call out that it enables topic name remapping in the help string), since you can pass any ros-args here and it'll work?

Copy link

@Martin-Idel Martin-Idel Apr 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we were wondering that. My reasoning not to go that route was the following:

  • --ros-args was introduced in particular to avoid name clashes with user defined flags on user ros2 nodes, in other words to separate flags defined by rclcpp or rclpy, etc. from flags defined on nodes deriving from those
  • Rosbag isn't the classical node and I don't see a scenario where you'd want to provide a custom rosbag node, so separating "namespaces" of flags is not a big deal here
  • It could be interesting to expose more flags from rosbag's node, but I wonder whether it is a good idea to expose all of them. Therefore, I'd say: keep things hidden, so we'd only expose --ros-args --remap for now. I also wondered whether at that point it isn't confusing if the notation is the same for a general node but not all options you can generally pass to --ros-args are available.

Does that make sense? What do you think about this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think it makes sense to provide --ros-args --remap under the hood https://github.com/ros2/rosbag2/pull/388/files#diff-fa7b2593ea899bd8b6c1fd104229ec63R203, so that this new argument really is just for topic name remapping.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added added a new topic remapping options to the play options. Please let me know if there are still some other problems

Copy link
Collaborator

@emersonknapp emersonknapp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good

Comment on lines 77 to 78
void play(
const StorageOptions & storage_options, const PlayOptions & play_options);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unrelated change

Suggested change
void play(
const StorageOptions & storage_options, const PlayOptions & play_options);
void play(const StorageOptions & storage_options, const PlayOptions & play_options);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

Signed-off-by: ketatam <mohamed.amine.ketata@tngtech.com>
@ketatam
Copy link
Contributor Author

ketatam commented Apr 28, 2020

@emersonknapp the CI is unstable but I think it's not because of my code. So can you please check this and if I do have to change somthing just let me know. Thanks!

@emersonknapp
Copy link
Collaborator

I took a look through the builds and yes, I don't see anything here that's specifically related to this PR.

The Action CI is the continuing #381
OSX and Windows build warnings are all in Fast-RTPS
The consistent test failure across platforms seems to be an issue with Connext type support, I don't want to block this change on any changes happening upstream there.

We'll need to keep an eye on these issues leading up to the release candidate package, but for now I think we're good to merge.

@emersonknapp emersonknapp merged commit 33cf70b into ros2:master Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Topic Remapping in play
3 participants