Skip to content

Regression-test a change

A fix for one scenario can break another. quatern regress replays a saved set of your robot's recordings against the current code, compares every metric with a baseline, and exits non-zero when anything got worse. A set is a directory you commit next to your modules, and it runs anywhere Quatern Code installs: no robot, no ROS, no captures.

# once, on the machine with the robot's recordings
quatern regress init regress/hallway --robot mybot --world "reach (3, 3)" \
    --localizer modules/localizer --planner modules/planner

# on every change, locally or in CI
quatern regress run regress/hallway --localizer modules/localizer --planner modules/planner
quatern regress run regress/hallway --junit regress.xml      # also a JUnit report

# a change that makes the numbers worse on purpose: accept them
quatern regress baseline regress/hallway --localizer modules/localizer --planner modules/planner

Without --localizer and --planner, the code under test is what Quatern Code generates for the robot, which makes the set a check on Quatern Code itself, for example across a Quatern Code upgrade. A module directory's params.json wins over the generated parameters wherever it says something, exactly as quatern verify --module treats it.

The set

regress/hallway/
  regress.json                     robot, goal, recordings, baseline, tolerances
  robot/mybot.quatern.json         the robot's config and URDF, as they were
  robot/mybot.urdf
  recordings/<capture_id>/
    capture.json                   the capture's metadata
    frames.jsonl.gz                every frame it recorded, in Quatern's portable form
  calibration.json                 the calibration the generated code used, if any

init takes the robot's newest three recordings (or each --recording), replays each once through its own backend and writes the frames out, so a rosbag recorded on a ROS 2 robot replays later without ROS. It then records the code under test's metrics as the baseline. A 20-second recording is about 1 MB compressed; put the sets under Git LFS if they grow.

What is compared

Each recording is replayed exactly as verification replays it, in the sandbox, against a scratch store. Your real store is never touched.

Metric Regression when
The localizer runs (localizer_ok) It ran before and fails now.
drift_at_end It grows by more than 10% of the baseline or 0.01, whichever is more, or crosses into the drift warning or critical band.
residual_max (worst pair of sources) It grows by more than 10%, or 0.01.
loop_closures There were some and now there are none.
loop_closure_error It crosses the warning limit it was under.
The planner plans (plan_ok, with --world) It planned before and fails now.
plan_length, plan_duration It grows by more than 10%.
violations More constraint violations than before.
keeps_up (real-time performance) Never: reported as a warning, since CI machines differ.

Improvements are reported too, so a better change shows. The tolerances are in regress.json: "tolerances": {"relative": 0.1, "absolute": 0.01}.

A passing run:

$ quatern regress run regress/room
quatern regress — regress/room
  recording                                metric       baseline  now
  turtlebot4.default_2026-10-03_sample_v1  all metrics                 ok  within tolerance

no regressions

A failing run lists each regressed metric per recording:

quatern regress — regress/hallway
  recording                        metric         baseline  now
  c101.default_2026-10-03_hall_v1  drift_at_end   0.0239    0.044  FAIL  0.044 is over 0.0239 + 0.01 allowed
                                   plan_duration  19.08     21.75  FAIL  21.75 is over 19.08 + 1.908 allowed

2 regression(s)

In CI

This GitHub Actions workflow checks out (with LFS), installs Quatern Code, runs quatern regress run with your module directories, and keeps the JUnit report as an artifact. Copy it to .github/workflows/quatern-regress.yml in the repository that holds your modules and set the paths. Recordings are a few MB each: git lfs track "regress/**/*.gz" keeps the repository small.

.github/workflows/quatern-regress.yml
name: quatern regress

on:
  pull_request:
  push:
    branches: [main]

jobs:
  regress:
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - uses: actions/checkout@v4
        with:
          lfs: true
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - name: Install Quatern
        run: pip install "quatern==0.3.*"
      - name: Replay the recordings
        run: >
          quatern regress run regress/hallway
          --localizer modules/localizer
          --planner modules/planner
          --junit regress.xml
      - name: Keep the report
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: quatern-regress
          path: regress.xml

Commands

Command Does
quatern regress init DIR --robot R Make a set from the robot's recordings and record its baseline. --recording ID (repeatable; default the newest three), --world W (the planner's goal; without it only the localizer is compared), --force to replace a set already there.
quatern regress run DIR Replay the set against the code under test and compare with the baseline. --junit FILE also writes a JUnit XML report.
quatern regress baseline DIR Record the code under test's numbers as the new baseline.

All three take --localizer DIR and --planner DIR (the modules under test; default: Quatern Code's generated code) and --json.

Exits 0 with no regression, 1 on a regression, 2 when the set or a module couldn't be read.