AsyncNode in rclpy: Native asyncio for ROS 2 Python

A concept guide to AsyncNode in ROS 2 Lyrical: how asyncio replaces the executor in rclpy, structured concurrency, backpressure, what the API looks like and what is still missing.

In this article

  • Key idea and when to use it
  • Why async in rclpy is not asyncio
  • Two event loops, one blocking thread
  • Two designs: an asyncio executor, then AsyncNode
  • Structured concurrency and reader tasks
  • What node code looks like
  • Status, numbers and caveats
  • The same idea in C++
  • Our take: where this fits
  • Further reading
  • Takeaways