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

Use optional parameters in actions #601

Merged
merged 2 commits into from
Sep 5, 2024
Merged

Use optional parameters in actions #601

merged 2 commits into from
Sep 5, 2024

Conversation

caguero
Copy link
Contributor

@caguero caguero commented Sep 5, 2024

🦟 Bug fix

Fixes #554

Summary

This patch lets you use <ros_gz_bridge> and <gz_server> XML elements without having to declare all its arguments.

Testing the bridge

You can modify ros_gz_bridge/launch/ros_gz_bridge.launch with the following content (change your config_file path accordingly):

<launch>
  <ros_gz_bridge
    name="bridge"
    config_file="/home/caguero/ros_gz_ws/src/ros_gz/ros_gz_bridge/test/config/full.yaml" />
</launch>

Launch a ROS container:

ros2 run rclcpp_components component_container --ros-args -r __node:=ros_gz_container

Launch the bridge:

ros2 launch ros_gz_bridge ros_gz_bridge.launch

Verify that the component is loaded:

caguero@cold:~/ros_gz_ws$ ros2 component list
/ros_gz_container
  1  /bridge

Verify that the /ros_chatter topic is listed:

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

Testing ros_gz_sim

Modify ros_gz_sim/launch/ros_gz_sim.launch with (change your config_file path accordingly):

<launch>
  <gz_server
    world_sdf_file="empty.sdf" />
  <ros_gz_bridge
    name="bridge"
    config_file="/home/caguero/ros_gz_ws/src/ros_gz/ros_gz_bridge/test/config/full.yaml" />
</launch>

Launch gzserver and the bridge:

ros2 launch ros_gz_sim ros_gz_sim.launch

Verify that the two components are loaded:

caguero@cold:~/ros_gz_ws$ ros2 component list
/ros_gz_container
  1  /gz_server
  2  /bridge

Verify that you see the logging messages from gzserver on the terminal and that the /ros_chatter topic is listed:

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

Checklist

  • Signed all commits for DCO
  • Added tests
  • 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.

@caguero caguero requested a review from ahcorde as a code owner September 5, 2024 18:07
Signed-off-by: Carlos Agüero <[email protected]>
@azeey azeey self-requested a review September 5, 2024 18:17
@ahcorde ahcorde merged commit 08fca27 into ros2 Sep 5, 2024
4 checks passed
@ahcorde ahcorde deleted the caguero/fix_issue_554 branch September 5, 2024 20:32
use_composition="$(var use_composition)">
</gz_server>
<gz_server
world_sdf_file="empty.sdf" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it still possible to pass this launch file some of the arguments? i.e, can we call ros2 launch ros_gz_sim.launch world_sdf_file=path/to/file.sdf? I'm not, I don't see why we need this file at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change was unintentional. Fixed in #603.

@caguero caguero mentioned this pull request Sep 6, 2024
8 tasks
Amronos pushed a commit to Amronos/ros_gz that referenced this pull request Sep 18, 2024
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.

ros_gz_bridge action requires many of its arguments to be set even though they should be optional
3 participants