Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
14 changes: 9 additions & 5 deletions source/Concepts/Intermediate/About-Composition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,21 @@ A component container is a host process that allows you to load and manage multi

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>`__
* ``component_container``

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

* `component_container_mt <https://github.com/ros2/rclcpp/blob/{REPOS_FILE_BRANCH}/rclcpp_components/src/component_container_mt.cpp>`__
* ``component_container --executor-type multi-threaded``

* 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 --executor-type events-cbg``

* Component container that uses a dedicated executor for each component: either ``SingleThreadedExecutor`` (default) or ``MultiThreadedExecutor``.
* Component container that uses a single ``EventsCBGExecutor`` to execute the components.

* ``component_container --executor-type single-threaded --isolated``

* Component container that uses a dedicated executor for each component: available options are ``SingleThreadedExecutor`` (default), ``MultiThreadedExecutor``, and ``EventsCBGExecutor``.

For more information about the types of executors, see the :ref:`TypesOfExecutors`.
For more information about the options of each component container, see :ref:`ComponentContainerTypes` in the composition tutorial.
Expand Down
6 changes: 4 additions & 2 deletions source/Concepts/Intermediate/About-Executors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,19 @@ The Single-Threaded Executor is also used by the container process for :doc:`com
Types of Executors
------------------

Currently, rclcpp provides two Executor types, derived from a shared parent class:
Currently, rclcpp provides three Executor types, derived from a shared parent class:

.. graphviz::

digraph Flatland {

Executor -> SingleThreadedExecutor [dir = back, arrowtail = empty];
Executor -> MultiThreadedExecutor [dir = back, arrowtail = empty];
Executor -> EventsCBGExecutor [dir = back, arrowtail = empty];
Executor [shape=polygon,sides=4];
SingleThreadedExecutor [shape=polygon,sides=4];
MultiThreadedExecutor [shape=polygon,sides=4];
EventsCBGExecutor [shape=polygon,sides=4];

}

Expand Down Expand Up @@ -165,7 +167,7 @@ This semantics was first described in a `paper by Casini et al. at ECRTS 2019 <h
Outlook
-------

While the two Executors of rclcpp work well for most applications, there are some issues that make them not suitable for real-time applications, which require well-defined execution times, determinism, and custom control over the execution order.
While the three Executors of rclcpp work well for most applications, there are some issues that make them not suitable for real-time applications, which require well-defined execution times, determinism, and custom control over the execution order.
Here is a summary of some of these issues:

1. Complex and mixed scheduling semantics.
Expand Down
20 changes: 14 additions & 6 deletions source/Tutorials/Intermediate/Composition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -197,25 +197,33 @@ Component container types
As introduced in :ref:`ComponentContainer`, 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)
* ``component_container`` with ``SingleThreadedExecutor``.

.. code-block:: console

$ ros2 run rclcpp_components component_container

* ``component_container_mt`` with ``MultiThreadedExecutor`` composed of 4 threads.
* ``component_container`` with ``MultiThreadedExecutor`` composed of 4 threads.
* ``thread_num`` parameter option is available to specify the number of threads in ``MultiThreadedExecutor``.
If omitted, the executor will run with the maximum available threads on the system.

.. code-block:: console

$ ros2 run rclcpp_components component_container_mt --ros-args -p thread_num:=4
$ ros2 run rclcpp_components component_container --executor-type multi-threaded --ros-args -p thread_num:=4

* ``component_container_isolated`` with ``MultiThreadedExecutor`` for each component.
* ``--use_multi_threaded_executor`` argument specifies executor type used for each component to ``MultiThreadedExecutor``.
* ``component_container`` with ``EventsCBGExecutor`` composed of a single thread.
* ``thread_num`` parameter option is available to specify the number of threads in ``EventsCBGExecutor``.
If omitted, the executor will run with the maximum available threads on the system.

.. code-block:: console

$ ros2 run rclcpp_components component_container_isolated --use_multi_threaded_executor
$ ros2 run rclcpp_components component_container --executor-type events-cbg --ros-args -p thread_num:=1

* ``component_container`` with a dedicated ``MultiThreadedExecutor`` for each component.

.. code-block:: console

$ ros2 run rclcpp_components component_container --executor-type multi-threaded --isolated

Unloading components
^^^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,4 @@ you can replace it with

.. caution::

If you need multi-threading, instead of setting your executable to ``component_container``, set it to ``component_container_mt``
If you need multi-threading, simply add the ``--executor-type multi-threaded`` argument to your container node.
Loading