Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add explanation about component containers. #4902

Open
wants to merge 3 commits into
base: rolling
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions source/Concepts/Intermediate/About-Composition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,29 @@ By making the process layout a deploy-time decision the user can choose between:

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

.. _ComponentContainerTypes:
fujitatomoya marked this conversation as resolved.
Show resolved Hide resolved

Component Container
-------------------

A component container is a host process that allows you to load and manage multiple components at runtime within the same process space.

As of now, the following generic component container types are available:

* `component_container <https://github.com/ros2/rclcpp/blob/{REPOS_FILE_BRANCH}/rclcpp_components/src/component_container.cpp>`__
fujitatomoya marked this conversation as resolved.
Show resolved Hide resolved

* The most generic component container that uses a single ``SingleThreadedExecutor`` to execute all components.

* `component_container_mt <https://github.com/ros2/rclcpp/blob/{REPOS_FILE_BRANCH}/rclcpp_components/src/component_container_mt.cpp>`__

* Component container that uses a single ``MultiThreadedExecutor`` to execute the components.

* `component_container_isolated <https://github.com/ros2/rclcpp/blob/{REPOS_FILE_BRANCH}/rclcpp_components/src/component_container_isolated.cpp>`__

* Component container that uses a dedicated executor for each component: either ``SingleThreadedExecutor`` (default) or ``MultiThreadedExecutor``.

For more information about the types of executors, see the :ref:`TypesOfExecutors`.
fujitatomoya marked this conversation as resolved.
Show resolved Hide resolved

Writing a Component
-------------------

Expand Down
2 changes: 2 additions & 0 deletions source/Concepts/Intermediate/About-Executors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ The *wait set* is also used to detect when timers expire.

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.

.. _TypesOfExecutors:

Types of Executors
------------------

Expand Down
25 changes: 25 additions & 0 deletions source/Tutorials/Intermediate/Composition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,31 @@ Advanced Topics

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

Component Container Types
fujitatomoya marked this conversation as resolved.
Show resolved Hide resolved
^^^^^^^^^^^^^^^^^^^^^^^^^

As introduced in :ref:`ComponentContainerTypes`, there are a few component container types with different options.
You can choose the most appropriate component container type for your requirement.

* ``component_container`` (No options / parameters available)
fujitatomoya marked this conversation as resolved.
Show resolved Hide resolved

.. code-block:: bash

ros2 run rclcpp_components component_container

* ``component_container_mt`` with ``MultiThreadedExecutor`` composed of 4 threads.
fujitatomoya marked this conversation as resolved.
Show resolved Hide resolved
* ``thread_num`` parameter option is available to specify the number of threads in ``MultiThreadedExecutor``.

.. code-block:: bash

ros2 run rclcpp_components component_container_mt --ros-args -p thread_num:=4

* ``component_container_isolated`` with ``MultiThreadedExecutor`` for each component.
fujitatomoya marked this conversation as resolved.
Show resolved Hide resolved
* ``--use_multi_threaded_executor`` argument specifies executor type used for each component to ``MultiThreadedExecutor``.

.. code-block:: bash

ros2 run rclcpp_components component_container_isolated --use_multi_threaded_executor

Unloading components
^^^^^^^^^^^^^^^^^^^^
Expand Down