Skip to content

Fly a flight again

“Did my change break the hover?” needs two flights that differ only in the change. With repro, a server never needs the agent to remember how the first one was flown.

When a session opened with open_sitl closes, its kept log gets a sibling, <stem>.recipe.json. It holds two things:

  • The open arguments as they took effect: a preset already merged in, the parameter files SITL actually loaded (the frame defaults resolved), the whole overlay including what open_sitl adds itself, such as BATT_MONITOR 4, the wind with its seed, and the path and sha256 of the binary that flew.
  • Every call that acted on the aircraft, in order: arm, rc_override, set_mode, set_param, set_speedup, set_wind, upload_mission, wait_until, fly_steps, abort_steps and disarm. Each comes with its arguments, the sim time and how it ended.

list_logs shows recipe: true for the logs that have one. The log budget prunes a recipe with its log, and pin_log spares both.

repro(log="20261005T101500Z-gusty-hop.BIN")

repro reopens the session with the recorded arguments, replays the calls through the same tools, closes, and compares the new log with the original. Each wait and step program runs to its end before the next call starts, so a slower machine replays the flight, not the clock. It’s a background job: the call waits up to about 85 s, then repro_status follows it.

{ "status": "done", "replayed": 2, "skipped": [], "binary_matches": true,
"log": ".../20261005T101532Z-repro-gusty-hop.BIN",
"compare": { "totals": { "energy_wh": { "a": 4.7432, "b": 4.7299, "pct": -0.28 } },
"phases": { "matched": [ ... ] } } }

A gusty hover hop on real ArduPilot (6 m/s from the west, seeded Dryden gusts), flown and then replayed:

Phase Original Replay Difference
Hover, flying 73.71% lift, 42.67 A 73.48% lift, 42.52 A −0.31%, −0.36%
Descent, flying 33.42 A 33.38 A −0.12%
Whole flight 4.743 Wh 4.730 Wh −0.28%
repro(log="...gusty-hop.BIN", tree="~/ardupilot-dev") # or binary="..."

The parameters come from the recipe, not from the new build’s defaults, so the only difference is the code. binary_matches: false confirms the binary is not the one that flew. A container build gives you a binary you can name and rebuild.

abort_steps is skipped, and listed under skipped, because when it was called depended on the agent, not the flight. Logs kept before recipes existed, and sessions a script opened through the library rather than open_sitl, have no recipe, and repro says so.