Closed nrasulnrasul closed 11 months ago
So this may be somewhat surprising, but I think it is expected behavior.
In particular, what you've done is to ask for two containers to be launched with the exact same name (you have two node_container
entries). But that is a very dangerous thing to do (and is why we have the warning you see in ros2 node list
), because now they share service names. The launch process loads in components using service calls, and since they share service names it looks like they are both getting the plugins loaded into them.
The solution here is to make sure to name the two container nodes differently.
Thanks for the reply.
The intention of above code is to launch 2 nodes in same container (i.e. in same process) to avoid message copying when intra process communication is enabled. That's why same name is used for container in both launch files.
I have seen ROS 2 examples of running multiple nodes in same container in same launch file but not from multiple launch files.
In ROS1, it was possible to launch multiple nodelets in the same nodelet manager from different launch files.
I was able to load components in same container by using 'load_composable_node' tag.
Bug report
Required Info:
Steps to reproduce issue
Try to launch composable nodes from different launch files(in xml format ) with in the same node_container.
Example : I want to launch 2 instances of node 'my_launch_test::MinimalPublisher' in container with name 'cntr_a'
launch file 1 : launch_test.launch
launch file 2 : launch2.launch
Expected behavior
container
cntr_a
must start once and load the 2 nodes with namesnode_a
andnode_b
once.Actual behavior
container
cntr_a
starts 2 times and each instance of container loads both nodes. i.e node_a starts 2 times, node_b starts 2 times.output after launching above launch file:
You can observer the process id and node name which were printed from node constructor.
output from
ros2 node list
Additional information
Assume 2 launch files L1, L2. L1 starts a container with name 'C1' and loads 'Node1'. L2 starts a container with name 'C1' and loads 'Node2'. Now start L1 and L2 in different terminals. Result will be Container 'C1' starts 2 times but loads 'Node1' and 'Node2' only once.