ros2_tracing
system analysis example.
Demonstrates how the ROS 2 instrumentation (in rclcpp
/rcl
/rmw
) and ROS 2 tracing tools (Trace
launch action) provided by ros2_tracing
can be leveraged.
It uses:
- the reference system proposed by the ROS 2 Real-Time Working Group as an example application
tracetools_analysis
in a simple Python script to create simple plots of the execution data- Eclipse Trace Compass to correlate ROS 2 execution information with Linux kernel execution information
This is part of the ros2_tracing
paper.
If you use or refer to ros2_tracing
or this repository, please cite:
- C. Bédard, I. Lütkebohle, and M. Dagenais, "ros2_tracing: Multipurpose Low-Overhead Framework for Real-Time Tracing of ROS 2," IEEE Robotics and Automation Letters, vol. 7, no. 3, pp. 6511–6518, 2022.
BibTeX:
@article{bedard2022ros2tracing,
title={ros2\_tracing: Multipurpose Low-Overhead Framework for Real-Time Tracing of ROS 2},
author={B{\'e}dard, Christophe and L{\"u}tkebohle, Ingo and Dagenais, Michel},
journal={IEEE Robotics and Automation Letters},
year={2022},
volume={7},
number={3},
pages={6511--6518},
doi={10.1109/LRA.2022.3174346}
}
- Set up system to build ROS 2 and enable tracing
- https://docs.ros.org/en/rolling/Installation/Ubuntu-Development-Setup.html
- https://gitlab.com/ros-tracing/ros2_tracing
- Both LTTng userspace and LTTng kernel tracers are required
- Set up code workspaces and build
./setup_workspace.sh
- this creates the workspace and builds it in release mode
- Run example system using launch file
source analysis_ws/install/setup.bash ros2 launch system.launch.py
- the launch file (
system.launch.py
) sets up tracing using theTrace
launch action and executes the example application - trace data will be written to
system-YYYYMMDDTHHMMSS/
- the launch file (
- Process data and plot results using Python script
python3 analyze.py system-YYYYMMDDTHHMMSS
- plots will be created and saved under the trace directory
- these plots show various kinds of timing information for the
/BehaviorPlanner
node's input topics, output topics, and periodic callback
- these plots show various kinds of timing information for the
- the Python script will also output information to help locate the
/BehaviorPlanner
node timer callback instance with the longest interval in the trace data (see Combined analysis with Linux kernel data):- the callback ID (e.g.,
0x013579acdf
) - the callback instance index (
[0,N-1]
)
- the callback ID (e.g.,
- plots will be created and saved under the trace directory
- Download and open Trace Compass
- Import userspace and kernel traces from the
system-YYYYMMDDTHHMMSS/
directory- Under File, click on Import...
- Select the root directory of the trace (
system-YYYYMMDDTHHMMSS/
) - Then make sure the trace directory is selected in the filesystem tree view
- Click on Finish
- Create experiment (i.e., an aggregation of multiple traces)
- In the tree view on the left, under Traces, select both traces
- Then right click, and, under Open As Experiment..., select Generic Experiment
- Open Control Flow view
- This shows the state of threads over time (running, waiting, etc.) using colours and shows the scheduling switches between threads using arrows
- In the events tables, find the event corresponding to the timer callback instance of interest using the information in the output of the analysis script
- Search in the events table for Event Type equal to
ros2:callback_start
with Contents containingcallback=0x013579acdf
- Find the right callback instance using the given index by counting the events (starting from an index of 0)
- Search in the events table for Event Type equal to
- Click Show View Filters button
- Unselect all threads, select the main ROS 2 threads from the application (or at least the thread that generated the timer callback events of interest; see the TID associated with the events)