Skip to content

eval: score the calculator against measured M100 flight energy - #260

Merged
MatthewK84 merged 2 commits into
mainfrom
claude/gracious-fermi-7sjfow
Dec 4, 2026
Merged

MatthewK84 merged 2 commits into
mainfrom
claude/gracious-fermi-7sjfow

Conversation

@MatthewK84

Copy link
Copy Markdown
Owner

Adds a reality-check track. It compares the calculator's energy figure with battery energy measured on real flights. Every other eval score is measured against the calculator, whose output is the mission pack's expected values. So until now nothing in eval/ could say whether the calculator matches the world.

The data is the CMU DJI Matrice 100 package-delivery record: 209 flights with logged voltage, current, position, orientation and anemometer. It is Rodrigues et al., Scientific Data 8, 155 (2021), DOI 10.1184/R1/12683453.v1, CC BY 4.0.

What it found

Full writeup: eval/REALITY.md. Every figure there cites eval/reality/2026-12-04/m100.json.

  • The calculator under-predicts this aircraft's energy. With calm wind input it under-predicted 127 of 128 held-out flights, by 13.1% on average. 21 of them needed more than the 20% reserve (Wilson 95%: 0.110 to 0.238), all at 10 to 12 m/s.
  • The gap is time, not power. The median flight took 1.23× the time the profile implies and drew 0.93× its predicted power. distance / speed has no term for the acceleration, braking and turning at each waypoint.
  • It is worst on fast, low flights. Bias is −5.4% at 4 m/s and −21.1% at 12 m/s; −16.5% at 25 m and −9.3% at 100 m. A fixed overhead per flight fits that pattern; the 3 m/s vertical-speed default does not.
  • The mass correction is conservative. The fitted exponent is about 1.38 to 1.39 against the model's 1.5, so the calculator over-charges for payload over 3.68 to 4.43 kg.

What changed

  • eval/datasets/ (new):
    • manifest.json records the license (read from the publisher's record, with date and source) and pins every fetched file by size, MD5 and SHA-256.
    • fetch.py is standard library only, https-only (redirects included), and retries.
    • derive_m100.py reduces the record to derived/m100_flights.csv: one row per flight, committed and pinned by SHA-256, with attribution and the changes made beside it in derived/README.md. CI never downloads.
  • backend/suas/eval/flight_energy.py (new, pure). It finds the motor-on window and rotates body-frame velocity into the world frame by the logged quaternion. Phases are classified on suas.calculations.from_log's thresholds, with a ground rule so post-landing idle is not counted as hover. Energy is integrated by the trapezoid rule.
  • backend/suas/eval/reality.py (new). Calibration uses only unladen flights: hover from the four hover tests, cruise from 66 unladen route flights, both corrected to ISA sea level. The 128 laden flights are scored held out through the real assess_mission, on an airframe built in memory. The report gives:
    • calm and surface wind inputs;
    • required reserve, with Wilson intervals;
    • breakdowns by payload, speed and altitude;
    • the time/power split;
    • a fitted mass exponent.
  • eval/reality_check.py (new). This is the CLI (--json, --write, --date). Results go to eval/reality/<date>/, not eval/results/, because build_leaderboard reads every directory there as provider reports.
  • CI: a report-only Reality check step in the backend job, on Python 3.12 only, writes its summary to the job summary. No finding fails it. A missing table, a table that differs from its pin, or a row that does not parse does fail it.
  • Smaller changes:
    • EvalDataError in suas/errors.py.
    • eval/datasets/.cache/ is git-ignored and skipped by the US English lint.
    • docs/engineering-practices.md and docs/PLAN-90.md entries.
    • A changelog line.

What stays the same

  • No change to the calculator, its reference data, or the mission pack. CALCULATOR_VERSION stays 1.9.1. Adding a maneuvering term would bump it and regenerate the pack, which is a decision for its own PR, informed by this one.
  • The Matrice 100 is not added to aircraft.json. Nothing here changes a catalog field.
  • No new dependency.

How it was checked

  1. Controls:
    • Feeding the measured figures back as the oracle scores zero error on both wind inputs.
    • A planted 10% under-prediction is recovered.
    • Calibration refuses laden flights.
    • The sea-level identity and the thin-air correction are tested.
    • fit_exponent recovers a known exponent.
    • A tampered derived table is refused.
    • Every committed report carries the pinned table hash.
  2. Mutation check by hand: flipping the error's sign failed 2 tests, and removing the density correction failed 1.
  3. Data quality:
    • 200 of 209 flights have a motor-on window.
    • Rotated velocity matches position-derived velocity at r = 1.00 east and north, 0.99 up, on flights 18 and 150.
    • 11 flights are excluded, each with a recorded reason: 9 ground tests and the 2 stepped-altitude R7 flights.
  4. fetch.py against the live hosts: a second run verified every hash and downloaded nothing.
  5. Local gates:
    • Backend suite: 1359 passed, 21 skipped, coverage 97.59%. Both new suas modules are at 100%.
    • Ruff and ruff format are clean, as is mypy --strict.
    • The ub-mode gate reports 0 problems: the highest CRAP among the new functions is 7.0, and no new duplicate pair reaches 0.8.

Limits

  • One aircraft, one kind of route. Every route is about 460 m with three stops, so the bias on long straight legs should be smaller, and this record cannot show by how much.
  • No temperature column. Every flight is given ISA at its launch elevation, and the cold derate is not tested.
  • The surface wind input is a rough proxy. It is a ground-level reading with the rotors still, treated as a full headwind. It is the figure most likely to be wrong.

Generated by Claude Code

The mission pack's expected values come from the calculator, so it cannot
say whether the calculator matches real flights. This adds a reality-check
track that scores assess_mission against battery energy measured on 209
DJI Matrice 100 flights (CMU, CC BY 4.0, DOI 10.1184/R1/12683453.v1).

- eval/datasets: manifest with license provenance and size/MD5/SHA-256
  pins, an https-only fetcher, and a deriver that reduces the record to a
  committed, pinned one-row-per-flight table with attribution.
- suas/eval/flight_energy.py: motor-on window, body-to-world velocity
  rotation, phase classification on from_log's thresholds, trapezoid energy.
- suas/eval/reality.py: unladen calibration corrected to ISA sea level,
  laden flights scored held out through the real assess_mission, calm and
  surface wind inputs, required-reserve and Wilson-interval summaries,
  time/power split, fitted mass exponent.
- eval/reality_check.py: report-only CI step; a missing or tampered table
  fails it. Results go to eval/reality/, not eval/results/, which
  build_leaderboard reads as provider reports.

Finding (eval/REALITY.md): with calm input the calculator under-predicts
127 of 128 held-out flights by 13.1% on average; 21 need more than the 20%
reserve, all at 10 to 12 m/s. The gap is unmodeled maneuvering time
(1.23x), not power (0.93x). The calculator itself is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RvN6zzAfs65mmc2vrFCP83
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RvN6zzAfs65mmc2vrFCP83
@MatthewK84
MatthewK84 merged commit 9100bd6 into main Dec 4, 2026
11 checks passed
@MatthewK84
MatthewK84 deleted the claude/gracious-fermi-7sjfow branch December 4, 2026 02:22
MatthewK84 pushed a commit that referenced this pull request Dec 4, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RvN6zzAfs65mmc2vrFCP83

# Conflicts:
#	backend/suas/eval/flight_energy.py
#	backend/tests/test_flight_energy.py
#	eval/datasets/derive_m100.py
#	eval/datasets/derived/README.md
#	eval/datasets/derived/m100_flights.csv
#	eval/datasets/manifest.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants