Skip to content

Comments

Declare Boolean Launch Argument#944

Open
DLu wants to merge 1 commit intoros2:rollingfrom
DLu:declare_boolean_launch
Open

Declare Boolean Launch Argument#944
DLu wants to merge 1 commit intoros2:rollingfrom
DLu:declare_boolean_launch

Conversation

@DLu
Copy link
Contributor

@DLu DLu commented Feb 12, 2026

Description

Just a bit of syntactic sugar to make it easier to use boolean launch arguments. It tidies up launch files and avoids capitalization errors like

[ERROR] [launch.actions.declare_launch_argument]: Argument "use_rviz" provided value "True" is not valid. Valid options are: ['true', 'false']

Is this user-facing behavior change?

Yes, it adds a new shortcut.

Did you use Generative AI?

No.

Signed-off-by: David V. Lu <davidvlu@gmail.com>
@DLu DLu force-pushed the declare_boolean_launch branch from b9a74c2 to b1917ec Compare February 12, 2026 20:46
@DLu
Copy link
Contributor Author

DLu commented Feb 12, 2026

Current results for a preliminary GitHub search of potential usage: 1.2K

@asymingt asymingt self-assigned this Feb 19, 2026
@asymingt
Copy link
Member

Pulls: #944
Gist: https://gist.githubusercontent.com/asymingt/1ad45aa598b1abcaf6d5fd6e0acc139e/raw/352125750b108c7e198231b7eae4731a4b73304f/ros2.repos
BUILD args: --packages-above-and-dependencies launch launch_xml launch_yaml
TEST args: --packages-above launch launch_xml launch_yaml
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/18262

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

Copy link
Member

@asymingt asymingt left a comment

Choose a reason for hiding this comment

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

Implementation looks good; just two small comments. Thanks for the contribution. I'm waiting on a green CI to make sure there are no hidden consequences.

name=name,
default_value=(default_value if not isinstance(default_value, bool)
else str(default_value)),
choices=['true', 'false', 'True', 'False'],
Copy link
Member

Choose a reason for hiding this comment

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

You might also add one additional case: a capitalized TRUE and FALSE here and to your test case.

DeclareBooleanLaunchArgument('name')

# All possible default values
DeclareBooleanLaunchArgument('name', default_value='True')
Copy link
Member

Choose a reason for hiding this comment

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

Did you consider a for loop here for simplicity?

for default_value in ['True', 'true', 'False', 'false', True, False]:
       DeclareBooleanLaunchArgument('name', default_value=default_value)

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.

2 participants