Deterministic Execution of ROS~2 Applications via Lingua Franca
2026-06-08 • Robotics
Robotics
AI summaryⓘ
The authors discuss a common problem in ROS 2, a system used to run robots, where the order of actions (callbacks) can change unpredictably, causing issues in understanding and ensuring safe behavior. They created a way to run ROS 2 programs using Lingua Franca (LF), a system that makes these actions happen in a fixed, predictable order using logical time. Their method works without changing the original ROS 2 code and handles timing and faults better. Tests show that, compared to standard ROS 2, their approach produces consistent action order and timing every time the program runs.
ROS 2publish-subscribecallbacksdeterministic executionlogical timeLingua Francamiddlewareconcurrencytiming predictability
Authors
Harun Teper, Shaokai Lin, Shulu Li, Edward A. Lee, Jian-Jia Chen
Abstract
The Robot Operating System~2 (ROS 2) is a widely used middleware for robotic systems, characterized by a publish-subscribe (pub-sub) communication mechanism in which computation is structured as callbacks dispatched by ROS 2 executors. Despite its popularity, the pub-sub pattern in ROS 2 is inherently nondeterministic: the order in which these callbacks run is nondeterministic even within a single executor, and distributed deployments add further nondeterminism from the interleaving of messages across nodes and from network latency. Such nondeterminism often leads to concurrency issues and makes it virtually impossible to analyze for safeness and provide guarantees. We present a framework that is able to convert an unmodified ROS 2 application and run it under Lingua Franca (LF), a coordination language for deterministic execution using logical time, so that the same input always produces the same deterministic execution order. We first describe which ROS 2 features can be executed deterministically under logical time. Such features enable the possibility to establish an automatic conversion framework to extract information from a ROS 2 application and directly convert it into an LF program. The rich features of LF, such as logical-time delays, federated execution across processes, and fault handling, can then be applied to make the ROS 2 application be executed in a deterministic and timing-predictable manner without changing the ROS 2 code. We evaluate the framework on a synthetic example and on the Autoware reference system. We show that the order in which callbacks are executed differs in default ROS 2, while also having end-to-end latencies that vary across executions. In contrast, our LF-controlled ROS 2 system produces a deterministic execution order and consistent end-to-end latencies.