Skip to content

ford ALP: cap the applied lane-centering correction at 0.0015 - #181

Open
ghbarker wants to merge 4 commits into
BluePilotDev:bp-dev-ALPfrom
ghbarker:alp-ceiling
Open

ford ALP: cap the applied lane-centering correction at 0.0015#181
ghbarker wants to merge 4 commits into
BluePilotDev:bp-dev-ALPfrom
ghbarker:alp-ceiling

Conversation

@ghbarker

@ghbarker ghbarker commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Description

Split out from #179 per review. Adds a post-gain ceiling of 0.0015 on the applied lane-centering correction, strictly inside the deviation clip's budget (CURVATURE_ERROR = 0.002) and under _STALL_GAP_MIN (0.004) — so the trim alone can never continuously bind the deviation clip (which also discards autocal evidence frames) or feed the stall-blip detector a fake stall. This matters most in the model-position fallback, where the bias error never closes by construction, so a large offset at full gain otherwise sits at the raw 0.004 ceiling permanently on center-stripe-only roads.

Value rationale: above StarPilot's effective ceiling (0.004 raw clip × 0.30 fixed gain = 0.0012), below the 0.002 clip budget. At the default strength of 0.3 this cap never engages (0.004 × 0.3 = 0.0012 < 0.0015) — it only bites at gain ≥ ~0.4, so it can't interfere with default-setting testing. The constant is a proposal: raise it freely while tuning (anything ≥ 0.004 makes it a no-op).

Stacked on #179 — merge that first and this diff shrinks to two module lines plus six test assertions.

Verification

Unit tests only — not road-tested (car is down). Existing suite updated for the capped ceiling; 25/25 pass.

The three reference guards (narrow-lane floor, laneline std, NaN params) stay.
The 0.0015 post-gain ceiling moves to a follow-up PR so the ceiling value can
be chosen from on-road testing; tests revert to the uncapped 0.004 ceiling.
narrow-lane floor, laneline std, NaN params, and a pin on the fallback-bias
semantics (constant push by design). All five fail without the guards.
Post-gain ceiling on the trim, strictly inside the deviation clip's budget
(CURVATURE_ERROR = 0.002) and under _STALL_GAP_MIN (0.004): the trim alone can
never continuously bind the deviation clip (which also discards autocal
evidence frames) or feed the stall-blip detector a fake stall. Matters most in
the model-position fallback, where the bias error never closes by construction,
so a large offset at full gain would otherwise sit at the raw 0.004 ceiling
permanently on center-stripe-only roads.

Value rationale: above the reference implementation's effective ceiling
(0.004 raw clip x 0.30 fixed gain = 0.0012), below the 0.002 clip budget.
The specific constant is a proposal -- sized for safety margin, open to
retuning from on-road testing.
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