Skip to content

About

Flight recorder for ROS 2 robots — observability and failure-forensics platform

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

BlackBoxRS

Python 3.10+ ROS 2 Humble (verified) License MIT

A lightweight daemon watches a ROS 2 robot's graph and host; when a failure fires, it builds a bundle you can read: timeline, raw evidence, a likely-cause narrative and, when one can be derived, a preflight rule you can adopt so the same failure blocks the next launch.

Turns a robot failure into a full incident report with one command: an incident recorder for ROS 2 that packages a reproducible evidence bundle.

Validated on a real GO2 recording, about 94k messages over 330 s, replayed offline: zero anomalies raised on the clean recording, and an injected /utlidar/robot_pose dropout reported at the configured 3.0 s dead-topic timeout.

What it does

  • Captures ROS 2 topic and host telemetry and runs seven anomaly detectors, with hysteresis against single noisy samples.
  • Builds an incident bundle in which every claim in report.md links to the evidence file behind it.
  • Fingerprints failures, ranks likely causes and attaches a confidence score.
  • Derives a preflight rule from an incident when one can be derived; once adopted, it blocks the next launch if the precursor reappears.
  • Runs onboard or as an observer from a laptop over DDS, and replays recorded bags offline.

Results

Measure Value
Recorded GO2 messages replayed about 94k
Recording length (s) 330
Anomalies on the clean recording 0
Injected /utlidar/robot_pose dropout, configured dead-topic timeout (s) 3.0
Tests passing, local run 530 (3 skipped)

Quick start

git clone https://github.com/yusufdxb/BlackBoxRS.git
cd BlackBoxRS
./setup.sh
source .venv/bin/activate

robot-blackbox init                    # 1. initialise
robot-blackbox start --foreground &    # 2. run the daemon (-f shows live output)
                                       # 3. ... your robot runs, anomalies fire and get logged ...
robot-blackbox incident build --since 5m                    # 4. build a bundle
BUNDLE=$(ls -d ~/.blackboxrs/incidents/inc_* | tail -1)    # newest bundle
robot-blackbox incident show "$BUNDLE"                      # 5. read the report
robot-blackbox prevention adopt --from-incident "$BUNDLE"   # 6. adopt a rule
robot-blackbox preflight               # 7. next launch: the rule fires first

Observer mode (capture from a laptop) and the offline replay command are in docs/DEVELOPMENT.md and docs/RESULTS.md.

Architecture

graph TD
    subgraph Daemon["BlackBoxRS daemon"]
        Monitors["ros_monitor + system_monitor + recording"]
        EventBus["core.event_bus"]
        Anomaly["anomaly_engine"]
        Writer["logging.RotatingJsonlWriter"]
        Monitors --> EventBus
        EventBus --> Anomaly
        EventBus --> Writer
    end

    Logs["~/.blackboxrs/logs/*.jsonl"]
    Writer --> Logs

    subgraph Build["blackboxrs incident build"]
        Builder["IncidentBuilder over the log slice"]
        Events["events.jsonl"]
        Triggers["triggers"]
        Signatures["signatures"]
        Snapshots["snapshots"]
        Timeline["timeline"]
        Fingerprint["fingerprint"]
        Cause["likely-cause"]
        Report["report.md"]
        Builder --> Events
        Events --> Triggers
        Events --> Signatures
        Events --> Snapshots
        Events --> Timeline
        Events --> Fingerprint
        Events --> Cause
        Events --> Report
    end

    Logs --> Builder

    IncidentDir["~/.blackboxrs/incidents/inc_(id)/"]
    Report --> IncidentDir

    subgraph Preflight["blackboxrs preflight"]
        Rules["Loaded PreventionRules (YAML)"]
        Checks["topic_present / qos_match / node_*"]
        PReport["PreflightReport: pass / warn / block"]
        Rules --> Checks
        Checks --> PReport
    end

    IncidentDir --> Rules
Loading

The full system design is in docs/ARCHITECTURE.md.

Validation

Component Evidence Environment
Offline bag replay, dead-topic detector Clean replay; injected dropout found at 3.0 s Recorded GO2 bag, replayed offline
Observer mode Dead topic fires over DDS within 8 s deadline Docker ROS 2 Humble CI
Seven detectors FPR/TPR per detector Synthetic event stream
Throughput Event bus, writer, pipeline benchmarks Workstation and hosted CI
Test suite 530 pass, 3 skipped Local run, Python 3.10

Limitations

  • Capture is single-host: one daemon or one observer describes one host per bundle.
  • Real-robot evidence is offline replay of a recorded GO2 bag, run off to the side of the robot's stack rather than inside its control loop.
  • Detector FPR and TPR are measured on a synthetic stream.
  • Likely-cause weights are hand-calibrated; confidence below 0.5 carries a caveat in the report.

Documentation

MIT license, see LICENSE. Maintainer: Yusuf Guenena (yusufdxb).

About

Flight recorder for ROS 2 robots — observability and failure-forensics platform

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages