Skip to content

Commit 94bf175

Browse files
committed
add explanation about component containers.
Signed-off-by: Tomoya.Fujita <[email protected]>
1 parent 3d4b2ef commit 94bf175

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

source/Concepts/Intermediate/About-Composition.rst

+21
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,27 @@ 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+
Component container
37+
-------------------
38+
39+
Component container is a host process that allows you to load and manage multiple components at runtime within the same process space.
40+
This enables better performance and memory efficiency because it avoids inter-process communication overhead when nodes interact.
41+
42+
As of now, these are generic component container types available.
43+
44+
* `component_container <https://github.com/ros2/rclcpp/blob/{REPOS_FILE_BRANCH}/rclcpp_components/src/component_container.cpp>`__
45+
* The most generic component container that uses a single ``SingleThreadedExecutor`` to execute all components including component container itself.
46+
47+
* `component_container_mt <https://github.com/ros2/rclcpp/blob/{REPOS_FILE_BRANCH}/rclcpp_components/src/component_container_mt.cpp>`__
48+
* Component container that uses a single ``MultiThreadedExecutor`` to execute the components including component container itself.
49+
* ``thread_num`` parameter option is available to specify the number of threads in ``MultiThreadedExecutor``.
50+
51+
* `component_container_isolated <https://github.com/ros2/rclcpp/blob/{REPOS_FILE_BRANCH}/rclcpp_components/src/component_container_isolated.cpp>`__
52+
* Component container with dedicated either ``SingleThreadedExecutor`` (default) or ``MultiThreadedExecutor`` executors for each component. (Component container is executed by ``SingleThreadedExecutor``)
53+
* ``--use_multi_threaded_executor`` argument specifies executor type used for each component to ``MultiThreadedExecutor``.
54+
55+
See more details for :doc:`Types of Executors <../Concepts/About-Executors#types-of-executors>`.
56+
3657
Writing a Component
3758
-------------------
3859

source/Tutorials/Intermediate/Composition.rst

+23
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,29 @@ Advanced Topics
210210

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

213+
Component container types
214+
^^^^^^^^^^^^^^^^^^^^^^^^^
215+
216+
As introduced in :doc:`Component container <../../Concepts/About-Composition#component-container>`, there is a few component container types with options.
217+
You can choose the most appropriate component container type for your requirement.
218+
219+
* ``component_container`` (No options / parameters available)
220+
221+
.. code-block:: bash
222+
223+
ros2 run rclcpp_components component_container
224+
225+
* ``component_container_mt`` with ``MultiThreadedExecutor`` composed of 4 threads.
226+
227+
.. code-block:: bash
228+
229+
ros2 run rclcpp_components component_container_mt --ros-args -p thread_num:=4
230+
231+
* ``component_container_isolated`` with ``MultiThreadedExecutor`` for each component.
232+
233+
.. code-block:: bash
234+
235+
ros2 run rclcpp_components component_container_isolated --use_multi_threaded_executor
213236
214237
Unloading components
215238
^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)