ROS2 Launch Inspection Tool - Record and replay launch executions for performance analysis
Project description
ROS2 Launch Inspection Tool
A comprehensive toolkit for recording, replaying, and analyzing ROS 2 launch executions. Record any launch file once, then replay it multiple times for testing, performance analysis, and debugging.
Features
- Record & Replay: Capture launch file execution and replay it deterministically
- Single Command Usage: Launch and replay in one step with
play_launch launchorplay_launch run - Resource Monitoring: Track CPU, memory, I/O, GPU usage per node
- Visualization: Generate comprehensive resource usage plots and statistics
- Process Control: Set CPU affinity and priorities for fine-grained control
- Container Support: Full support for ROS 2 composable nodes and containers
Installation
Install from Debian Package (Recommended)
The easiest way to install play_launch is using the pre-built Debian package.
Prerequisites:
- Ubuntu 22.04 (Jammy) with ROS 2 Humble
Installation Steps:
- Download the latest
.debpackage from the Releases page:
wget https://github.com/NEWSLabNTU/play_launch/releases/download/v0.2.0/play-launch_0.2.0_amd64.deb
- Install the package:
sudo apt install ./play-launch_0.2.0_amd64.deb
- Verify the installation:
# Source ROS 2 environment
source /opt/ros/humble/setup.bash
# Check if play_launch is available
play_launch --help
Note: For other architectures or ROS distributions, please build from source.
Install from Source
Prerequisites:
- ROS 2 (Humble or later)
- Rust toolchain: Install from rustup.rs, or running
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
- Python 3 with pip
- Plot, Pandas running
pip3 install pandas plotly
Installation Steps:
- Clone the repository:
git clone https://github.com/NEWSLabNTU/play_launch.git
cd play_launch
- Install all dependencies:
just install-deps
This will:
- Download git submodules
- Install colcon-cargo and colcon-ros-cargo extensions
- Install cargo-ament-build for Rust ROS packages
- Install ROS dependencies via rosdep
- Build the project:
just build
- Source the workspace:
source install/setup.bash
- Verify installation:
play_launch --help
Getting Started
Quick Start: Launch and Replay in One Command
The easiest way to use the tool is with the play_launch launch or play_launch run commands. These automatically record and replay in a single step:
# Launch a launch file
play_launch launch <package_name> <launch_file> [arguments...]
# Example: Launch a demo
play_launch launch demo_nodes_cpp talker_listener.launch.py
# Example: Run a single node
play_launch run demo_nodes_cpp talker
This is functionally equivalent to ros2 launch or ros2 run, but records the execution and replays it immediately.
Advanced: Two-Step Workflow (Dump + Replay)
For more control, you can separate the recording and replay steps:
Step 1: Record (Dump) a Launch Execution
Record any ROS 2 launch file by replacing ros2 launch with play_launch dump launch:
# Original command:
# ros2 launch autoware_launch planning_simulator.launch.xml \
# map_path:=$HOME/autoware_map/sample-map-planning \
# vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kit
# Recording command:
play_launch dump launch \
autoware_launch planning_simulator.launch.xml \
map_path:=$HOME/autoware_map/sample-map-planning \
vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kit
This creates a record.json file capturing the entire launch execution plan.
Step 2: Replay the Launch
Replay the recorded launch multiple times:
play_launch replay
The replay reads record.json and executes the launch plan, spawning all nodes and containers exactly as recorded.
Resource Monitoring
Enable comprehensive per-node resource monitoring to track CPU, memory, I/O, and GPU usage.
Enable Monitoring
Monitor all nodes with default settings (1 second interval):
play_launch launch demo_nodes_cpp talker_listener.launch.py --enable-monitoring
Or when replaying:
play_launch replay --enable-monitoring
Configure Monitoring
For fine-grained control, use a YAML configuration file:
# config.yaml
monitoring:
enabled: true
sample_interval_ms: 1000 # Sample every 1 second
processes:
# Monitor all containers with CPU affinity
- node_pattern: "NODE 'rclcpp_components/component_container*"
monitor: true
cpu_affinity: [0, 1]
nice: 5
# Specific node with higher priority
- node_pattern: "NODE 'rviz2/rviz2*"
monitor: true
nice: -5 # Requires CAP_SYS_NICE capability
Apply the configuration:
play_launch replay --config config.yaml
Monitoring Output
Metrics are saved to play_log/<timestamp>/node/<node_name>/metrics.csv and play_log/<timestamp>/load_node/<node_name>/metrics.csv with the following data:
- CPU: Usage percentage, user/system time
- Memory: RSS, VMS
- I/O: Read/write bytes, rates
- Network: TCP/UDP connection counts
- GPU (if available): Memory, utilization, temperature, power
- Process: State, thread count, file descriptor count
Note on GPU Monitoring: Per-process GPU metrics are NOT available on Jetson/Tegra platforms (AGX Orin, Xavier, Nano) due to hardware architecture limitations. GPU columns will be empty on these systems. CPU, memory, and I/O metrics continue to work normally. See CLAUDE.md for details and Jetson-specific GPU monitoring alternatives.
Visualization and Analysis
Generate comprehensive interactive plots and statistics from monitoring data:
# Plot latest execution
play_launch plot
# Plot specific log directory
play_launch plot --log-dir play_log/2025-10-28_16-17-56
# Plot only CPU and memory
play_launch plot --metrics cpu memory
# List available metrics
play_launch plot --list-metrics
Generated Output
Interactive charts are saved to play_log/<timestamp>/plot/ as separate HTML files (~4-5 MB each):
Timeline Charts (show metrics over time):
cpu_timeline.html- CPU usage over timememory_timeline.html- Memory usage over timeio_timeline.html- I/O read/write rates (when available)network_timeline.html- TCP/UDP connections (when available)gpu_timeline.html- GPU memory usage (when available)gpu_temp_power.html- GPU temperature and power (when available)gpu_clocks.html- GPU clock frequencies (when available)
Distribution Charts (statistical distributions):
cpu_distribution.html- CPU distribution box plot sorted by averagememory_distribution.html- Memory distribution box plot sorted by average
Statistics Report:
statistics.txt- Top 10 rankings for all metrics (max/avg)
Interactive Features
- Full-screen viewing: Each chart in its own file for maximum size
- Container awareness:
- Timeline charts: Hover over a container curve to see list of contained nodes in a floating panel
- Distribution charts: Hover over a container to see statistics + contained nodes in floating panel
- Abbreviated labels: Distribution plots use short labels to save space, full names shown on hover
- No legend clutter: Process names appear in hover tooltips instead of a legend
- Zoom and pan: Drag to zoom into specific time ranges, double-click to reset
- Hover tooltips: Detailed values with full process names at each data point
- Download: Use toolbar to export charts as PNG images
Statistics Report
Example statistics in statistics.txt:
- Top 10 nodes by CPU/memory usage (max and average)
- Top 10 nodes by I/O rates
- Top 10 nodes by GPU utilization (when available)
- Top 10 nodes by network connections
Command Reference
# All-in-one launch and replay
play_launch launch <package> <launch_file> [args...]
play_launch run <package> <executable> [args...]
# Separate dump and replay
play_launch dump launch <package> <launch_file> [args...]
play_launch replay [--input-file record.json]
# With monitoring
play_launch launch <package> <launch_file> --enable-monitoring
play_launch replay --enable-monitoring --monitor-interval-ms 500
# With configuration
play_launch replay --config config.yaml
# Verbose output
play_launch replay --verbose
# Plot results
play_launch plot [--log-dir <dir>] [--metrics cpu memory io gpu]
Development
Linting
Lint both Python and Rust code:
just lint
Formatting
Format both Python and Rust code:
just format
Testing
Run the full test suite (both Python and Rust):
just test
License
This software is distributed under MIT license. You can read the license file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file play_launch-0.3.2-py3-none-manylinux_2_35_x86_64.whl.
File metadata
- Download URL: play_launch-0.3.2-py3-none-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 3.4 MB
- Tags: Python 3, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d6461600f6cb9131a4971cd44e3f6611fe4d2d8cd8450b4caf7c008b92dec51
|
|
| MD5 |
d9312651adfbc4be3dc7448871690711
|
|
| BLAKE2b-256 |
e367631d1e4e62cb1a2ae574b8823c6906f1351d3f4409a69c148226b0ba0805
|
Provenance
The following attestation bundles were made for play_launch-0.3.2-py3-none-manylinux_2_35_x86_64.whl:
Publisher:
release-wheel.yml on NEWSLabNTU/play_launch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
play_launch-0.3.2-py3-none-manylinux_2_35_x86_64.whl -
Subject digest:
8d6461600f6cb9131a4971cd44e3f6611fe4d2d8cd8450b4caf7c008b92dec51 - Sigstore transparency entry: 731930590
- Sigstore integration time:
-
Permalink:
NEWSLabNTU/play_launch@811d189405abda1328822603a4d3918a15fc2067 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/NEWSLabNTU
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-wheel.yml@811d189405abda1328822603a4d3918a15fc2067 -
Trigger Event:
push
-
Statement type:
File details
Details for the file play_launch-0.3.2-py3-none-manylinux_2_35_aarch64.whl.
File metadata
- Download URL: play_launch-0.3.2-py3-none-manylinux_2_35_aarch64.whl
- Upload date:
- Size: 3.3 MB
- Tags: Python 3, manylinux: glibc 2.35+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb33d8f75acc99f5df20670d653a6155f0f668ed1f0f33ecb604254148b20cae
|
|
| MD5 |
f323807f994fad1675e208a28c8a3931
|
|
| BLAKE2b-256 |
0e9cd9d4a918fb9c288e4b0f7b06a576871924d976bc5947ddfdd631cb50c0ee
|
Provenance
The following attestation bundles were made for play_launch-0.3.2-py3-none-manylinux_2_35_aarch64.whl:
Publisher:
release-wheel.yml on NEWSLabNTU/play_launch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
play_launch-0.3.2-py3-none-manylinux_2_35_aarch64.whl -
Subject digest:
bb33d8f75acc99f5df20670d653a6155f0f668ed1f0f33ecb604254148b20cae - Sigstore transparency entry: 731930589
- Sigstore integration time:
-
Permalink:
NEWSLabNTU/play_launch@811d189405abda1328822603a4d3918a15fc2067 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/NEWSLabNTU
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-wheel.yml@811d189405abda1328822603a4d3918a15fc2067 -
Trigger Event:
push
-
Statement type: