Quick commands to record and play back ROS2 bags for testing the simulation GUI.
# In PowerShell (Windows) - default 15 seconds, saves to bags/pool_test_01
npm run bag:recordThis will:
- Prompt you to start the GUI simulation first
- Record
/imu/data,/dvl/odom, and/depth/posefor 15 seconds - Save to
bags/pool_test_01/
Custom bag name and duration:
# Record to a custom bag name for 30 seconds
wsl bash ./scripts/record-bag.sh my_test_bag 30# In PowerShell (Windows) - plays bags/pool_test_01 in loop
npm run bag:playThis will:
- Play
bags/pool_test_01/in loop mode at normal speed - Press Ctrl+C to stop
Custom bag name and playback rate:
# Play custom bag at 2x speed
wsl bash ./scripts/play-bag.sh my_test_bag 2.0npm run bag:listIf you prefer to run the scripts directly in WSL:
# Record
./scripts/record-bag.sh [bag_name] [duration_seconds]
# Play
./scripts/play-bag.sh [bag_name] [rate]
# Examples
./scripts/record-bag.sh pool_test_02 20
./scripts/play-bag.sh pool_test_02 1.5-
Record a bag:
npm start # Start GUI # Set Data Source: Synthetic Simulation, click Start npm run bag:record # In another terminal
-
Play it back:
npm run bag:play # Plays in loop # In GUI: switch to "Bag Playback (listen only)" # Click "Seed from ROS topics"
-
Verify seeding works:
- Topics should show Hz values (not "lost!")
- Seed button should be enabled
- After clicking "Seed from ROS topics", you should see:
- Green status line: "Seeded orientation from /imu/data, depth from /depth/pose, velocity from /dvl/odom — HH:MM:SS"
"Bag not found" error:
- Check
npm run bag:listto see available bags - Make sure you recorded a bag first with
npm run bag:record
"No topics" when recording:
- Ensure rosbridge is running in WSL:
ros2 launch rosbridge_server rosbridge_websocket_launch.xml - Start the GUI and begin synthetic simulation
- Verify topics with:
wsl ros2 topic list
Bag playback but GUI shows "lost!" banners:
- Verify topics are publishing:
wsl ros2 topic hz /imu/data - Check rosbridge is connected (green banner in GUI)
- Ensure bag contains the right topics:
wsl ros2 bag info bags/pool_test_01
- All scripts run inside WSL2 (where ROS2 is installed)
- The npm commands are wrappers that invoke WSL automatically
- Bags are stored in the
bags/directory at the repo root - Recording uses a 15-second default duration (configurable)
- Playback runs in loop mode by default