Skip to content

Scope launch file dir/path locals to included launch file #862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: rolling
Choose a base branch
from

Conversation

christophebedard
Copy link
Member

Resolves #618

Some context locals are set by IncludeLaunchDescription with the path to the launch file (current_launch_file_path) and the path to the directory containing the launch file (current_launch_file_directory). They can then be used through substitutions: ThisLaunchFile() and ThisLaunchFileDir(), respectively. These only make sense in the included launch file itself, and these locals should not be set when not in a(n included) launch file, e.g., when in a launch script. That usually happens when calling the launch service manually, which is common in tests.

The issue reported in #618 is that IncludeLaunchDescription doesn't reset the context locals to the previous values. This means that the two launch file location locals point to the included launch file even after the IncludeLaunchDescription action in the parent launch file. See the reproducer in the original issue.

The fix is to scope the two launch file location context locals to IncludeLaunchDescription. We also have to remove the context locals after IncludeLaunchDescription if it was included by a launch script (see test). Since there is no easy way/API to remove locals, I had to work around it a bit. I'm open to ideas to make that better.

Note that the solution only scopes the two launch file location locals to IncludeLaunchDescription. Other locals are kept (see test), since included launch files are meant to act as if they were literally included in the parent launch file.

@christophebedard christophebedard self-assigned this Apr 23, 2025
@christophebedard christophebedard force-pushed the christophebedard/include-scope-current-launch-file-and-dir-context-locals branch from ff8bb93 to 36cbcb6 Compare April 23, 2025 19:57
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.

$(dirname) is affected by previous ($find-pkg-share ...)
1 participant