Skip to content

Commit da9b830

Browse files
add explanation about component containers. (#4902) (#4919)
Signed-off-by: Tomoya Fujita <[email protected]> Co-authored-by: Christophe Bedard <[email protected]> (cherry picked from commit 994c0d9) Co-authored-by: Tomoya Fujita <[email protected]>
1 parent 98b7e4f commit da9b830

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

source/Concepts/Intermediate/About-Composition.rst

+24
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,30 @@ By making the process layout a deploy-time decision the user can choose between:
3333

3434
Additionally ``ros2 launch`` can be used to automate these actions through specialized launch actions.
3535

36+
.. _ComponentContainer:
37+
38+
Component Container
39+
-------------------
40+
41+
A component container is a host process that allows you to load and manage multiple components at runtime within the same process space.
42+
43+
As of now, the following generic component container types are available:
44+
45+
* `component_container <https://github.com/ros2/rclcpp/blob/{REPOS_FILE_BRANCH}/rclcpp_components/src/component_container.cpp>`__
46+
47+
* The most generic component container that uses a single ``SingleThreadedExecutor`` to execute all components.
48+
49+
* `component_container_mt <https://github.com/ros2/rclcpp/blob/{REPOS_FILE_BRANCH}/rclcpp_components/src/component_container_mt.cpp>`__
50+
51+
* Component container that uses a single ``MultiThreadedExecutor`` to execute the components.
52+
53+
* `component_container_isolated <https://github.com/ros2/rclcpp/blob/{REPOS_FILE_BRANCH}/rclcpp_components/src/component_container_isolated.cpp>`__
54+
55+
* Component container that uses a dedicated executor for each component: either ``SingleThreadedExecutor`` (default) or ``MultiThreadedExecutor``.
56+
57+
For more information about the types of executors, see the :ref:`TypesOfExecutors`.
58+
For more information about the options of each component container, see :ref:`ComponentContainerTypes` in the composition tutorial.
59+
3660
Writing a Component
3761
-------------------
3862

source/Concepts/Intermediate/About-Executors.rst

+2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ The *wait set* is also used to detect when timers expire.
5959

6060
The Single-Threaded Executor is also used by the container process for :doc:`components <./About-Composition>`, i.e. in all cases where nodes are created and executed without an explicit main function.
6161

62+
.. _TypesOfExecutors:
63+
6264
Types of Executors
6365
------------------
6466

source/Tutorials/Intermediate/Composition.rst

+27
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,33 @@ Advanced Topics
210210

211211
Now that we have seen the basic operation of components, we can discuss a few more advanced topics.
212212

213+
.. _ComponentContainerTypes:
214+
215+
Component container types
216+
^^^^^^^^^^^^^^^^^^^^^^^^^
217+
218+
As introduced in :ref:`ComponentContainer`, there are a few component container types with different options.
219+
You can choose the most appropriate component container type for your requirement.
220+
221+
* ``component_container`` (No options / parameters available)
222+
223+
.. code-block:: bash
224+
225+
ros2 run rclcpp_components component_container
226+
227+
* ``component_container_mt`` with ``MultiThreadedExecutor`` composed of 4 threads.
228+
* ``thread_num`` parameter option is available to specify the number of threads in ``MultiThreadedExecutor``.
229+
230+
.. code-block:: bash
231+
232+
ros2 run rclcpp_components component_container_mt --ros-args -p thread_num:=4
233+
234+
* ``component_container_isolated`` with ``MultiThreadedExecutor`` for each component.
235+
* ``--use_multi_threaded_executor`` argument specifies executor type used for each component to ``MultiThreadedExecutor``.
236+
237+
.. code-block:: bash
238+
239+
ros2 run rclcpp_components component_container_isolated --use_multi_threaded_executor
213240
214241
Unloading components
215242
^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)