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 1 commit
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
15 changes: 9 additions & 6 deletions source/Concepts/Intermediate/About-Executors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,13 @@ 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 the only *Executor* optimized the runtime costs for rebuilding the entities of a node in terms of subscriptions, timers, service servers, action servers, etc.
But this runtime improvements are now available in all the other *Executor*, so that all *Executor* can now take advantage of this improvement.
Copy link
Contributor

@alsora alsora Oct 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the two sentences here can be written in a more clear way.

The Static Single-Threaded Executor was the only Executor optimized the runtime costs for rebuilding the entities of a node in terms of subscriptions, timers, service servers, action servers, etc.
But this runtime improvements are now available in all the other Executor, so that all Executor can now take advantage of this improvement.

could become

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also mention that there are known bugs affecting only the static executor

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alsora do you mean ros2/rclcpp#2589, right? i am not sure about that, because that looks like regression and we are going to fix that? if it seems to take much longer time to address it, probably we can consider that with another PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alsora friendly ping.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that ticket refers to a bug affecting all waitset-executors, but there are also some bugs that are specific to the static executor.

You can see them looking at the unit-tests that are run on StandardExecutors (i.e. they are not run on the static executor)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alsora i added b2adf9d, can you check and approve?

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 +95,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 +182,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