Table of Contents
Fetching ...

RSLCPP - Deterministic Simulations Using ROS 2

Simon Sagmeister, Marcel Weinmann, Phillip Pitschi, Markus Lienkamp

TL;DR

The paper addresses the reproducibility crisis in ROS 2 simulations caused by asynchronous multi-process execution. It proposes a deterministic simulation framework by aggregating ROS 2 nodes into a single process and enforcing a fixed callback order via a custom event loop, with simulation time decoupled from computation time and configurable delay modeling. The authors introduce RSLCPP, a set of methods and a dynamic job interface that can load existing ROS 2 components without code changes, and validate the approach with both a synthetic benchmark and a LiDAR odometry case study, demonstrating bit-identical results across heterogeneous hardware. The work provides a practical, open-source solution for hardware-agnostic benchmarking and CI in robotics, enabling reproducible science and robust system debugging.

Abstract

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.

RSLCPP - Deterministic Simulations Using ROS 2

TL;DR

The paper addresses the reproducibility crisis in ROS 2 simulations caused by asynchronous multi-process execution. It proposes a deterministic simulation framework by aggregating ROS 2 nodes into a single process and enforcing a fixed callback order via a custom event loop, with simulation time decoupled from computation time and configurable delay modeling. The authors introduce RSLCPP, a set of methods and a dynamic job interface that can load existing ROS 2 components without code changes, and validate the approach with both a synthetic benchmark and a LiDAR odometry case study, demonstrating bit-identical results across heterogeneous hardware. The work provides a practical, open-source solution for hardware-agnostic benchmarking and CI in robotics, enabling reproducible science and robust system debugging.

Abstract

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.
Paper Structure (13 sections, 4 figures, 1 table)

This paper contains 13 sections, 4 figures, 1 table.

Figures (4)

  • Figure 1: Illustrative comparison of asynchronous and synchronous execution. The example consists of timer ($\mathcal{T}_1$, $\mathcal{T}_2$) and subscription ($\mathcal{S}_1$) callbacks. $\mathcal{S}_1$ is triggered by a publisher at the end of $\mathcal{T}_2$. In the asynchronous case, the callback runtimes influence the order in which the callbacks are processed. With our approach, they remain in a fixed order. $t$ indicates wall time progression, which is decoupled from the simulation time for the synchronous example.
  • Figure 2: rslcpp event loop. The actions depicted in blue are specific to the rslcpp event loop, while white coloring indicates processes implemented within the rclcpp events executor. The loop terminates before advancing time as soon as the job object indicates that the simulation is complete.
  • Figure 3: Synthetic benchmark system for testing deterministic callback execution. Timer callbacks with their respective frequencies are shown in blue, while subscription callbacks are depicted in dark gray. Service callbacks are colored green while a client's response callback is depicted in white. Individual nodes are represented as light gray boxes.
  • Figure 4: Root-mean-squared-error (RMSE) of the average positional error (APE) over 100 simulations of the KISS-ICPvizzo2023KISSICPDefensePointtoPoint on Sequence 00 of the KITTI OdometryKITTI dataset within ROS 2 and rslcpp. The number of parallel threads is reported in parentheses. CPU models are abbreviated and correspond to Table \ref{['tab:determinism_validation']}.