From c75244ca4e9c48084b0205b7c871e1a4e0f4e693 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Mon, 6 Jan 2025 19:29:03 -0500 Subject: [PATCH] Revert "long planner: allow throttle reflects usage (#33792)" --- selfdrive/controls/lib/longitudinal_planner.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/selfdrive/controls/lib/longitudinal_planner.py b/selfdrive/controls/lib/longitudinal_planner.py index 5f47cebb1f..83296b8865 100755 --- a/selfdrive/controls/lib/longitudinal_planner.py +++ b/selfdrive/controls/lib/longitudinal_planner.py @@ -150,10 +150,9 @@ class LongitudinalPlanner: # Compute model v_ego error self.v_model_error = get_speed_error(sm['modelV2'], v_ego) x, v, a, j, throttle_prob = self.parse_model(sm['modelV2'], self.v_model_error) - # 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 <= 5.0 + self.allow_throttle = throttle_prob > ALLOW_THROTTLE_THRESHOLD - if not self.allow_throttle: + if not self.allow_throttle and v_ego > 5.0: # Don't clip at low speeds since throttle_prob doesn't account for creep # MPC breaks when accel limits would cause negative velocity within the MPC horizon, so we clip the max accel limit at vEgo/T_MAX plus a bit of margin clipped_accel_coast = max(accel_coast, accel_limits_turns[0], -v_ego / T_IDXS_MPC[-1] + ACCEL_LIMIT_MARGIN) accel_limits_turns[1] = min(accel_limits_turns[1], clipped_accel_coast)