Skip to content

Add ament-index resource substitution#522

Open
nwn wants to merge 4 commits intoros2:rollingfrom
nwn:nwn-launch-ament-index
Open

Add ament-index resource substitution#522
nwn wants to merge 4 commits intoros2:rollingfrom
nwn:nwn-launch-ament-index

Conversation

@nwn
Copy link

@nwn nwn commented Mar 3, 2026

Description

This introduces a new launch substitution, AmentIndexResource, to get the prefix path of the specified resource. This is essentially a generalization of the existing FindPackagePrefix substitution that works for any resource type in the ament index. The substitution takes the resource type and name as its two arguments and returns the prefix path result of looking those up with ament_index_python.get_resource().

This is also exposed in the XML/YAML front-ends as ament-index-resource. Note that in this case, since these front-ends split arguments based on whitespace, it is not possible to look up resources that contain whitespace characters in their type or name.

Is this user-facing behavior change?

Exposes a new launch-file substitution to users.

Did you use Generative AI?

No

Additional Information

nwn added 4 commits March 2, 2026 23:00
This takes two arguments: a resource type and a resource name. These
will be resolved and then used to look up a resource in the ament index.

Due to how launch files parse substitution arguments by splitting on
spaces, the resource type and name cannot contain spaces when using the
XML and YAML front-ends. We could try using a different separator for
the two, such as a `/` character (since this is guaranteed not to appear
in a directory name, and therefore not in an ament resource type
either); however, this would complicate things significantly and mean we
have to delay the splitting until `perform()` is called and we can
resolve any nested substitutions.

Signed-off-by: Nathan Wiebe Neufeldt <wn.nathan@gmail.com>
Signed-off-by: Nathan Wiebe Neufeldt <wn.nathan@gmail.com>
Signed-off-by: Nathan Wiebe Neufeldt <wn.nathan@gmail.com>
These check that the substitution works in XML and YAML launch files.

Signed-off-by: Nathan Wiebe Neufeldt <wn.nathan@gmail.com>
@christophebedard christophebedard self-requested a review March 12, 2026 16:54
@christophebedard christophebedard self-assigned this Mar 12, 2026
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