Skip to content

Support for OptionalDeclareLaunchArguments #946

@michaelcarlstrom-civrobotics

Description

Description

Currently need to set default_value='foo' or get the following error.

[ERROR] [launch]: Caught exception in launch (see debug for traceback): Included launch description missing required argument 'bar' (description: 'no description given'), given: [foo]

Motivation

Basically I have parameter yaml file I'm loading. And I want to be able to override via the cli. But I can't easily have it override since the DeclareLaunchArgument gives the above error when there is no default.

Design / Implementation Considerations

Maybe some sort of subclass of DeclareLaunchArgument which is OptionalDeclareLaunchArgument which takes an action to execute if a value is passed at cli but, otherwise does nothing?

Additional Information

I got around this with making a canonical unset default but it is inelegant.

DeclareLaunchArgument('bar', default_value='__unset__')
IfCondition(PythonExpression(["'", bar, "' != '__unset__'"]))

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions