Ask Your Question

Launch component into container defined by included launch file

asked 2021-10-07 13:56:28 -0600

fhwedel-hoe gravatar image


This question can be regarded as an extension of the question and

Situation: I have a "base" launch file which describes a collection of nodes. Some of these nodes are launched in a component container. The base launch file is already fairly complex. I do not want to add to it any further.

Goal: To further expand the project, I want to build upon the base rather than to change it. I want to create a launch file which includes the base launch file and then describes some more nodes to launch. Some of these nodes need to be added to the component container which is described by the included launch file.

This is what I have so far (includes omitted for readability):

base_package_directory = get_package_share_directory('base_package')
base_launch_description = IncludeLaunchDescription(PythonLaunchDescriptionSource(base_package + '/launch/'))
base_container = next(e for e in base_vehicle.get_sub_entities()[0].entities if isinstance(e, ComposableNodeContainer))
additional_node = LoadComposableNodes(
    composable_node_descriptions = [ComposableNode(
        name = 'additional_node',
        package = 'additional_package',
        plugin = 'additional_node',
    target_container = base_container,
return launch.LaunchDescription([base_launch_description, additional_node])

This looks terribly ugly. Also, it results in an error:

RuntimeError: cannot access 'node_name' before executing action

Where node_name is an attribute of the ComposableNodeContainer "base_container".

My guts are telling me "you are doing it wrong" – especially when looking at line 2 and 3. How do I do this right?

Kind regards

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2021-10-07 20:20:38 -0600

ChuiV gravatar image

If you know the container name, then you can use that name as the target_container:

additional_node = LoadComposableNodes(


edit flag offensive delete link more


Thank you. :) Small hint for the next one looking at this: It needs to be the "fully qualified" name. In my case, a namespace is involved. The target_container becomes '/whatever_namespace/base_container_node_name'.

fhwedel-hoe gravatar image fhwedel-hoe  ( 2021-10-11 11:14:02 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2021-10-07 13:56:28 -0600

Seen: 29 times

Last updated: Oct 07 '21