revert useless

pull/35043/head
Bruce Wayne 5 days ago
parent ed555cb948
commit fcc771b9ce
  1. 6
      selfdrive/controls/lib/longitudinal_planner.py

@ -52,6 +52,7 @@ class LongitudinalPlanner:
def __init__(self, CP, init_v=0.0, init_a=0.0, dt=DT_MDL): def __init__(self, CP, init_v=0.0, init_a=0.0, dt=DT_MDL):
self.CP = CP self.CP = CP
self.mpc = LongitudinalMpc(dt=dt) self.mpc = LongitudinalMpc(dt=dt)
self.mpc.mode = 'acc'
self.fcw = False self.fcw = False
self.dt = dt self.dt = dt
self.allow_throttle = True self.allow_throttle = True
@ -89,7 +90,6 @@ class LongitudinalPlanner:
return x, v, a, j, throttle_prob return x, v, a, j, throttle_prob
def update(self, sm): def update(self, sm):
self.mpc.mode = 'acc'
self.mode = 'blended' if sm['selfdriveState'].experimentalMode else 'acc' self.mode = 'blended' if sm['selfdriveState'].experimentalMode else 'acc'
if len(sm['carControl'].orientationNED) == 3: if len(sm['carControl'].orientationNED) == 3:
@ -97,7 +97,7 @@ class LongitudinalPlanner:
else: else:
accel_coast = ACCEL_MAX accel_coast = ACCEL_MAX
v_ego = sm['modelV2'].velocity.x[0] v_ego = sm['carState'].vEgo
v_cruise_kph = min(sm['carState'].vCruise, V_CRUISE_MAX) v_cruise_kph = min(sm['carState'].vCruise, V_CRUISE_MAX)
v_cruise = v_cruise_kph * CV.KPH_TO_MS v_cruise = v_cruise_kph * CV.KPH_TO_MS
v_cruise_initialized = sm['carState'].vCruise != V_CRUISE_UNSET v_cruise_initialized = sm['carState'].vCruise != V_CRUISE_UNSET
@ -129,7 +129,7 @@ class LongitudinalPlanner:
self.v_desired_filter.x = max(0.0, self.v_desired_filter.update(v_ego)) self.v_desired_filter.x = max(0.0, self.v_desired_filter.update(v_ego))
# 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'], 0) 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 # 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 self.allow_throttle = throttle_prob > ALLOW_THROTTLE_THRESHOLD or v_ego <= MIN_ALLOW_THROTTLE_SPEED

Loading…
Cancel
Save