ICEY: A new ROS 2 client API for modern asynchronous programming using async/await in C++ 20

Hello everyone!

Today I want to present a new client API build on top of rclcpp that allows to use modern asynchronous programming with async/await syntax in C++:

Github

It is licensed under Apache-2.

Problems ICEY solves:

  • Deadlocks are impossible since there is no need to manually spin the ROS executor (event loop) inside callbacks.
  • No memory leaks possible during service calls — every request has a timeout after which it is cleaned up automatically
  • All callbacks can be asynchronous functions (i.e., coroutines), which makes it possible to call and co_await other asynchronous operations inside callbacks
  • A consistent async/await-based API for all asynchronous operations, including service calls and TF lookup (avoiding extra executors or even nodes).
  • Topic synchronization without much boilerplate code, general compatibility with the message_filters package

As an additional feature, ICEY allows for expressing asynchronous data flow declaratively (similar to reactive programming): Filtering messages, detecting timeouts and synchronization with transforms are common operations that can be done in a single line using ICEY.

This library comes with many examples and allows for gradual adoption: No need to rewrite all your nodes, the only thing you need to add to your node is the icey::Context.

ICEY is currently for C++ only, but support for Python is planned for the future.

Best regards,
Ivo

5 Likes