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 argument parsing in Actions (backport #663) #665

Closed
wants to merge 2 commits into from

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Dec 11, 2024

🦟 Bug fix

Summary

The RosGzBridge and GzServer now support different spellings for boolean arguments (True, true). This also simplifies how conditionals are used to create composable nodes by evaluating the conditionals and using them as regular Python booleans instead of relying on PythonExpression. It was actually the PythonExpression that was preventing support of boolean arguments spelled true/false.

This came up in #632
The launch file in XML can now use lower case boolean strings:
https://github.com/gazebosim/ros_gz/blob/25b6644b644183e09f517170ce41b5dc6f16d6b8/ros_gz_sim_demos/launch/air_pressure.launch.xml#L1C1-L15C10

The equivalent python launch file for just gzserver and the bridge would be:

from launch import LaunchDescription
from launch_ros.substitutions import FindPackageShare
from ros_gz_sim.actions import GzServer
from ros_gz_bridge.actions import RosGzBridge

def generate_launch_description():

    return LaunchDescription([
        GzServer(world_sdf_file='sensors.sdf', use_composition=True, create_own_container=True),
        RosGzBridge(bridge_name='bridge1', 
                    config_file=[FindPackageShare('ros_gz_sim_demos'), '/config/air_pressure.yaml'],
                    use_composition='true'
                    )
    ])

Note the use_composition argument can be a python boolean or a string (True or true). We should probably deprecate the string input at some point since that's not very Pythonic

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.


This is an automatic backport of pull request #663 done by Mergify.

The `RosGzBridge` and `GzServer` now support different spellings for
boolean arguments (`True`, `true`). This also simplifies how
conditionals are used to create composable nodes by evaluating the
conditionals and using them as regular Python booleans instead of
relying on `PythonExpression`. It was actually the `PythonExpression`
that was preventing support of boolean arguments spelled `true`/`false`.

Signed-off-by: Addisu Z. Taddese <[email protected]>
(cherry picked from commit a0c04de)
Signed-off-by: Addisu Z. Taddese <[email protected]>
(cherry picked from commit ff96f97)

# Conflicts:
#	.github/workflows/ros2-ci.yml
#	README.md
#	ros_gz/CHANGELOG.rst
#	ros_gz/package.xml
#	ros_gz_bridge/CHANGELOG.rst
#	ros_gz_bridge/package.xml
#	ros_gz_bridge/ros_gz_bridge/actions/ros_gz_bridge.py
#	ros_gz_image/CHANGELOG.rst
#	ros_gz_image/package.xml
#	ros_gz_interfaces/CHANGELOG.rst
#	ros_gz_interfaces/package.xml
#	ros_gz_sim/CHANGELOG.rst
#	ros_gz_sim/package.xml
#	ros_gz_sim/ros_gz_sim/actions/gzserver.py
#	ros_gz_sim_demos/CHANGELOG.rst
#	ros_gz_sim_demos/package.xml
#	test_ros_gz_bridge/CHANGELOG.rst
#	test_ros_gz_bridge/package.xml
@mergify mergify bot requested a review from ahcorde as a code owner December 11, 2024 09:06
@mergify mergify bot added the conflicts label Dec 11, 2024
Copy link
Contributor Author

mergify bot commented Dec 11, 2024

Cherry-pick of ff96f97 has failed:

On branch mergify/bp/jazzy/pr-663
Your branch is ahead of 'origin/jazzy' by 1 commit.
  (use "git push" to publish your local commits)

You are currently cherry-picking commit ff96f97.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both added:      .github/workflows/ros2-ci.yml
	both added:      README.md
	both added:      ros_gz/CHANGELOG.rst
	both added:      ros_gz/package.xml
	both added:      ros_gz_bridge/CHANGELOG.rst
	both added:      ros_gz_bridge/package.xml
	both added:      ros_gz_bridge/ros_gz_bridge/actions/ros_gz_bridge.py
	both added:      ros_gz_image/CHANGELOG.rst
	both added:      ros_gz_image/package.xml
	both added:      ros_gz_interfaces/CHANGELOG.rst
	both added:      ros_gz_interfaces/package.xml
	both added:      ros_gz_sim/CHANGELOG.rst
	both added:      ros_gz_sim/package.xml
	both added:      ros_gz_sim/ros_gz_sim/actions/gzserver.py
	both added:      ros_gz_sim_demos/CHANGELOG.rst
	both added:      ros_gz_sim_demos/package.xml
	both added:      test_ros_gz_bridge/CHANGELOG.rst
	both added:      test_ros_gz_bridge/package.xml

no changes added to commit (use "git add" and/or "git commit -a")

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify mergify bot mentioned this pull request Dec 11, 2024
8 tasks
@ahcorde ahcorde closed this Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants