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

Deprecate StaticSingleThreaded Executor. #4812

Merged
Merged
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
17 changes: 11 additions & 6 deletions source/Concepts/Intermediate/About-Executors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,15 @@ Currently, rclcpp provides three Executor types, derived from a shared parent cl
}

The *Multi-Threaded Executor* creates a configurable number of threads to allow for processing multiple messages or events in parallel.
The *Static Single-Threaded Executor* optimizes the runtime costs for scanning the structure of a node in terms of subscriptions, timers, service servers, action servers, etc.
It performs this scan only once when the node is added, while the other two executors regularly scan for such changes.
Therefore, the Static Single-Threaded Executor should be used only with nodes that create all subscriptions, timers, etc. during initialization.

.. note::

The *Static Single-Threaded Executor* has been deprecated, and *Single-Threaded Executor* is recommended instead.
The *Static Single-Threaded Executor* was developed to reduce the the runtime costs for scanning the entities of a node in terms of subscriptions, timers, service servers, action servers, etc.
These runtime improvements are now available also in all the other *Executor*.
Besides, the *Static Single-Threaded Executor* has a few issues such as `max duration is not respected in spin_some <https://github.com/ros2/rclcpp/issues/2462>`__.
Because of these unstable issues, some unit tests are skipped for *Static Single-Threaded Executor*.
You can see more details for `ROS Discourse: The ROS 2 C++ Executors <https://discourse.ros.org/t/the-ros-2-c-executors/38296>`__.

All three executors can be used with multiple nodes by calling ``add_node(..)`` for each node.

Expand All @@ -91,13 +97,13 @@ All three executors can be used with multiple nodes by calling ``add_node(..)``
rclcpp::Node::SharedPtr node2 = ...
rclcpp::Node::SharedPtr node3 = ...

rclcpp::executors::StaticSingleThreadedExecutor executor;
rclcpp::executors::SingleThreadedExecutor executor;
executor.add_node(node1);
executor.add_node(node2);
executor.add_node(node3);
executor.spin();

In the above example, the one thread of a Static Single-Threaded Executor is used to serve three nodes together.
In the above example, the one thread of a Single-Threaded Executor is used to serve three nodes together.
In case of a Multi-Threaded Executor, the actual parallelism depends on the callback groups.

Callback groups
Expand Down Expand Up @@ -178,7 +184,6 @@ Here is a summary of some of these issues:
4. No built-in control over triggering for specific topics.

Additionally, the executor overhead in terms of CPU and memory usage is considerable.
The Static Single-Threaded Executor reduces this overhead greatly but it might not be enough for some applications.

These issues have been partially addressed by the following developments:

Expand Down