Introduction
Modern robotic perception and Simultaneous Localization and Mapping (SLAM) systems are computationally intensive, often pushing the limits of CPU, memory, and network resources. In complex, distributed ROS 2 environments—where tasks like odometry might run on a robot while heavy map optimization occurs on a base station—identifying the source of performance bottlenecks is notoriously difficult. Traditional debugging methods like breakpoints are unsuitable for real-time systems as they disrupt the temporal flow of data. This paper presents an open-source tracing and analysis framework designed to deconstruct these "black box" systems by measuring end-to-end latencies and visualizing message flows across distributed hardware.
Methodology
The proposed solution utilizes software tracing via the Linux Trace Toolkit: next generation (LTTng). Unlike standard logging, LTTng offers high-performance, low-overhead instrumentation, making it ideal for real-time applications. The framework integrates several key components:
ros2_tracing: An instrumentation layer that hooks into ROS 2 internals (rcl, rclcpp) to record publication events and callback executions.- Causal Link Analysis: A method to associate incoming input messages with their corresponding outputs, allowing the reconstruction of a complete "message flow."
- Critical Path Analysis: By linking events across nodes, the tool identifies the longest execution sequence, pinpointing the primary system bottleneck.
- Executor Visibility: Developers can monitor the status of ROS 2 executor threads in real-time. This visibility allows for the identification of under-utilized CPUs or overloaded threads.
Experimental Setup
The framework was evaluated using a live setup featuring an Intel Realsense D455 camera and the RTAB-Map SLAM system. Two primary scenarios were tested:
- Centralized: All processing (odometry and SLAM) performed on a single robot.
- Distributed: Odometry performed on the robot, with SLAM optimization offloaded to a base station.
To ensure accuracy in the distributed setup, clocks were synchronized across machines using the Network Time Protocol (NTP), allowing traces from multiple sources to be merged into a single, unified timeline.
Results and Discussion
The analysis provided a granular breakdown of system performance. In the centralized configuration, the total pipeline latency was measured at 297.4 ms. As shown in the table below, the SLAM node (RTAB-Map) was the most significant contributor, accounting for over 64% of the total processing time.
In the distributed setup, the tools highlighted the impact of network conditions. While network latency and message handling added approximately 24.7 ms of overhead, the visualization revealed that network congestion led to significant "jitter" (delays up to 500ms) and caused the SLAM node to drop frames entirely. By observing "idle" time in executor threads, researchers identified opportunities to improve parallelization and adjust Quality of Service (QoS) settings to enhance system reliability.
Conclusion and Future Work
This tracing framework provides a powerful lens for debugging and optimizing ROS 2 perception pipelines. While it successfully automates many aspects of causal link detection, complex many-to-one message relationships currently require minimal manual annotation. Future work will focus on automating the detection of unused sensor data, implementing proactive communication bandwidth monitoring, and extending these analyses to decentralized multi-robot SLAM systems.
Summary updated