comma's steering speed hack from their 2022 Taco Bell Run

https://github.com/commaai/openpilot/commit/1801a14f85c93b3e1c461ddc5c552523bc8baffa
This commit is contained in:
Adeeb Shihadeh
2025-12-01 12:00:00 -07:00
committed by James
parent f25cb9bd7c
commit 186c1a17f3
@@ -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