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

Improve bridge command parser #396

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open

Conversation

LucasHaug
Copy link

@LucasHaug LucasHaug commented Feb 6, 2023

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.

@MichaelOrlov
Copy link

@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?

@methylDragon
Copy link
Contributor

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?

@LucasHaug
Copy link
Author

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.

@methylDragon
Copy link
Contributor

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?)

@LucasHaug
Copy link
Author

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

Copy link
Contributor

@methylDragon methylDragon left a comment

Choose a reason for hiding this comment

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

Pending green CI

@methylDragon
Copy link
Contributor

methylDragon commented Oct 13, 2023

Build Status

@LucasHaug
Copy link
Author

May we merge this @methylDragon?

@ipa-rwu
Copy link

ipa-rwu commented Mar 23, 2024

Thanks for this nice improvement! It works for me.

@MichaelOrlov
Copy link

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
Copy link

@methylDragon Any thoughts about a new warning on CI ?

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

gavanderhoorn pushed a commit to gavanderhoorn/ros1_bridge that referenced this pull request Oct 21, 2024
* Refactor command parser to use vector of char*

Signed-off-by: LucasHaug <[email protected]>

* Add argc argv splitter to dynamic bridge

Signed-off-by: LucasHaug <[email protected]>

* Add argc argv splitter to paramter bridge

Signed-off-by: LucasHaug <[email protected]>

* Update github action

Signed-off-by: LucasHaug <[email protected]>

* Fix parameter bridge argv split

Signed-off-by: LucasHaug <[email protected]>

* Remove static argv reading

Signed-off-by: LucasHaug <[email protected]>

* Add command parser to parameter bridge

Signed-off-by: LucasHaug <[email protected]>

* Fix compilation errors

Signed-off-by: LucasHaug <[email protected]>

* Fix compilation errors

Signed-off-by: LucasHaug <[email protected]>

* Fix parameter bidge command parser

Signed-off-by: LucasHaug <[email protected]>

* Refactor to add command parser utils file

Signed-off-by: LucasHaug <[email protected]>

* Add github action issue workaround

Signed-off-by: LucasHaug <[email protected]>

* Ty to run github action inside container

Signed-off-by: LucasHaug <[email protected]>

* Fix ROS2 args when no ROS1 args

Signed-off-by: LucasHaug <[email protected]>

* Revert changes on GitHub Action config

Signed-off-by: LucasHaug <[email protected]>

* Change parameter bridge ROS init order

Signed-off-by: LucasHaug <[email protected]>

* Rename parser functions

Signed-off-by: LucasHaug <[email protected]>

* Add get_option_values function

Signed-off-by: LucasHaug <[email protected]>

* Fix wrong help for the parameter bridge

Signed-off-by: LucasHaug <[email protected]>

* Fix get_option_values parser function

Signed-off-by: LucasHaug <[email protected]>

* Refactor bridges to use the get_option_values

Signed-off-by: LucasHaug <[email protected]>

* Add running scetion to README

Signed-off-by: LucasHaug <[email protected]>

* Add print pairs to parameter bridge

---------

Signed-off-by: LucasHaug <[email protected]>
Co-authored-by: LucasHaug <[email protected]>
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.

4 participants