ros1_bridge icon indicating copy to clipboard operation
ros1_bridge copied to clipboard

Improve bridge command parser

Open LucasHaug opened this issue 2 years ago • 10 comments

This PR attempts to improve the usability of the dynamic bridge and the parameter bridge by splitting the ROS1 and ROS2 arguments into two separate lists of arguments. This solves the issue #316 and also enables the possibility to set namespaces, node names, remappings, etc, for the ROS1 node and for the ROS2 node, isolatting the ROS1 arguments from the ROS2 argumetns. Additionaly the command parser from the parameter bridge was fixed in order to be more similar to the dynamic bridge.

Besides that, I made some changes to the GitHub action, witch can be discussed, in order to simplify the setup of the environment where the package is built for the action.

LucasHaug avatar Feb 06 '23 15:02 LucasHaug

@clalancette @sloretz @wjwwood This PR hangs out for while (2 weeks) and needs to be reviewed. Could you please advise who would be a right person for review?

MichaelOrlov avatar Feb 22 '23 18:02 MichaelOrlov

Hey! Before I do my review, can I double check that this PR is just concerned with splitting the ROS args so there's no case where a command parser mutates a shared list of commands before a second parser reads it?

Also I'm not sure if the workflow changes should be lumped into this PR, it might be better to split it off into its own PR, or is it a required dependency for the rest of the changes here?

methylDragon avatar Feb 23 '23 23:02 methylDragon

Hey! Before I do my review, can I double check that this PR is just concerned with splitting the ROS args so there's no case where a command parser mutates a shared list of commands before a second parser reads it?

Hey thanks for the reply, the idea here was to just split the arguments.

But I changed the dynamic bridge parse_command_options function to remove the flags that are used for the bridge configuration like the --bridge-all-topics before passing the arguments to the ROS init parser.

So basically the idea in both bridges was to, when passing arguments in the command line, use a structure like:

ros2 run ros1_bridge [dynamic_bridge|parameter_bridge] [Bridge specific arguments] [ROS1 arguments] --ros-args [ROS2 arguments]

The bridge specific parameters are removed from the arguments list before passing the list to the split_ros1_ros2_args function. Then just function just considers everything before the --ros-args to be arguments for the ROS1 node, and everything after that to be for the ROS2 node.

Also I'm not sure if the workflow changes should be lumped into this PR, it might be better to split it off into its own PR, or is it a required dependency for the rest of the changes here?

Make sense, I added them here so the bridge could be built in the GitHub Action, but I can open another PR with it.

LucasHaug avatar Feb 24 '23 08:02 LucasHaug

I wonder if we should do this:

ros2 run ros1_bridge \
  [dynamic_bridge|parameter_bridge] [Bridge specific arguments] \
  --ros1-args [ROS1 arguments] \
  --ros2-args [ROS2 arguments]

And also continue to support the current case (but deprecate it with a warning when the ros1-args and ros2-args flags are missing?)

methylDragon avatar Mar 04 '23 10:03 methylDragon

I wonder if we should do this:

ros2 run ros1_bridge \
  [dynamic_bridge|parameter_bridge] [Bridge specific arguments] \
  --ros1-args [ROS1 arguments] \
  --ros2-args [ROS2 arguments]

And also continue to support the current case (but deprecate it with a warning when the ros1-args and ros2-args flags are missing?)

I think is a valid option, I can work on that

LucasHaug avatar Mar 07 '23 14:03 LucasHaug

Build Status

methylDragon avatar Oct 13 '23 18:10 methylDragon

May we merge this @methylDragon?

LucasHaug avatar Nov 12 '23 16:11 LucasHaug

Thanks for this nice improvement! It works for me.

ipa-rwu avatar Mar 23 '24 13:03 ipa-rwu

The previous CI run emitted one "new" warning which is IMO unrelated to the changes in this PR.

CMakeList:36 Failed to find ROS 1 roscpp, skipping...

Re-running CI one more time. Build Status

MichaelOrlov avatar Mar 23 '24 20:03 MichaelOrlov

@methylDragon Any thoughts about a new warning on CI ?

CMakeList:36 Failed to find ROS 1 roscpp, skipping...

MichaelOrlov avatar Mar 26 '24 07:03 MichaelOrlov