Support for OptionalDeclareLaunchArguments
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 155
- Forks
- 182
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 6
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__'"]))
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with DeclareLaunchArgument and the included launch-description argument validation shown in the error. Reproduce the YAML-parameter case without default_value, then compare it with the unset workaround. Done means an optional declaration can be omitted without failure while a CLI-provided value can still override the loaded parameter.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100