0
$\begingroup$

Rosanswers logo

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.


Originally posted by Olivier Kermorgant on ROS Answers with karma: 280 on 2020-09-30

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by jacobperron with karma: 1870 on 2020-10-01

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Olivier Kermorgant on 2020-10-01:
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.

Comment by hardesh on 2022-02-10:
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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.