Skip to content

tfabi/events-executor

 
 

Repository files navigation

events-executor

This repository contains a C++ implementation of the EventsExecutor designed by iRobot. It is a new type of executor compatible with the ROS 2 rclcpp library.

The EventsExecutor design is based on the following principles:

  1. You don't pay for what you don't use.
  2. The abstractions between the application and the RMW should have minimal overhead.
  3. Extensibility.

Executors Comparison

The following data have been measured using the iRobot ros2-performance framework and show how, for a 10 nodes system, the EventsExecutor reduces both CPU and latency by 75% with respect to the default SingleThreadedExecutor and by 50% with respect to the StaticSingleThreadedExecutor.

These results have been obtained using the default implementation of the EventsExecutor events queue, i.e. an std::queue. The extensibility of the EventsExecutor comes from the fact that this core components can be re-implemented by the users. For example in this repository we also include an extension that uses a lock-free queue, based on this great concurrent queue implementation. Other extensions would allow to bound the queue or enforce deterministic execution constraints.

Known bugs and limitations

The iRobot team is actively working to address these items.

  • The executor is not notified when a ROS 2 timer is reset.
  • Enabling Intra-Process Optimization in rclcpp can result in a runtime exception.
  • The executor is broken with Fast-DDS in Humble. The following PR fixes the problem: ros2/rmw_fastrtps#619

Instructions

This repository provides libraries that can be built/installed alongside a standard ROS 2 installation and give access to the EventsExecutor class and its related components.

To use the EventsExecutor you just need to build the irobot_events_executor project and add it as a dependency in your application.

The irobot_lock_free_events_queue is an optional package that provides access to a more performant implementation of the EventsExecutor events queue. It also serves as an example of how the EventsExecutor can be customized and extended.

Examples

The repository contains some example applications showing how to use the EventsExecutor in your application.

To build and run the examples you can do the following:

docker run -it osrf/ros:humble-desktop bash
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install ros-humble-test-msgs ros-humble-rmw-cyclonedds-cpp
mkdir -p /root/ws/src
cd /root/ws/src
git clone https://github.com/irobot-ros/events-executor.git
cd ..
colcon build
source install/setup.sh
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
ros2 run events_executor_examples hello_events_executor

Note how we change the RMW_IMPLEMENTATION to CycloneDDS. In order to use Fast-DDS it's necessary to cherry-pick this PR and re-build the rmw_fastrtps package.

Events Executor PRs

List of Pull Requests that are introducing the EventsExecutor in the ROS 2 core repositories.

Merged PRs

Open PRs

About

ROS 2 C++ executor bringing low CPU usage, low latency and deterministic ordering

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 98.5%
  • CMake 1.5%