rosbagkit is a lightweight toolkit for reading ROS bagfiles and extracting
common sensor streams such as RGB images, depth images, odometry, IMU data,
GPS data, and TF transforms.
The repository is organized around:
- a Python package in
src/rosbagkit - extraction scripts in
scripts/ - YAML-driven extraction examples in
config/extract/
- Python 3.12+
- ROS bagfiles supported by
rosbags
uv sync
source .venv/bin/activateuv must be installed separately before running these commands.
Use one of the template configs in config/extract/ as a starting point and
replace the placeholder paths, topics, and scene entries with your own data.
python scripts/extract_bagfile.py config/extract/UT-SARA-GQ.yamlEach config follows this shape:
bagfile_root: /path/to/bagfiles
output_root: /path/to/output
topics:
/camera/color/image_raw:
format: image
outdir: image_raw
/gps/fix:
format: csv
outpath: gps.csv
scenes:
example_scene:
bagfiles:
- example_run/example_0.bag
start: 0
end: -1Supported topic output formats currently include:
imagedepthpointcloud_depthcsv
Optional stereo rectification can be configured directly in the YAML file:
rectification:
enabled: true
left_topic: /stereo/left/image_raw
right_topic: /stereo/right/image_raw
left_calib: /path/to/left_intrinsics.yaml
right_calib: /path/to/right_intrinsics.yaml
extrinsics: /path/to/left_to_right.yaml
threshold: 0.005
output_dir: 2d_rect
left_subdir: cam_left
right_subdir: cam_right
timestamp_file: timestamps.txtWhen enabled, the configured stereo topics are rectified in memory and only the final rectified images are written to disk. See config/extract/UT-SARA-GQ.yaml for a public GQ example.
python scripts/extract_tf.py /path/to/example.bag --src base_link --tgt camera_linkThis writes a YAML file next to the bagfile containing the resolved transform chain.