Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can use the GroupAction action. From its docstring:

Action that yields other actions, optionally scoping launch configurations.

This action is used to nest other actions without including a separate launch description, while also optionally having a condition (like all other actions), scoping launch configurations, and/or declaring launch configurations for just the group and its yielded actions.

You can wrap the inclusion of ext in a group action to achieve the scoping you want:

            'arg1': 'External_Arg_Mod'

With that, running ros2 launch launch_test gives:

[INFO] [launch.user]: Internal Arg (before): Internal_Arg
[INFO] [launch.user]: External Arg: External_Arg_Mod
[INFO] [launch.user]: Internal Arg (after): Internal_Arg

Internally the scoping works by using the PushLaunchConfigurations and PopLaunchConfigurations actions:

        if self.__scoped:
            self.__actions_to_return = [

So you may also be able to surround the include with those in your own launch file if you feel that using GroupAction around a single action is less nice.