
How I built an offline rosbag evaluation bench that scores planning, localization, and detection and fails CI on regressions
A portfolio walkthrough of rosbag-eval-bench: an offline Python bench that reads synthetic ROS 2 MCAP bags, scores planning, localization, and detection against ground truth, and fails CI when gated metrics regress. Synthetic data and offline tooling only, not tested on a real robot.
Synthetic data and offline tooling only
This is a portfolio demo, not a production QA stack and not a test on a real robot. The bags in this repository are synthetic ROS 2 MCAP fixtures. The bench reads those files offline, scores planning, localization, and detection against ground truth in the same bag, and fails CI when gated metrics regress versus a committed baseline. It does not play bags into a live ROS 2 graph, it is not Autoware-compatible, and it is not a substitute for TIER IV driving_log_replayer or hardware-in-the-loop testing.
Try the live demo
The published report page is here: https://applycoding.github.io/rosbag-eval-bench/
The page is a TypeScript viewer over committed JSON. It does not run the Python eval or the regression gate in the browser. You see a nominal candidate compared to the baseline (PASS), a degraded candidate that fails the same baseline, and a plot of the degraded candidate path. The heading on that plot is "Path overlay (degraded)", but the canvas draws only the degraded path, without a baseline, a ground-truth path, or a map underneath.

Image: the GitHub Pages report for the committed synthetic_demo suite. Synthetic data only. applycoding.com.
What the project is
rosbag-eval-bench (repo: applycoding/rosbag-eval-bench, commit 82d2393) is an offline regression evaluation bench. The stack, from the README, is:
| Layer | Role |
|---|---|
rosbag_eval_bench/ |
Python 3.12 package and reb CLI: read MCAP, score metrics, compare, write reports |
fixtures/ |
Synthetic bags, suite YAML, committed baseline, and the JSON the Pages app loads |
web/ |
TypeScript UI that renders those committed reports |
This is an original implementation of well-known evaluation methods: path-length and clearance scoring, SE(2) Umeyama-aligned ATE, Sturm-style time-based RPE, IoU matching, and all-point interpolated average precision. Those ideas are inspired by the projects credited in REFERENCES.md. I did not invent the algorithms, and I did not vendor evo or pycocotools.
The CLI reads MCAP with mcap and mcap-ros2-support. That is file-based evaluation, not ros2 bag play. Message timestamps used for metrics are integer log_time_ns values, not the wrapper's log_time datetime.
What it measures
The committed suite fixtures/suite.yaml is named synthetic_demo. It has one run, full_stack, on fixtures/bags/nominal.mcap, and it requests planning, localization, and detection together. A second suite, fixtures/suite_degraded.yaml, points at fixtures/bags/degraded.mcap with the same baseline.
Planning
The planning metrics are path length, polyline-to-occupied-square clearance (vertices and segments), success, time_to_goal, and smoothness in rad/m.
time_to_goal is taken from path pose header stamps, so it is a planned time, not a live robot arrival. Unknown occupancy cells (-1) are treated as passable. Occupied cells are those with value >= 50. The default robot radius is 0.25 m, and clearance == robot_radius still counts as a pass for success. A path vertex or segment midpoint outside the map is an error, not a soft miss.
Localization
Localization reports unaligned ATE (ate_unaligned_rmse) and an aligned ate_rmse. Alignment is a rigid SE(2) Umeyama transform from the estimate to ground truth, with no scale. The regression gate uses the aligned ate_rmse. A constant pose offset is removed by that alignment and will not fail the gate; the degraded fixture uses non-rigid drift so the gate can actually fire.
RPE is Sturm-style and time-based, at dt = 1 s, with translational and rotational RMSE (rpe_trans_rmse, rpe_rot_rmse). Both RPE numbers are gated. They are computed on the matched poses themselves, not on a second aligned-versus-unaligned pair, and they are not KITTI distance-based relative error. A run needs at least three matched poses for alignment and at least three RPE pairs.
Detection
Detection uses box IoU to match predictions to ground truth. The report includes precision and recall at IoU 0.5, plus all-point interpolated mean average precision at IoU 0.50 (map_50), 0.75 (map_75), and the mean over IoU thresholds 0.50:0.05:0.95 (map). That last number is not official COCO 101-recall-point AP. I did not depend on pycocotools.
Build, evaluate, and run the tests
The README requires Python 3.12 and the pinned lock file:
pip install --require-hashes -r requirements.lock.txt
pip install --no-deps -e .
reb --help
reb eval --suite fixtures/suite.yaml --baseline fixtures/baselines/suite.json --out reports/
pytest
reb eval writes results.json, Markdown, HTML, and figures under the output directory (gitignored as reports/). The process exit code is 0 when the gated comparison passes, 1 when it fails, and 2 when the comparison is invalid (for example a metric-version mismatch).
The same commit's core GitHub Actions job, run 42943235307, installed that lock file, ran ruff check, and reported 21 passed for pytest tests/. A local pytest --collect-only also collected 21 tests. Oracle tests in tests/test_oracles.py check closed-form cases, most of them to 1e-12. The clearance-corner oracle uses 1e-9. A separate fixture test requires an identical replay of the nominal bag to match the committed baseline within 1e-12.
The bags themselves are generated with seed 20261110. tests/test_fixtures.py::test_bag_size_under_1mb requires each committed bag to stay under 1 MiB (1_048_576 bytes); at this commit nominal.mcap is 331853 bytes and degraded.mcap is 287117 bytes.
The CI regression gate
The core workflow does not stop at unit tests. It also requires:
reb eval --suite fixtures/suite.yaml --baseline fixtures/baselines/suite.json --out reports/ci_nominal
# exit 0
reb eval --suite fixtures/suite_degraded.yaml --baseline fixtures/baselines/suite.json --out reports/ci_degraded
# exit 1, and the gated rows full_stack.ate_rmse, full_stack.path_length, and full_stack.map must fail
The gate is direction-aware, with one-sided allowances: an improvement in the better direction does not fail. In compare.py, path length, time to goal, smoothness, aligned ATE, and both RPE terms fail when the candidate rises past a small allowance. Clearance, success, map, map_50, and map_75 fail when the candidate falls past a small allowance. Default allowances include 0.50 m for path length, 0.05 m for clearance, ATE, and translational RPE, 1.0 s for time to goal, 1.0 deg for rotational RPE, and 0.05 for the mAP metrics. Unaligned ATE, ate_rot_rmse, match_ratio, precision_50, and recall_50 are reported only; they do not fail the gate.
On the degraded fixture, some gated rows can still pass. In the published report, clearance improves and stays PASS, while path length, time to goal, smoothness, aligned ATE, and the mAP rows fail.
The browser report
The README calls for Node 26.13.0 and npm 11.20.0, which are also pinned under engines in web/package.json. The web build is:
cd web && npm ci --legacy-peer-deps && npm run build
The web workflow on 82d2393 uses Node 26.13.0, that same npm ci --legacy-peer-deps command, tsc, Vitest, the production build, and Playwright against vite preview on 127.0.0.1:4173 at /rosbag-eval-bench/. Vite's publicDir is fixtures/web/, so the page loads committed baseline.json and degraded.json. After any cd web, later repository commands need to be run from the repo root again.
License and references
The project is Apache-2.0. See LICENSE and NOTICE. Metric code in this repo was written for this demo. No evo or pycocotools source is vendored or depended on.
Vendored files are Humble-era ROS 2 .msg texts only, at the commits listed in NOTICE: ros2/common_interfaces (0843449, Apache-2.0), ros-perception/vision_msgs tag 4.1.1 (e77fa2d, Apache-2.0), and ros2/rcl_interfaces (82776fc, Apache-2.0) for builtin_interfaces. Those files keep their upstream comments and do not carry an Apache SPDX that would claim I authored them. vision_msgs/Pose2D in this tree is the Humble 4.1.1 nested form: position.x, position.y, and theta.
Idea references, with licenses, as listed in REFERENCES.md (conceptual only, no metric source copied):
- foxglove/mcap (MIT), also a declared runtime dependency (
mcap1.6.0 andmcap-ros2-support0.6.0) - ros2/rosbag2 (Apache-2.0), as the idea of an optional Humble reader path
- uzh-rpg/rpg_trajectory_evaluation (MIT), Zhang and Scaramuzza, IROS 2018 (DOI 10.1109/IROS.2018.8593941), and Sturm et al., IROS 2012, for ATE versus time-based RPE
- cartographer-project/cartographer (Apache-2.0)
- tier4/driving_log_replayer_v2 (Apache-2.0), as the idea of a scenario, a bag, and pass/fail thresholds
- ros-navigation/navigation2 planner-metric ideas from Apache-2.0 packages only; I did not read LGPL Nav2 packages to implement clearance
- facebookresearch/detectron2 and open-mmlab/mmdetection (both Apache-2.0), as the idea of IoU matching and AP over IoU thresholds
- NVIDIA-ISAAC-ROS/isaac_ros_benchmark (Apache-2.0), as a CI-shape idea only; that project is mostly latency and throughput
I also looked at MichaelGrupp/evo (GPL-3.0) and cocoapi / pycocotools as idea-only exclusions. Neither is a runtime, dev, or optional dependency. That matters because this repo's outbound license is Apache-2.0.
How this was verified
I ran the standard portfolio-tutorial checks against commit 82d2393 on main.
- The GitHub repo is not a fork.
gh api repos/applycoding/rosbag-eval-benchreports"fork": false. - All 3 commits on
mainhave author and committer Arpan Bom (applycoding@gmail.com). A pre-merge branch,cursor/build-rosbag-eval-bench-7e1b, has additional commits, also authored and committed by Arpan Bom. Three of those branch commits carry aCo-authored-bytrailer for the same GitHub account's noreply address. The successful CI workflow on82d2393, including thecore,web,pages, and informationalhumble_smokejobs, was triggered by the GitHub userapplycoding. - A search of the tree found no
third_party,vendor, orexternaldirectories, and no "ported from", "adapted from", or "copied from" markers in the authored source. The only vendored files are the Humble.msgtexts credited inNOTICE. - This is an original implementation of well-known evaluation methods, inspired by the projects credited above. I did not invent these algorithms.
- At
82d2393,NOTICElists the vendored message packages with commits and Apache-2.0; the direct Python runtime dependencies with versions and licenses (mcap 1.6.0 MIT, mcap-ros2-support 0.6.0 MIT, numpy 2.5.4 BSD-3-Clause and other licenses in its METADATA, matplotlib 3.11.2, Jinja2 3.1.6 BSD-3-Clause, MarkupSafe 3.0.4 BSD-3-Clause, PyYAML 6.0.3 MIT, pydantic 2.14.3 MIT, pydantic-core 2.50.4 MIT, lz4 4.4.5 BSD-3-Clause, and zstandard 0.25.0 BSD-3-Clause); the direct Python dev dependencies pytest 9.2.0 (MIT), ruff 0.17.4 (MIT), and pip-tools 7.4.1 (BSD-3-Clause); the build-system requires setuptools 84.2.1 (MIT) and wheel 0.48.0 (MIT); and the web devDependencies Vite 8.3.7 (MIT), Vitest 5.1.0 (MIT), TypeScript 7.0.2 (Apache-2.0), Playwright Test 1.65.0 (Apache-2.0), and@types/node22.10.2 (MIT). Idea references remain inREFERENCES.mdand in this tutorial. Transitive packages fromrequirements.lock.txt(for example pillow, contourpy, and typing-extensions) are still not named inNOTICE. - The repo license is Apache-2.0. evo (GPL-3.0) and pycocotools are excluded from every dependency group.
- Commands, paths, APIs, and the numbers in this tutorial were checked against the repo at
82d2393. The 21-test figure is from core GitHub Actions run 42943235307 on that commit (21 passed). The live demo and the GitHub repo both returned HTTP 200. - This project uses synthetic fixtures and offline tooling only. It has not been tested on a real robot, and the Humble smoke job is a non-gating stub.
Limits
This is synthetic data and offline tooling, not a test on a real robot. The CLI evaluates recorded MCAP files; it does not integrate with a live ROS 2 system. The optional tools/humble_smoke.py job is a non-gating stub (continue-on-error: true). On the 82d2393 CI run it printed rosbag2_py not available and exited 0. Even when rosbag2_py is importable, the script only checks the committed manifest topic list; it does not open the bag and it does not install this package's Python 3.12 / numpy 2.5 stack. Detection mAP is all-point interpolated AP, not official COCO AP. RPE is time-based, not KITTI-style. The Pages demo displays committed JSON and does not run the gate in the browser.