# ROS 2 Trace Analysis for Semantic Scheduling (Thesis) This repo provides the data analysis framework used for my thesis **"Semantic Scheduling for Multi-Modal Sensor Data on the Example of ROS 2"** (TU Berlin & DLR, 2025). It is based on [TUM-AVS/ros2_latency_analysis](https://github.com/TUM-AVS/ros2_latency_analysis) (`dataflow-analysis` branch) by Betz et al. **Please cite their original work when using this code (see below).** ## Key Features - Automated extraction of end-to-end and component latencies from ROS 2 traces - Extended batch processing, including meta-anaylsis - Scripts and fixes tailored for semantic scheduling experiments ## Main Additions & Changes - **New scripts:** `add_csv_header.sh`, `batch_analysis_analysis.py`, `csv2table.py`, `csvfix.sh`, `run_batch_analysis_analysis.sh`, `run_batch_analyze.sh` - **Main modifications:** `batch_analyze.py`, `trace-analysis.ipynb` - **Submodules:** Includes `ros2_tracing` and `tracetools_analysis` All changes are documented in the git history. ## Setup - Requires **Python 3.10+**, ROS 2, JupyterLab, and [ros2_tracing](https://github.com/ros2/ros2_tracing) - Install dependencies: `pip3.10 install -r requirements.txt` - Run interactive analysis in Jupyter (`trace-analysis.ipynb`) or batch via provided scripts. See the [upstream README](https://github.com/TUM-AVS/ros2_latency_analysis/tree/dataflow-analysis) for more details on prerequisites and methodology. ## Usage First, make sure all your traces are in sub-directories conforming to the common experiment type, e.g.: ``` traces/ ros_multi/ ros_multi_1 ros_multi_2 ... ros_multi_n ros_single/ ros_single_1 ros_single_2 ... ros_single_m ``` Then use `run_batch_analyze.sh` to run the analysis (trace-analysis.ipynb) for the traces you gathered. This will create a summarizing `results.csv` in the respecitve directory (here thus `traces/ros_multi/` and 'traces/ros_multi/'). The csv will not have headers, to add them, use `add_csv_header.sh`. Now you can run `run_batch_analysis_analysis.sh` to generate the end-to-end analysis box-plots from that results.csv (will also generate a `results_summary.csv`). The latter is ideal to be turned into LaTeX tables, using `csv2table.py`. ## Output - Latency CSVs (E2E and per-chain), plots (PDF/PNG), and LaTeX-ready tables ## Citation If you use this code, **please cite**: Betz, T. et al., “Latency Measurement for Autonomous Driving Software Using Data Flow Extraction,” *IEEE Intelligent Vehicles Symposium (IV), 2023.* [DOI: 10.1109/iv55152.2023.10186686](https://doi.org/10.1109/iv55152.2023.10186686) ```bibtex @inproceedings{Betz2023, doi = {10.1109/iv55152.2023.10186686}, url = {https://doi.org/10.1109/iv55152.2023.10186686}, year = {2023}, author = {Tobias Betz and Maximilian Schmeller and Andreas Korb and Johannes Betz}, title = {Latency Measurement for Autonomous Driving Software Using Data Flow Extraction}, booktitle = {2023 {IEEE} Intelligent Vehicles Symposium ({IV})} } ``` ## License See upstream for original license; thesis-specific additions are for academic/non-commercial use.