From 3e020e321f25d3d26a98e64e4bfa81492b3a72ff Mon Sep 17 00:00:00 2001 From: Isaac Barham Date: Thu, 27 Aug 2026 19:44:19 -0400 Subject: [PATCH] ford: gate curvature rate with maneuver demand Assisted-by: Codex --- openpilot/selfdrive/controls/lib/ford_path.py | 2 +- openpilot/selfdrive/controls/tests/test_ford_path.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/openpilot/selfdrive/controls/lib/ford_path.py b/openpilot/selfdrive/controls/lib/ford_path.py index 4b4c5d7e4e..6ea90c2490 100644 --- a/openpilot/selfdrive/controls/lib/ford_path.py +++ b/openpilot/selfdrive/controls/lib/ford_path.py @@ -136,7 +136,7 @@ def _encode_path(model, desired_curvature: float | None, v_ego: float, current_c path_offset=float(np.clip(path_offset, *DBC_OFFSET)), path_angle=float(np.clip(path_angle, *DBC_ANGLE)), curvature=float(np.clip(centering_curvature * (1.0 - maneuver_share), *DBC_CURVATURE)), - curvature_rate=float(np.clip(model_curvature_rate, *DBC_CURVATURE_RATE)), + curvature_rate=float(np.clip(model_curvature_rate * maneuver_share, *DBC_CURVATURE_RATE)), ) diff --git a/openpilot/selfdrive/controls/tests/test_ford_path.py b/openpilot/selfdrive/controls/tests/test_ford_path.py index 240ad20b10..1bb35deaff 100644 --- a/openpilot/selfdrive/controls/tests/test_ford_path.py +++ b/openpilot/selfdrive/controls/tests/test_ford_path.py @@ -173,6 +173,15 @@ def test_minor_curve_uses_c2_when_tracking_is_close(): assert command.curvature > 0.0049 +def test_minor_changing_curve_does_not_emit_ungated_c3(): + command = FordPathController(dt=1.0).update(_path(0.005, 0.0003), 0.005, v_ego=8.0, current_curvature=0.0048) + + assert abs(command.path_offset) < 1e-9 + assert abs(command.path_angle) < 1e-9 + assert command.curvature > 0.0049 + assert command.curvature_rate == 0.0 + + def test_action_curvature_corrects_stale_opposing_model_at_low_speed(): command = FordPathController().update(_path(-0.001, speed=1.0), 0.005, v_ego=1.0, current_curvature=0.001)