Simulation is crucial in real-world robotics, offering safe, scalable, and efficient environments for developing applications, ranging from humanoid robots to autonomous vehicles and drones. While the Robot Operating System (ROS) has been widely adopted as the backbone of these robotic applications in both academia and industry, its asynchronous, multiprocess design complicates reproducibility, especially across varying hardware platforms. Deterministic callback execution cannot be guaranteed when computation times and communication delays vary. This lack of reproducibility complicates scientific benchmarking and continuous integration, where consistent results are essential. To address this, we present a methodology to create deterministic simulations using ROS 2 nodes. Our ROS Simulation Library for C++ (RSLCPP) implements this approach, enabling existing nodes to be combined into a simulation routine that yields reproducible results without requiring any code changes. We demonstrate that our approach yields identical results across various CPUs and architectures when testing both a synthetic benchmark and a real-world robotics system. RSLCPP is open-sourced at https://github.com/TUMFTM/rslcpp.
翻译:仿真在现实世界机器人技术中至关重要,它为人形机器人、自动驾驶车辆和无人机等应用的开发提供了安全、可扩展且高效的环境。尽管机器人操作系统(ROS)已在学术界和工业界被广泛采纳为这些机器人应用的底层框架,但其异步、多进程的设计使得结果复现变得复杂,尤其是在不同的硬件平台上。当计算时间和通信延迟发生变化时,无法保证回调执行的确定性。这种复现性的缺失给科学基准测试和持续集成带来了困难,而在这些场景中,结果的一致性至关重要。为解决这一问题,我们提出了一种使用ROS 2节点创建确定性仿真的方法。我们开发的C++版ROS仿真库(RSLCPP)实现了这一方法,使得现有节点能够组合成仿真例程,在不修改任何代码的情况下获得可复现的结果。我们通过合成基准测试和真实机器人系统测试证明,该方法在不同CPU和架构上能够产生完全一致的结果。RSLCPP已在https://github.com/TUMFTM/rslcpp开源。