diff --git a/selfdrive/controls/tests/test_starpilot_vcruise.py b/selfdrive/controls/tests/test_starpilot_vcruise.py index ecd7452bc..000d97d02 100644 --- a/selfdrive/controls/tests/test_starpilot_vcruise.py +++ b/selfdrive/controls/tests/test_starpilot_vcruise.py @@ -8,6 +8,7 @@ from openpilot.starpilot.common.starpilot_variables import PLANNER_TIME from openpilot.starpilot.controls.lib.curve_speed_controller import CSC_GLOW_HOLD_TIME, CSC_GLOW_ON_DELTA from openpilot.starpilot.controls.lib.starpilot_vcruise import ( FORCE_STOP_TURN_VETO_STOP_SEEN_HOLD_TIME, + STANDSTILL_FORCE_STOP_LIGHT_HOLD_TIME, StarPilotVCruise, get_active_slc_control_target, get_lead_veto_distance, @@ -1042,16 +1043,16 @@ def test_standstill_light_hold_expires_and_does_not_rearm_from_stopped_model(): assert update_vcruise(vcruise, sm, toggles, now=0.0) == pytest.approx(0.0) assert vcruise.standstill_force_stop_reason == "light" - assert update_vcruise(vcruise, sm, toggles, now=4.9) == pytest.approx(0.0) + assert update_vcruise(vcruise, sm, toggles, now=STANDSTILL_FORCE_STOP_LIGHT_HOLD_TIME - 0.1) == pytest.approx(0.0) assert vcruise.forcing_stop - assert update_vcruise(vcruise, sm, toggles, now=5.1) == pytest.approx(20.0) + assert update_vcruise(vcruise, sm, toggles, now=STANDSTILL_FORCE_STOP_LIGHT_HOLD_TIME + 0.1) == pytest.approx(20.0) assert not vcruise.forcing_stop assert not vcruise.standstill_force_stop_hold # The red-light model remains stopped, but Force Stop must stay released so # Experimental Mode can own the red-to-green departure. - assert update_vcruise(vcruise, sm, toggles, now=5.2) == pytest.approx(20.0) + assert update_vcruise(vcruise, sm, toggles, now=STANDSTILL_FORCE_STOP_LIGHT_HOLD_TIME + 0.2) == pytest.approx(20.0) assert not vcruise.forcing_stop diff --git a/starpilot/controls/lib/starpilot_vcruise.py b/starpilot/controls/lib/starpilot_vcruise.py index 27ea68ceb..e3a2e0385 100644 --- a/starpilot/controls/lib/starpilot_vcruise.py +++ b/starpilot/controls/lib/starpilot_vcruise.py @@ -22,7 +22,9 @@ from openpilot.selfdrive.controls.lib.longitudinal_vehicle_tunes import ( CSC_MIN_SPEED = CITY_SPEED_LIMIT * CV.MPH_TO_MS OVERRIDE_FORCE_STOP_TIMER = 10 STANDSTILL_FORCE_STOP_CLEAR_TIME = 0.75 -STANDSTILL_FORCE_STOP_LIGHT_HOLD_TIME = 5.0 +# Open-loop — green is undetectable at standstill, so this only needs to cover the +# handoff to CEM+model ownership. Extra seconds are pure departure lag. +STANDSTILL_FORCE_STOP_LIGHT_HOLD_TIME = 2.0 FORCE_STOP_LIGHT_CLEAR_TIME = 0.5 SLC_LEAD_DROP_RELAXATION_MIN_SPEED = 20.0 * CV.MPH_TO_MS SLC_LEAD_DROP_RELAXATION_MIN_DISTANCE = 30.0