Skip to content

Ford angle-mode lateral: on-device auto-calibration gauges - #172

Draft
ghbarker wants to merge 3 commits into
BluePilotDev:bp-devfrom
ghbarker:ford-autocal-gauges
Draft

Ford angle-mode lateral: on-device auto-calibration gauges#172
ghbarker wants to merge 3 commits into
BluePilotDev:bp-devfrom
ghbarker:ford-autocal-gauges

Conversation

@ghbarker

@ghbarker ghbarker commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Stacked on #161 (auto-calibration) — a single display-only commit on top of it; merging #161 first shrinks the diff here to just this.

The evidence that motivated this

  • The auto-calibration runs for many drives with its state invisible on the device: the only feedback was the factor values themselves, which move in 0.01 steps and say nothing about evidence progress or lock state.
  • Diagnosing calibration behavior from the seat required a laptop and logs; a glance-able progress readout removes that.

Why the fix is shaped this way

  • Battery-style gauges on the existing lateral debug view: one per anchor, monotonic evidence fill (progress never appears to move backwards during normal decay) and a lock icon when the calibration freezes.
  • Fed exclusively by the controller's ground-truth telemetry (bmsAngleAutoCalState) — the same source the logs carry, so what the screen shows is what the calibrator believes.
  • Display only: no control-path changes, no new params, no new process.

The evidence afterwards

  • Widget unit test covers the fill monotonicity and lock rendering; the stack's 105 Ford tests stay green.

What each change is

  • bluepilot/ui/widgets/debug/autocal_bars.py (+ its test): the gauge widget.
  • selfdrive/ui/bp/mici/onroad/lateral_debug_mici.py: +14 lines wiring the gauges into the debug overlay.

Test it yourself

Risks / limits

ghbarker added 3 commits July 30, 2026 00:30
…ctors

A pure estimator (angle_autocal.py) fits the two gain anchors from clean
cornering evidence — steady curve segments and matched command/measured
apexes — and nudges the applied factors toward the fit in small damped
steps, verifying each step against fresh evidence before the next.
Evidence is only taken while the loop is quietly tracking (hunting can
never read as gain) and while the actuation delay is estimated, aligned
against the command from lateral_delay ago so a moving command on winding
roads still counts. Lifecycle (arm/disarm, persistence, nudge writes,
lock) lives in a controller; the same estimator runs offline against
logged drives.

The sub-knee small-signal lift rides the FordHighSpeedDampening_ang knob
merged in BluePilotDev#166 (mechanically the same multiplier); no duplicate param is
added. Settings are on the on-device menus (comma 3X + comma four) and
sunnylink. Menu neutral values leave steering bit-identical to today.
Five input-side filters (angle_smoothing.py) that damp the rhythmic
straight-road weave: an asymmetric filter on |kappa| feeding the gain
schedule (the primary fix), a low-pass on the model prediction, a slew on
the exit blend, hysteresis on the curve-entering boolean, and a 1-LSB wire
hold on the outgoing path_angle. A strength dial where 1.0 is bit-identical
stock; no output-side lag by construction. Held wire frames are zero-ROC
and cannot trip the panda path_angle checks.

Toggle + strength on both device menus and sunnylink. Stacked on the
auto-calibration PR (shares the lateral_angle_ext wiring).
Battery-style gauges on the lateral debug view showing each anchor's
calibration progress (evidence fill that stays monotonic, lock icon when
the calibration freezes), fed by the ground-truth auto-cal telemetry the
controller publishes. Display only; no control-path changes.

Stacked on the auto-calibration PR (reads its bmsAngleAutoCalState
telemetry).
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