Skip to content

Add regression tests for controller emergency brake and anti-windup - #35

Draft
cursor[bot] wants to merge 1 commit into
devfrom
cursor/missing-test-coverage-5b77
Draft

Add regression tests for controller emergency brake and anti-windup#35
cursor[bot] wants to merge 1 commit into
devfrom
cursor/missing-test-coverage-5b77

Conversation

@cursor

@cursor cursor Bot commented Aug 7, 2026

Copy link
Copy Markdown

Summary

Adds focused regression coverage for high-risk controller safety paths that remained untested on dev, while avoiding duplication of open drafts #17/#20/#22#34.

Risky behavior now covered

  • Stanley emergency brake: near-zero reference speed while ego is still moving overrides weak/zero PID with ego_min_acceleration * c30_emergency_braking_factor
  • Stanley emergency gate: ego below c30_emergency_min_moving_velocity does not trigger the override
  • Stanley anti-windup + accel floor: stopped ego clears a positive cte_v_sum and refuses further negative acceleration
  • Stanley CTE slow-down: large lateral offset while fast dumps acceleration toward max braking
  • PurePursuit velocity_pid: same emergency override and stop-floor/anti-windup contract on the shared velocity PID helper

Test files added/updated

  • test/c30_control/test_c30_emergency_brake.py (new)

Why these tests materially reduce regression risk

Emergency braking and anti-windup sit on every Stanley/PurePursuit control tick and gate obstacle-stop / end-of-path deceleration. Silently dropping the override leaves a weak PID coasting into a stop request; losing anti-windup/floor pushes the plant through zero velocity. CTE slow-down is the Stanley-specific path that bleeds speed in corners—easy to regress while tuning gains.

Validation

pytest test/c30_control/test_c30_emergency_brake.py test/c30_control/ -v

All 29 control tests passed (6 new). No production code changes.

Open in Web View Automation 

Cover Stanley and PurePursuit velocity safety paths: hard brake on
near-zero reference speed, integral clear + accel floor at rest, and
Stanley CTE slow-down while fast.

Co-authored-by: Majid Khonji <majid-khonji@users.noreply.github.com>
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