ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

ROS2: load a composable node through launch

asked 2020-09-30 07:16:53 -0500

updated 2020-10-01 10:23:51 -0500

Hi,

The current syntax to launch (as in launch files) composable nodes is to actually run a ComposableNodeContainer that is pre-loaded with nodes.

These nodes can then be unloaded from command line, and other nodes can be loaded similarly from command line.

I am looking for a way to write a launch file that would load nodes in an existing container. For now, using the ComposableNodeContainer syntax leads to a rather strange behavior:

  • launch e.g. ros2 launch composition composition_demo.launch.py
  • launch a possibly modified version of it (just rename the nodes to avoid conflicts, to not rename the container)

    • the container is now appearing twice in ros2 node list
    • ros2 component list only shows information on the second launch
  • kill the second launch

    • ros2 component list now shows that the nodes from the second launch are still in the container

The expected behavior would be to have the final situation, without having to kill the second launch. I would expect that if a container already exists when being launched from a launch file, then the listed ComposableNode's are loaded in the existing one instead of having some kind of shadowing.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-10-01 12:36:38 -0500

jacobperron gravatar image

I think what you are looking for is the LoadComposableNodes action. As the name implies, it loads composable nodes into an already existing container.

As an example, you can check out the stereo_image_proc launch file, where an optional container name can be provided as a launch arg. If a container name is provided, LoadComposableNodes is used. If no container name is provided, ComposableNodeContainer is used.

edit flag offensive delete link more

Comments

Thanks, that is exactly what I meant.

I have added the feature in my simple_launch package that tries to make launch files a bit less verbose.

Olivier Kermorgant gravatar image Olivier Kermorgant  ( 2020-10-01 14:05:15 -0500 )edit

Hi Jocob,

I have a separate launch file for the sensor driver where the sensor driver is added in a ComposableNodeContainer. After adding this launch file using IncludeLaunchDescription, I'm using LoadComposableNodes to load a different node in the same container. But it's not working.

hardesh gravatar image hardesh  ( 2022-02-10 02:50:49 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2020-09-30 07:16:53 -0500

Seen: 1,459 times

Last updated: Oct 01 '20