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 ROS namespaces to GZ topics #512

Merged
merged 13 commits into from
Mar 20, 2024

Conversation

Kotochleb
Copy link
Contributor

@Kotochleb Kotochleb commented Mar 18, 2024

🎉 New feature

Summary

This PR adds the ability to apply ROS node namespace onto GZ topics. This adds option for global namespaces, private namespaces and should also work for substitutions.

I believe this feature later could be easily ported to Iron and Rolling.

As it is an API breaking feature, I also introduced a new ROS parameter, preserving backward compatibility.

Test it

In the config_file YAML file, create topics as:

- topic_name: "chatter"
  ros_type_name: "std_msgs/msg/String"
  gz_type_name: "gz.msgs.StringMsg"
  direction: ROS_TO_GZ

- topic_name: "/chatter_global"
  ros_type_name: "std_msgs/msg/String"
  gz_type_name: "gz.msgs.StringMsg"
  direction: ROS_TO_GZ

- topic_name: "~/chatter_private_ns"
  ros_type_name: "std_msgs/msg/String"
  gz_type_name: "gz.msgs.StringMsg"
  direction: ROS_TO_GZ

- ros_topic_name: "chatter_ros_ns"
  gz_topic_name: "/chatter_ign_global"
  ros_type_name: "std_msgs/msg/String"
  gz_type_name: "gz.msgs.StringMsg"
  direction: ROS_TO_GZ

This should create ROS topics:

$ ros2 topic list
/my_namespace/chatter
/chatter_global
/my_namespace/ros_gz_bridge/chatter_private_ns
/my_namespace/chatter_ros_ns

And GZ topics:

$ ign topic --list
/my_namespace/chatter
/chatter_global
/my_namespace/ros_gz_bridge/chatter_private_ns
/chatter_ign_global

@Kotochleb Kotochleb force-pushed the feature/humble/ros-namespaces branch from a539d6c to 36ddd38 Compare March 18, 2024 23:05
ros_gz_bridge/src/ros_gz_bridge.cpp Outdated Show resolved Hide resolved
ros_gz_bridge/src/ros_gz_bridge.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

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

@Kotochleb
Copy link
Contributor Author

@ahcorde I applied your suggestions and signed the commits

@azeey
Copy link
Contributor

azeey commented Mar 19, 2024

hmm, not sure why this is trying to run Rpr__ros_gz__ubuntu_noble_amd64 . It should be testing with Humble on Jammy.

@Kotochleb
Copy link
Contributor Author

@azeey do you think I should just wait for the CI to be solved on your side? It doesn't seem to be broken by my changes

@azeey
Copy link
Contributor

azeey commented Mar 19, 2024

@azeey do you think I should just wait for the CI to be solved on your side? It doesn't seem to be broken by my changes

Yes, this is unrelated to your PR. Hopefully, we'll have a fix soon.

Copy link
Collaborator

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

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

Can you add some documentation in the README ?

Kotochleb and others added 8 commits March 20, 2024 11:06
Signed-off-by: Kotochleb <[email protected]>
Signed-off-by: Kotochleb <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
Signed-off-by: Krzysztof Wojciechowski <[email protected]>
Signed-off-by: Kotochleb <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
Signed-off-by: Krzysztof Wojciechowski <[email protected]>
Signed-off-by: Kotochleb <[email protected]>
@Kotochleb Kotochleb force-pushed the feature/humble/ros-namespaces branch from bdd4e28 to 1df4159 Compare March 20, 2024 10:06
@Kotochleb
Copy link
Contributor Author

@ahcorde I added new section about the remapping to the README.md.
I also sort of allowed myself to change source commands to have humble instead of galactic, as this is humble branch. Since it is a very minor change and I am already making changes in the README, I thought it will be fine to push it with this PR.

@Kotochleb Kotochleb requested a review from ahcorde March 20, 2024 10:30
Copy link
Collaborator

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

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

some more minor comment, otherwise looks good to me

ros_gz_bridge/README.md Outdated Show resolved Hide resolved
ros_gz_bridge/README.md Outdated Show resolved Hide resolved
ros_gz_bridge/README.md Outdated Show resolved Hide resolved
ros_gz_bridge/README.md Outdated Show resolved Hide resolved
Kotochleb and others added 4 commits March 20, 2024 18:10
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
Signed-off-by: Krzysztof Wojciechowski <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
Signed-off-by: Krzysztof Wojciechowski <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
Signed-off-by: Krzysztof Wojciechowski <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
Signed-off-by: Krzysztof Wojciechowski <[email protected]>
@Kotochleb Kotochleb requested a review from ahcorde March 20, 2024 17:11
@ahcorde ahcorde merged commit 0b7c5e9 into gazebosim:humble Mar 20, 2024
4 of 9 checks passed
@ahcorde
Copy link
Collaborator

ahcorde commented Mar 20, 2024

@Kotochleb thank you for your contribution, do you have some time to do the forward port in iron and rolling?

@Kotochleb
Copy link
Contributor Author

@ahcorde you are welcome. I would have time, but it will take me a few more days, as this feature for Humble was something I needed right now. Hopefully I will submit the PRs till end of this week.

ahcorde added a commit that referenced this pull request Mar 25, 2024
Signed-off-by: Kotochleb <[email protected]>
Signed-off-by: Krzysztof Wojciechowski <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
ahcorde added a commit that referenced this pull request Mar 25, 2024
Signed-off-by: Kotochleb <[email protected]>
Signed-off-by: Krzysztof Wojciechowski <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
@ahcorde
Copy link
Collaborator

ahcorde commented Mar 25, 2024

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.

3 participants