This commit is contained in:
rav4kumar
2026-09-15 15:14:45 -07:00
parent 4b3e51a490
commit ef938df670
@@ -1,4 +1,5 @@
from types import SimpleNamespace
from typing import cast
from openpilot.common.test import OpenpilotTestCase
from openpilot.cereal import custom
@@ -51,12 +52,12 @@ class TestStoppingHold:
def test_weak_brake_does_not_hold_stopping(self):
control = SimpleNamespace(last_output_accel=-0.109)
car_state = SimpleNamespace(vEgo=0.277, aEgo=-0.406)
assert not LongControlSP.should_hold_stopping(control, car_state, -0.072)
assert not LongControlSP.should_hold_stopping(cast(LongControlSP, control), car_state, -0.072)
def test_sufficient_brake_holds_stopping(self):
control = SimpleNamespace(last_output_accel=-0.543)
car_state = SimpleNamespace(vEgo=0.209, aEgo=-0.534)
assert LongControlSP.should_hold_stopping(control, car_state, -0.469)
assert LongControlSP.should_hold_stopping(cast(LongControlSP, control), car_state, -0.469)
def test_stopping_decel_rate_is_smooth_while_rolling(self):
assert LongControlSP.stopping_decel_rate(0.1) == 0.3