让ROS 2程序运行确定,避免并发问题,提升系统可靠性。
Deterministic Execution of ROS 2 Applications via Lingua Franca
- 用逻辑时间框架转换ROS 2应用,实现执行顺序确定化。
- 在仿真与Autoware系统中验证,执行顺序与端到端延迟完全一致。
- 无需修改原有代码,支持定时可预测、容错和跨进程协同。
机器人操作系统2(ROS 2)是机器人系统广泛使用的中间件,采用发布-订阅通信机制,计算以回调形式由执行器调度。尽管流行,其发布-订阅模式本质上是非确定性的:单个执行器内回调的执行顺序不确定,分布式部署还会因节点间消息交错和网络延迟引入更多不确定性。这种非确定性常引发并发问题,难以分析安全性并提供保证。本文提出一个框架,可将未经修改的ROS 2应用通过Lingua Franca(LF)运行,实现基于逻辑时间的确定性执行,相同输入始终产生一致执行顺序。我们首先界定哪些ROS 2特性可在逻辑时间下确定性执行,进而建立自动转换框架,从ROS 2应用提取信息并直接转为LF程序。利用LF丰富的特性,如逻辑时间延迟、跨进程联邦执行和故障处理,可在不修改原代码的前提下,使ROS 2应用实现确定性与时间可预测执行。我们在合成示例和Autoware参考系统上评估该框架:默认ROS 2中回调顺序不固定,端到端延迟随执行波动;而我们的LF控制系统则保持固定执行顺序与一致延迟。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。