A ROS 2 package that records synchronized robot and camera data.
The data_collector node buffers synced RGB(-D) frames from a RigSnapshot topic in memory and, on trigger, simultaneously:
- records the configured ROS topics (joint states, poses, etc.) to an
mcaprosbag viaros2 bag record, and - encodes the buffered camera frames to per-camera video files via
ffmpegin a background thread, so the next episode can start immediately without waiting for encoding to finish.
All settings live in config/data_collector.yaml:
storage_path: "/path/to/dataset"
topics:
- "/franka_right/franka/joint_states"
- "/franka_right/target_pose"
# ...
videos:
topic: "/zed_rig/synced_raw_snapshot"
camera_fps: 30.0
cameras:
- name: zed_middle
type: rgb
codec:
rgb: h264
depth: ffv1
crf: 23topics: plain ROS topics recorded straight into the rosbag.videos.topic: thefranka_custom_msgs/RigSnapshottopic providing the synced camera frames to buffer and encode.
ros2 launch franka_data_collection start.launch.pyNote
Pass config_path:=/path/to/your.yaml to override the default config.
Recording is toggled by calling the trigger service — the first call starts it, the second stops it:
ros2 service call /data_collector/record_data_trigger std_srvs/srv/TriggerEach triggered episode is written under storage_path as:
episode_<timestamp>/
├── mcap/ # rosbag with the configured topics
└── videos/
├── timestamps.npy # int64 ns, one per synced frame
├── rgb_<camera_name>.mp4
└── depth_<camera_name>.mkv # only when depth cameras are configured