From 186c1a17f34e0027d8c47f00b8a744fc9d35293c Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Mon, 1 Dec 2025 12:00:00 -0700 Subject: [PATCH] comma's steering speed hack from their 2022 Taco Bell Run https://github.com/commaai/openpilot/commit/1801a14f85c93b3e1c461ddc5c552523bc8baffa --- selfdrive/controls/lib/longitudinal_planner.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/selfdrive/controls/lib/longitudinal_planner.py b/selfdrive/controls/lib/longitudinal_planner.py index 4620c9a8b..aeb41b6d7 100755 --- a/selfdrive/controls/lib/longitudinal_planner.py +++ b/selfdrive/controls/lib/longitudinal_planner.py @@ -76,7 +76,7 @@ class LongitudinalPlanner: self.solverExecutionTime = 0.0 @staticmethod - def parse_model(model_msg, frogpilot_toggles): + def parse_model(model_msg, v_ego, frogpilot_toggles): if (len(model_msg.position.x) == ModelConstants.IDX_N and len(model_msg.velocity.x) == ModelConstants.IDX_N and len(model_msg.acceleration.x) == ModelConstants.IDX_N): @@ -95,6 +95,11 @@ class LongitudinalPlanner: throttle_prob = 1.0 # FrogPilot variables + if frogpilot_toggles.taco_tune: + max_lat_accel = np.interp(v_ego, [5, 10, 20], [1.5, 2.0, 3.0]) + curvatures = np.interp(T_IDXS_MPC, ModelConstants.T_IDXS, model_msg.orientationRate.z) / np.clip(v, 0.3, 100.0) + max_v = np.sqrt(max_lat_accel / (np.abs(curvatures) + 1e-3)) - 2.0 + v = np.minimum(max_v, v) return x, v, a, j, throttle_prob @@ -135,7 +140,7 @@ class LongitudinalPlanner: # Prevent divergence, smooth in current v_ego self.v_desired_filter.x = max(0.0, self.v_desired_filter.update(v_ego)) - x, v, a, j, throttle_prob = self.parse_model(sm['modelV2'], frogpilot_toggles) + x, v, a, j, throttle_prob = self.parse_model(sm['modelV2'], v_ego, frogpilot_toggles) # Don't clip at low speeds since throttle_prob doesn't account for creep self.allow_throttle = throttle_prob > ALLOW_THROTTLE_THRESHOLD or v_ego <= MIN_ALLOW_THROTTLE_SPEED