@@ -32,16 +32,37 @@ We'll backport it to ROS 2 Jazzy soon.
3232## Composition
3333
3434If you inspect the parameters of the launch files mentioned in the next
35- tutorials, you'll notice that we have included in most cases a parameter named
36- ` use_composition ` . When that parameter is set to ` True ` , the associated ROS
37- node will be included within a ROS container. When this happens all the nodes
38- live within the same process and can leverage intraprocess communication.
39-
40- Our recommendation is to always set the ` use_composition ` parameter to ` True ` .
41- That way, the communication between Gazebo and the bridge will be intraprocess.
42- If your ROS nodes are also written as composable nodes, make sure that they are
43- launched with the ` container_node_name ` parameter matching the container name
44- including Gazebo and the bridge.
35+ tutorials, you'll notice that we have included in most cases two parameters
36+ named ` use_composition ` and ` create_own_container ` . When the ` use_composition `
37+ parameter is set to ` True ` , the associated ROS node will be loaded within a
38+ ROS container. When this happens, all the nodes within the same ROS container
39+ share the same process and can leverage intraprocess communication.
40+
41+ The parameter ` create_own_container ` only makes sense when ` use_composition ` is
42+ set to ` True ` . This parameter lets you control whether your start a ROS
43+ container for your composable nodes or you defer to an external ROS container.
44+
45+ Our recommendation is to always set the ` use_composition ` parameter to ` True `
46+ and decide if you need to create your own container based on your configuration.
47+ Typically, if you're only dealing with your own launch files you'll probably set
48+ ` create_own_container ` to ` True ` . On the other hand, if you're using your launch
49+ files as part of a more complex startup where a ROS container is already
50+ present, you should set ` create_own_container ` to ` False ` and, instead, set the
51+ parameter ` container_name ` to the existing container name.
52+
53+ That way, the communication between Gazebo, the bridge, and other potential
54+ ROS nodes will be intraprocess.
55+
56+ ![ composition_options] ( images/composition_options.png )
57+
58+ This figure illustrates the concept of composition. The left diagram captures
59+ the idea of not using composition. All the three example nodes are standalone
60+ nodes, and they can talk via interprocess communication. The center diagram
61+ represents the scenario where we use composition and we start our own container
62+ from our own launch file. All communication is intraprocess here. The right
63+ diagram is still using composition but the launch file doesn't start the
64+ container directly. This setup by itself will not work until you start an
65+ external ROS container (manually or via a separate launch file).
4566
4667You can learn more about ROS composition in [ this tutorial] ( https://docs.ros.org/en/galactic/Tutorials/Intermediate/Composition.html ) .
4768
0 commit comments