Skip to content

fix(metrics): scoring alignment, origin offset timing and GT cropping (ODL-118, ODL-119), scoring_version 2 - #56

Merged
palcode merged 1 commit into
mainfrom
fix/vio-scoring-alignment
Nov 24, 2026
Merged

palcode merged 1 commit into
mainfrom
fix/vio-scoring-alignment

Conversation

@palcode

@palcode palcode commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Fixes ODL-118 and ODL-119 (scoring alignment in localization_metrics.align_trajectories). Approved by Pallab knowing recorded numbers could shift. No gate changed.

Bugs

  • ODL-118, origin offset at two instants. v1 used gt[0] - est[0]: the first GT sample and the first estimate sample of the overlap window. These are up to one GT period apart (about 17 ms at 57 Hz). If the vehicle is moving then, every sample carries a speed x gap error. Synthetic results for a perfect estimate:
    • 0.058 m at 6 m/s with 60 Hz GT;
    • 0.18 m with 10 Hz GT.
  • ODL-119, GT cropped before interpolation. GT was cut to the overlap window and then interpolated. Estimate samples between the window edge and the first/last cropped GT sample therefore got clamped GT.

Fix

  • The estimate is masked to the GT time range. GT is not cropped.
  • GT is interpolated from the full series onto the estimate times.
  • The origin offset is taken from the interpolated GT at the first estimate time.
  • A perfect estimate now scores 0 whatever the GT rate, speed or start time.

Scoring version

  • SCORING_VERSION = 2 is written in every metrics JSON. summary.json records scoring_version, taken from the metrics files that were written (scripts/scoring_version.py). A missing field means v1, and mixed versions report the older one.
  • The regression report shows scoring_version= per run, and report.json has scoring_versions. This is wired into run-vio-stress.sh and run-vio-baseline.sh.
  • Not in the scenario fingerprint. The fingerprint covers what was flown: model, flight profile, world, overlay and mask. The scoring version describes how a recorded flight was scored, and the same bag can be re-scored under either version.
    • Hashing it would give one flight two fingerprints.
    • It would also change every fingerprint again with nothing different in the air.
    • Compare numbers only when both the fingerprint and scoring_version match.

Re-score of recorded flights (no new flights for this)

46 runs were re-scored from their bags with both versions, using the same airborne mask and evo -a:

The v1 re-score reproduces every recorded number exactly. On real flights the effect is almost nil:

  • EKF2: it starts publishing on the ground at rest, so the offset instant doesn't matter. Origin H/V and Umeyama are unchanged (|Δ| < 1e-16 m).
  • OpenVINS: it starts during the climb (0.5–1.8 m/s). VIO origin H changes by ≤ 1.3 mm and VIO origin V by ≤ 21.5 mm. Neither is gated.
  • Gated Umeyama metrics: they fit their own translation, so the offset bug can't reach them. Edge clamping touched only samples outside the airborne mask: |Δ| ≤ 2e-6 m.
  • No verdict changed and no gate was crossed in either direction. The 0.70045 m knife-edge run is still 0.70045 m.

The gated metric is VIO Umeyama xy (EKF2 Umeyama xy for mc_gps). "(ng)" marks a non-gating scenario.

Run Scenario gated metric old new gate EKF2 origin H old→new (gate) VIO origin V old→new old verdict new verdict
1113_195617 (old world) baseline VIO Umeyama xy 0.4447 0.4447 0.7 0.2775→0.2775 (0.44) 0.1421→0.1454 PASS PASS
1113_211846 (old world) baseline VIO Umeyama xy 2.3399 2.3399 0.7 0.2763→0.2763 (0.44) 0.2422→0.2414 FAIL FAIL
1113_215826 (old world) baseline VIO Umeyama xy 0.7005 0.7005 0.7 0.2855→0.2855 (0.44) 0.1287→0.1296 FAIL FAIL
1124_114534 (old world) baseline VIO Umeyama xy 0.8929 0.8929 0.7 0.2863→0.2863 (0.44) 0.1195→0.1193 FAIL FAIL
1124_115528 (old world) baseline VIO Umeyama xy 0.4041 0.4041 0.7 0.2852→0.2852 (0.44) 0.0710→0.0721 PASS PASS
1124_122737 (old world) baseline VIO Umeyama xy 0.9840 0.9840 0.7 0.2878→0.2878 (0.44) 0.1161→0.1156 FAIL FAIL
1124_123448 (old world) baseline VIO Umeyama xy 1.3879 1.3879 0.7 0.2902→0.2902 (0.44) 0.2878→0.2882 FAIL FAIL
1124_124128 (old world) baseline VIO Umeyama xy 1.0886 1.0886 0.7 0.2831→0.2831 (0.44) 0.1751→0.1775 FAIL FAIL
1124_124449 (old world) baseline VIO Umeyama xy 0.6253 0.6253 0.7 0.2832→0.2832 (0.44) 0.0841→0.0828 PASS PASS
1124_124828 (old world) baseline VIO Umeyama xy 0.6590 0.6590 0.7 0.2855→0.2855 (0.44) 0.1003→0.0989 PASS PASS
1124_125130 (old world) baseline VIO Umeyama xy 0.4397 0.4397 0.7 0.2878→0.2878 (0.44) 0.0708→0.0719 PASS PASS
1124_125433 (old world) baseline VIO Umeyama xy 0.4024 0.4024 0.7 0.2783→0.2783 (0.44) 0.1455→0.1457 PASS PASS
1124_140757 (old world) baseline VIO Umeyama xy 0.4152 0.4152 0.7 0.2879→0.2879 (0.44) 0.0321→0.0318 PASS PASS
1124_143838 (old world) baseline VIO Umeyama xy 0.3856 0.3856 0.7 0.2873→0.2873 (0.44) 0.0907→0.0963 PASS PASS
1124_145205 (new world) baseline VIO Umeyama xy 0.0738 0.0738 0.7 0.2860→0.2860 (0.44) 0.0667→0.0704 PASS PASS
1124_145508 (new world) baseline VIO Umeyama xy 0.1075 0.1075 0.7 0.2908→0.2908 (0.44) 0.0494→0.0497 PASS PASS
1124_145811 (new world) baseline VIO Umeyama xy 0.1111 0.1111 0.7 0.2942→0.2942 (0.44) 0.0241→0.0254 PASS PASS
1124_150126 (new world) baseline VIO Umeyama xy 0.1143 0.1143 0.7 0.2863→0.2863 (0.44) 0.0398→0.0399 PASS PASS
1124_150436 (new world) baseline VIO Umeyama xy 0.0746 0.0746 0.7 0.2888→0.2888 (0.44) 0.0250→0.0248 PASS PASS
1120_223052 low_texture VIO Umeyama xy 0.1020 0.1020 0.55 0.2706→0.2706 (0.4) 0.0545→0.0517 PASS (ng) PASS (ng)
1123_234522 low_texture VIO Umeyama xy 0.1033 0.1033 0.55 0.2633→0.2633 (0.4) 0.0531→0.0494 PASS (ng) PASS (ng)
1124_114821 low_texture VIO Umeyama xy 0.0969 0.0969 0.55 0.2676→0.2676 (0.4) 0.0757→0.0805 PASS (ng) PASS (ng)
1124_123029 low_texture VIO Umeyama xy 0.0944 0.0944 0.55 0.2694→0.2694 (0.4) 0.0882→0.0778 PASS (ng) PASS (ng)
1124_141102 low_texture VIO Umeyama xy 0.0863 0.0863 0.55 0.2669→0.2669 (0.4) 0.0523→0.0533 PASS (ng) PASS (ng)
1124_150747 low_texture VIO Umeyama xy 0.1554 0.1554 0.55 0.2656→0.2656 (0.4) 0.0658→0.0678 PASS (ng) PASS (ng)
1110_231056 faster_motion VIO Umeyama xy 0.1408 0.1408 0.42 0.4125→0.4125 (0.6) 0.0783→0.0998 PASS PASS
1110_232254 faster_motion VIO Umeyama xy 0.2010 0.2010 0.42 0.4120→0.4120 (0.6) 0.0961→0.1002 PASS PASS
1110_233445 faster_motion VIO Umeyama xy 0.1886 0.1886 0.42 0.4054→0.4054 (0.6) 0.1024→0.1157 PASS PASS
1110_234631 faster_motion VIO Umeyama xy 0.1642 0.1642 0.42 0.3955→0.3955 (0.6) 0.0838→0.0857 PASS PASS
1111_010040 faster_motion VIO Umeyama xy 0.1512 0.1512 0.42 0.4047→0.4047 (0.6) 0.0497→0.0536 PASS PASS
1124_151203 faster_motion VIO Umeyama xy 0.1125 0.1125 0.42 0.4143→0.4143 (0.6) 0.0847→0.0986 PASS PASS
1110_120158 faster_motion_aggressive VIO Umeyama xy 0.3939 0.3939 0.42 0.4243→0.4243 (0.6) 0.7193→0.7213 PASS (ng) PASS (ng)
1123_231942 faster_motion_aggressive VIO Umeyama xy - - 0.42 0.4153→0.4153 (0.6) - FAIL (ng) FAIL (ng)
1124_115139 faster_motion_aggressive VIO Umeyama xy - - 0.42 0.4114→0.4114 (0.6) - FAIL (ng) FAIL (ng)
1110_230200 wind VIO Umeyama xy 0.3646 0.3646 1.85 0.2858→0.2858 (0.44) 0.0487→0.0487 PASS PASS
1110_231355 wind VIO Umeyama xy 0.2793 0.2793 1.85 0.2903→0.2903 (0.44) 0.0668→0.0674 PASS PASS
1110_232600 wind VIO Umeyama xy 0.6267 0.6267 1.85 0.2836→0.2836 (0.44) 0.1238→0.1201 PASS PASS
1110_233745 wind VIO Umeyama xy 0.4689 0.4689 1.85 0.2874→0.2874 (0.44) 0.1196→0.1162 PASS PASS
1110_234938 wind VIO Umeyama xy 0.8073 0.8073 1.85 0.2920→0.2920 (0.44) 0.2289→0.2261 PASS PASS
1111_010352 wind VIO Umeyama xy 0.9058 0.9058 1.85 0.2896→0.2896 (0.44) 0.1528→0.1523 PASS PASS
1113_212138 mc_gps EKF2 Umeyama xy 0.2553 0.2553 0.39 0.2796→0.2796 (0.43) - PASS PASS
1124_122434 mc_gps EKF2 Umeyama xy 0.2578 0.2578 0.39 0.2785→0.2785 (0.43) - PASS PASS
1124_140519 mc_gps EKF2 Umeyama xy 0.2629 0.2629 0.39 0.2854→0.2854 (0.43) - PASS PASS
1124_141411 mc_gps EKF2 Umeyama xy 0.2610 0.2610 0.39 0.2760→0.2760 (0.43) - PASS PASS
1124_141702 mc_gps EKF2 Umeyama xy 0.2614 0.2614 0.39 0.2849→0.2849 (0.43) - PASS PASS
1124_143559 mc_gps EKF2 Umeyama xy 0.2526 0.2526 0.39 0.2720→0.2720 (0.43) - PASS PASS

Verification

  • pytest, regression set (now includes test_scoring_alignment.py): 366 passed.
    • The new alignment tests fail on v1: 11 of 17 fail on the origin/main module.
    • They cover a perfect estimate at 10/30/60 Hz GT with estimate phase offsets, a mid-air start, a known constant offset, a known time shift, edge cropping, out-of-range estimate samples, and no overlap.
    • The heredoc tests check that scoring_version lands in summary.json and not in the fingerprint.
  • Live run regression_20261124_153609 (mc_gps + baseline on this branch, old world): both PASS.
    • Both summary.json files and all metrics JSONs carry scoring_version: 2.
    • The report shows scoring_version=2 and report.json has scoring_versions.
    • Baseline VIO xy was 0.648, with a 1.62 m far-corner jump. That is ODL-86 on the old world, which feat(world): far-side texture in vio_test for the wp2->wp3 leg (ODL-86) #55 addresses.
    • Fingerprints are unchanged (4bb3131b…, 704df735…).
  • shellcheck (warning) is clean; gitleaks on origin/main..HEAD is clean.

Notes

…nterpolation (ODL-118, ODL-119)

align_trajectories (scoring version 1) took the origin offset from the
first GT and first estimate samples, which are at different instants, and
cropped GT to the overlap window before interpolating, so edge estimate
samples got clamped GT. Now GT is interpolated from the full series onto
the estimate times (estimate masked to the GT range) and the offset is
taken from that interpolated GT at the first estimate time.

SCORING_VERSION = 2 goes into every metrics JSON and summary.json
(scoring_version; missing = 1) and is shown in the regression report. It
is deliberately not part of the scenario fingerprint. Gates unchanged.
Re-scored 46 recorded runs: no verdict changed.
@palcode
palcode merged commit d6c0605 into main Nov 24, 2026
4 checks passed
@palcode
palcode deleted the fix/vio-scoring-alignment branch November 24, 2026 10:42
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.

1 participant