long planner: allow throttle reflects usage (#33792)

* UI is now accurate

* update refs
pull/33794/head
Shane Smiskol 6 months ago committed by GitHub
parent 9674c7b5af
commit af727d41bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      selfdrive/controls/lib/longitudinal_planner.py
  2. 2
      selfdrive/test/process_replay/ref_commit

@ -146,9 +146,10 @@ class LongitudinalPlanner:
# Compute model v_ego error # Compute model v_ego error
self.v_model_error = get_speed_error(sm['modelV2'], v_ego) 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) x, v, a, j, throttle_prob = self.parse_model(sm['modelV2'], self.v_model_error)
self.allow_throttle = throttle_prob > ALLOW_THROTTLE_THRESHOLD # 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
if not self.allow_throttle and v_ego > 5.0: # Don't clip at low speeds since throttle_prob doesn't account for creep if not self.allow_throttle:
# 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 # 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) 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) accel_limits_turns[1] = min(accel_limits_turns[1], clipped_accel_coast)

@ -1 +1 @@
36bb37715542677db4a42464128ca10968f2c589 4e595fcc2e8e4ef1564d915f697ddd9334067a7f
Loading…
Cancel
Save