Closer Follow

This commit is contained in:
firestar5683
2026-08-25 19:08:46 -05:00
parent 903631ee53
commit b381cc0c4a
8 changed files with 229 additions and 177 deletions
@@ -11,7 +11,9 @@ GM_SILVERADO_EARLY_FOLLOW_MIN_EGO_SPEED = 18.0
GM_SILVERADO_EARLY_FOLLOW_MAX_DISTANCE = 130.0
GM_SILVERADO_EARLY_FOLLOW_MIN_MODEL_PROB = 0.85
GM_SILVERADO_EARLY_FOLLOW_MAX_LATERAL_OFFSET = 1.2
DEFAULT_FOLLOW_PREBRAKE_MIN_HEADWAY = 1.25
GM_SILVERADO_FOLLOW_PREBRAKE_MIN_HEADWAY = 1.25
FORD_LIGHTNING_FOLLOW_PREBRAKE_MIN_HEADWAY = 1.0
TOYOTA_SIENNA_POST_DEPARTURE_RESTOP_MAX_EGO_SPEED = 2.0
TOYOTA_SIENNA_POST_DEPARTURE_RESTOP_MAX_LEAD_SPEED = 0.45
TOYOTA_SIENNA_POST_DEPARTURE_RESTOP_MAX_LEAD_DELTA = 0.35
@@ -337,7 +339,9 @@ def get_follow_prebrake_min_headway(CP, t_follow):
"""Return the comfort pre-brake floor without changing lead safety distance."""
if CP.brand == "gm" and str(CP.carFingerprint) in ("CHEVROLET_SILVERADO", "CHEVROLET_SILVERADO_CC"):
return max(float(t_follow), GM_SILVERADO_FOLLOW_PREBRAKE_MIN_HEADWAY)
return max(float(t_follow), 1.6)
if CP.brand == "ford" and str(CP.carFingerprint) == "FORD_F_150_LIGHTNING_MK1":
return max(float(t_follow), FORD_LIGHTNING_FOLLOW_PREBRAKE_MIN_HEADWAY)
return max(float(t_follow), DEFAULT_FOLLOW_PREBRAKE_MIN_HEADWAY)
def get_toyota_sienna_post_departure_restop_cap(CP, lead, v_ego, accel_min,
@@ -668,12 +668,14 @@ def test_gm_silverado_early_follow_requires_a_credible_centered_vision_lead(kwar
assert not is_gm_silverado_early_follow_lead(CP, lead, 30.0)
def test_silverado_prebrake_floor_is_vehicle_specific():
def test_prebrake_floor_is_vehicle_specific():
silverado = SimpleNamespace(brand="gm", carFingerprint=GM_CAR.CHEVROLET_SILVERADO)
lightning = SimpleNamespace(brand="ford", carFingerprint="FORD_F_150_LIGHTNING_MK1")
honda = SimpleNamespace(brand="honda", carFingerprint=CAR.HONDA_CIVIC)
assert get_follow_prebrake_min_headway(silverado, 1.0) == pytest.approx(1.25)
assert get_follow_prebrake_min_headway(honda, 1.0) == pytest.approx(1.6)
assert get_follow_prebrake_min_headway(lightning, 0.75) == pytest.approx(1.0)
assert get_follow_prebrake_min_headway(honda, 1.0) == pytest.approx(1.25)
def test_silverado_vision_follow_hold_survives_nonurgent_far_lead_crossover():