explaingit

adiao1973/librobotbagfix

Analysis updated 2026-06-24

31C++Audience · ops devopsComplexity · 4/5Setup · hard

TLDR

C++ library and CLI that repairs broken ROS 2 rosbag2 files (MCAP and SQLite3) so crash-time data from delivery robots, mowers, and inspection bots stays readable.

Mindmap

mindmap
  root((LibRobotBagFix))
    Inputs
      Corrupt MCAP files
      Corrupt SQLite db3 files
    Outputs
      Repaired bag copy
      Topic and message report
      JSON inspection output
    Use Cases
      Recover crash logs
      Inspect bag contents
      Embed reader in non-ROS app
    Tech Stack
      C++
      MCAP
      SQLite
      Qt
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Repair a rosbag2 file that did not close cleanly after a robot crash or power loss

USE CASE 2

Inspect topics, message counts, and time ranges of a damaged bag from the CLI

USE CASE 3

Embed the C ABI reader in a non-ROS desktop app to walk ROS 2 messages

USE CASE 4

Triage field incidents with the Qt desktop demo to preview bags on site

What is it built with?

C++MCAPSQLiteQt

How does it compare?

adiao1973/librobotbagfixnv-tlabs/wosxthe-snek-initiative/snek_equinox
Stars312827
LanguageC++C++C++
Setup difficultyhardhardhard
Complexity4/55/54/5
Audienceops devopsresearcherresearcher

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1day+

C++ build with MCAP and SQLite deps plus optional Qt for the desktop demo. Does not recover partially written large payloads like full images or point clouds.

In plain English

LibRobotBagFix is a C++ library and command-line tool for reading and repairing the black-box log files that ROS 2 robots record. The focus is commercial robots such as autonomous delivery vehicles, lawn-mowing robots, and inspection robots, which continuously record cameras, IMU readings, odometry, control commands, and diagnostics into the rosbag2 format. The problem the project targets is that when one of these robots crashes, falls, hits an emergency stop, or loses power, the underlying recording files do not get closed cleanly. ROS 2 stores its bags in either MCAP or SQLite3 .db3 files, and a half-written tail or missing index means the official rosbag2 tools refuse to open the file. The data closest to the incident, which is the part an investigation team most wants, becomes inaccessible. The project is laid out in three layers. The bottom layer is a binary repair engine that scans MCAP records, rebuilds the required summary and footer at the end of the file, and for SQLite3 first tries SQLite's own recovery and then falls back to page-level salvage. The middle layer is a lightweight C++ SDK with a stable C ABI that exposes a reader, a topic enumerator, a message iterator, and small helpers for common ROS 2 message types like Pose, Odometry, Imu, and Image. It does not depend on the ROS 2 runtime, so you can ship it inside non-ROS applications. The top layer is an optional Qt desktop demo for opening, inspecting, repairing, and previewing bags in the field. The command-line tool has two main subcommands. robotbagfix inspect reports topics, message counts, time ranges, and warnings about damaged tails or sidecar files. robotbagfix repair writes a fixed copy to a new file, never modifying the input in place. JSON output is available for both, so other tools can consume the results. The README is clear about what the project does not do. It does not provide DDS publish or subscribe, it does not implement a rosbag player, and it does not promise to recover the contents of large messages whose payloads, such as full image frames or point clouds, were only partially written before the failure.

Copy-paste prompts

Prompt 1
Build LibRobotBagFix from source and run robotbagfix inspect on a damaged MCAP file from a delivery robot.
Prompt 2
Compare the MCAP repair path with the SQLite3 page-level salvage path and explain when each one fires.
Prompt 3
Write a small C++ program that links the LibRobotBagFix SDK and iterates Odometry and Imu messages from a recovered bag.
Prompt 4
Wrap robotbagfix repair in a shell script that batch-fixes every .db3 file in a fleet upload directory and emits JSON reports.
Prompt 5
Hook the Qt desktop demo to preview a Pose topic from a freshly repaired bag.

Frequently asked questions

What is librobotbagfix?

C++ library and CLI that repairs broken ROS 2 rosbag2 files (MCAP and SQLite3) so crash-time data from delivery robots, mowers, and inspection bots stays readable.

What language is librobotbagfix written in?

Mainly C++. The stack also includes C++, MCAP, SQLite.

How hard is librobotbagfix to set up?

Setup difficulty is rated hard, with roughly 1day+ to a first successful run.

Who is librobotbagfix for?

Mainly ops devops.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.