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

Launch gzserver and the bridge as composable nodes #528

Merged
merged 27 commits into from
May 23, 2024

Conversation

caguero
Copy link
Contributor

@caguero caguero commented Apr 4, 2024

🎉 New feature

Part of #544

Summary

Extends #500 and converts the gzserver ROS node into a ROS component. It also adds a launch file that creates a container and loads two ROS nodes: gzserver and a bridge.

  • The idea of loading bridges, gzserver and potentially other ROS user components under the same container will benefit performance as we'll use intraprocess in Transport and in ROS. If the ROS user code runs outside of the container, we'll still have the gz Transport intraprocess advantage.

  • Each bridge will be loaded as a separate ROS component. There might be some extra overhead compared with a scenario where all bridges are loaded within the same ROS component. However, there are advantages as many of the ROS utilities should work as expected (topic remapping, namespaces, etc.).

How to test it?

Use the provided ros_gz_sim.launch.py (modify config_file accordingly):

ros2 launch ros_gz_sim gz_sim_composition.launch.py world_sdf_file:=empty.sdf config_file:=/home/caguero/ros_gz_ws//src/ros_gz/ros_gz_bridge/test/config/full.yaml

gzserver and the bridge should be running. Open a new terminal and confirm that the two ROS nodes are loaded:

caguero@cold:~/ros_gz_ws$ ros2 component list
/gz_sim_container
  1  /gzserver
  2  /bridge

Verify that the bridge is advertising /ros_chatter:

caguero@cold:~/ros_gz_ws$ ros2 topic list
/parameter_events
/ros_chatter
/rosout

Now, open a new terminal and load a new bridge into the existing container:

caguero@cold:~/ros_gz_ws$ ros2 component load /gz_sim_container ros_gz_bridge ros_gz_bridge::RosGzBridge -p config_file:=/home/caguero/ros_gz_ws//src/ros_gz/ros_gz_bridge/test/config/minimum.yaml -e use_intra_process_comms:=true
Loaded component 3 into '/gz_sim_container' container node as '/ros_gz_bridge'

Confirm it:

caguero@cold:~/ros_gz_ws$ ros2 component list
/gz_sim_container
  1  /gzserver
  2  /bridge
  3  /ros_gz_bridge

Now verify that the new bridge is advertising the new topics:

caguero@cold:~/ros_gz_ws$ ros2 topic list
/chatter
/chatter_both_ros
/chatter_gz
/chatter_ros
/parameter_events
/ros_chatter
/rosout

Test it

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

azeey and others added 5 commits February 21, 2024 15:22
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
@caguero caguero requested a review from azeey April 4, 2024 18:08
caguero and others added 2 commits April 4, 2024 20:38
Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
@azeey
Copy link
Contributor

azeey commented Apr 4, 2024

I just updated merged from ros2 in #500. Can you merge from gz_sim_ros_node so CI will run?

@azeey
Copy link
Contributor

azeey commented Apr 4, 2024

cc @mjcarroll

@caguero
Copy link
Contributor Author

caguero commented Apr 4, 2024

I just updated merged from ros2 in #500. Can you merge from gz_sim_ros_node so CI will run?

Merged from gz_sim_ros_node.

Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
@azeey azeey mentioned this pull request Apr 10, 2024
9 tasks
caguero and others added 9 commits April 11, 2024 19:56
* Launch file for the bridge

Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
* Launch file for the bridge

Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
* Combined gzserver + bridge launch file.

Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
* Combined spawn_model + bridge launch file.
Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
* Launch file for the bridge

Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
@azeey azeey mentioned this pull request May 22, 2024
12 tasks
azeey added 2 commits May 22, 2024 14:26
…_node_composition

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
@caguero caguero marked this pull request as ready for review May 22, 2024 19:37
@caguero caguero requested a review from ahcorde as a code owner May 22, 2024 19:37
Base automatically changed from gz_sim_ros_node to ros2 May 22, 2024 21:12
launch_gz/setup.py Outdated Show resolved Hide resolved
launch_gz/package.xml Outdated Show resolved Hide resolved
launch_gz/setup.py Outdated Show resolved Hide resolved
ros_gz_sim/src/gzserver.cpp Show resolved Hide resolved
ros_gz_sim/src/gzserver.cpp Show resolved Hide resolved
launch_gz/package.xml Outdated Show resolved Hide resolved
ros_gz_sim/CMakeLists.txt Outdated Show resolved Hide resolved
caguero and others added 5 commits May 23, 2024 19:04
Co-authored-by: Addisu Z. Taddese <addisu@openrobotics.org>
Signed-off-by: Carlos Agüero <cen.aguero@gmail.com>
Co-authored-by: Addisu Z. Taddese <addisu@openrobotics.org>
Signed-off-by: Carlos Agüero <cen.aguero@gmail.com>
Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
ros_gz_sim/ros_gz_sim/actions/gzserver.py Outdated Show resolved Hide resolved
ros_gz_sim/setup.cfg Outdated Show resolved Hide resolved
Signed-off-by: Carlos Agüero <caguero@openrobotics.org>
Copy link
Contributor

@azeey azeey left a comment

Choose a reason for hiding this comment

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

Great work!! I'm excited to see this get in.

There are still some issues around required parameters. For example, the following doesn't work.

<launch>
  <arg name="world_sdf_file" default="empty.sdf" />
  <gz_server world_sdf_file="$(var world_sdf_file)" />
</launch>

But let's address that in a follow up PR.

@caguero caguero merged commit ac0b1a5 into ros2 May 23, 2024
3 checks passed
@caguero caguero deleted the gz_sim_ros_node_composition branch May 23, 2024 21:40
Amronos pushed a commit to Amronos/ros_gz that referenced this pull request Sep 18, 2024
* Add gzserver with ability to load an SDF file or string

Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants