Skip to content

IncludeLaunchDescription - request name without suffix/extension #849

@emersonknapp

Description

@emersonknapp

Description

Allow LaunchDescription inclusion to happen with an incomplete name, having auto-completion fill in the suffix/extension, throwing an error if it's ambiguous.

Examples:

Commandline

ros2 launch nav2_bringup bringup

Python launchfile

from pathlib import Path

from ament_index_python.packages import get_package_share_directory
from launch.actions import  IncludeLaunchDescription

...

  launch_dir = Path(get_package_share_directory('nav2_bringup') / 'launch' 
  ...
  IncludeLaunchDescription(launch_dir / 'bringup'))

XML

<include file="$(find-pkg-share nav2_bringup)/launch/bringup" />

YAML

- include:
    file: "$(find-pkg-share nav2_bringup)/launch/bringup"

All of these would resolve to actually including bringup_launch.py without having to say launch twice, or know it's implemented in python

Motivation

Given that users can write launchfiles in several languages, we have a usability/discoverability problem.

Launchfile authors want to put a syntax-appropriate suffix on the file, so that code editors will highlight the syntax properly.

However from a user perspective, the action of including a launchfile is a semantic one. I am saying "please launch this semantic ros subgraph/system", and I explicitly do not care what language the description of that subsystem was implemented in. Compare: I don't care what language client is publishing the topic I am subscribing to, I should not have to say subscribe_to_python_publisher('topic_name_py').

The discussion of using a single common suffix for launchfiles is pretty split, at least within the core contributor base, so globally using .launch is probably never going to be the solution for this.

So, based on some discussions around this limitation, this way of approaching the problem came up.

This allows authors to

  1. Properly suffix the file for syntax highlighting in editor
  2. Change syntaxes later without breaking users who include the particular launch description

And allows users to

  1. Not know or care which language was used to provide a description, focusing on the package's exposed semantic interface

Design / Implementation Considerations

Probably have to do:

  • If file of given name exists, OK
  • Else check path.parent for files with that prefix
  • If there are multiple, throw error
  • Else launch that file

Maybe we want to limit this to a specified list of "allowed suffixes" so not any suitable prefix would match?

.launch
.xml
.y[a]ml
.py
_launch.[xml|y[a]ml|py]
.launch.[xml|y[a]ml|py]

Additional Information

When implemented, tutorials and demos should be updated to provide this as the default usage pattern.

ros2launch CLI should show semantic prefixes as the autocomplete options

Metadata

Metadata

Assignees

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