Remove minSpeedCan (#22991)

* Remove minCanSpeed

Remove minCanSpeed

* it actually only goes out to 2.5 seconds, this is okay to remove

* test to see if this preserves behavior

add minSpeedCan

* Revert "test to see if this preserves behavior"

This reverts commit 31b11f017f7e9da7654fc8064b5983d4a6cc22e5.

* preserve behavior (don't enter stopping as early)

* vEgoStopping needs to be less than or equal to vEgoStarting to avoid state oscillation
old-commit-hash: 2799ef5292
commatwo_master
Shane Smiskol 3 years ago committed by GitHub
parent 01eb405677
commit 91ff6918e5
  1. 1
      selfdrive/car/interfaces.py
  2. 15
      selfdrive/controls/lib/longcontrol.py

@ -82,7 +82,6 @@ class CarInterfaceBase():
ret.minEnableSpeed = -1. # enable is done by stock ACC, so ignore this ret.minEnableSpeed = -1. # enable is done by stock ACC, so ignore this
ret.steerRatioRear = 0. # no rear steering, at least on the listed cars aboveA ret.steerRatioRear = 0. # no rear steering, at least on the listed cars aboveA
ret.openpilotLongitudinalControl = False ret.openpilotLongitudinalControl = False
ret.minSpeedCan = 0.3
ret.startAccel = -0.8 ret.startAccel = -0.8
ret.stopAccel = -2.0 ret.stopAccel = -2.0
ret.startingAccelRate = 3.2 # brake_travel/s while releasing on restart ret.startingAccelRate = 3.2 # brake_travel/s while releasing on restart

@ -7,21 +7,17 @@ from selfdrive.modeld.constants import T_IDXS
LongCtrlState = car.CarControl.Actuators.LongControlState LongCtrlState = car.CarControl.Actuators.LongControlState
STOPPING_TARGET_SPEED_OFFSET = 0.01
# As per ISO 15622:2018 for all speeds # As per ISO 15622:2018 for all speeds
ACCEL_MIN_ISO = -3.5 # m/s^2 ACCEL_MIN_ISO = -3.5 # m/s^2
ACCEL_MAX_ISO = 2.0 # m/s^2 ACCEL_MAX_ISO = 2.0 # m/s^2
def long_control_state_trans(CP, active, long_control_state, v_ego, v_target_future, v_pid, def long_control_state_trans(CP, active, long_control_state, v_ego, v_target_future,
output_accel, brake_pressed, cruise_standstill, min_speed_can): output_accel, brake_pressed, cruise_standstill):
"""Update longitudinal control state machine""" """Update longitudinal control state machine"""
stopping_target_speed = min_speed_can + STOPPING_TARGET_SPEED_OFFSET
stopping_condition = (v_ego < 2.0 and cruise_standstill) or \ stopping_condition = (v_ego < 2.0 and cruise_standstill) or \
(v_ego < CP.vEgoStopping and (v_ego < CP.vEgoStopping and
((v_pid < stopping_target_speed and v_target_future < stopping_target_speed) or (v_target_future < CP.vEgoStopping or brake_pressed))
brake_pressed))
starting_condition = v_target_future > CP.vEgoStarting and not cruise_standstill starting_condition = v_target_future > CP.vEgoStarting and not cruise_standstill
@ -91,8 +87,8 @@ class LongControl():
# Update state machine # Update state machine
output_accel = self.last_output_accel output_accel = self.last_output_accel
self.long_control_state = long_control_state_trans(CP, active, self.long_control_state, CS.vEgo, self.long_control_state = long_control_state_trans(CP, active, self.long_control_state, CS.vEgo,
v_target_future, self.v_pid, output_accel, v_target_future, output_accel,
CS.brakePressed, CS.cruiseState.standstill, CP.minSpeedCan) CS.brakePressed, CS.cruiseState.standstill)
if self.long_control_state == LongCtrlState.off or CS.gasPressed: if self.long_control_state == LongCtrlState.off or CS.gasPressed:
self.reset(CS.vEgo) self.reset(CS.vEgo)
@ -119,7 +115,6 @@ class LongControl():
if not CS.standstill or output_accel > CP.stopAccel: if not CS.standstill or output_accel > CP.stopAccel:
output_accel -= CP.stoppingDecelRate * DT_CTRL output_accel -= CP.stoppingDecelRate * DT_CTRL
output_accel = clip(output_accel, accel_limits[0], accel_limits[1]) output_accel = clip(output_accel, accel_limits[0], accel_limits[1])
self.reset(CS.vEgo) self.reset(CS.vEgo)
# Intention is to move again, release brake fast before handing control to PID # Intention is to move again, release brake fast before handing control to PID

Loading…
Cancel
Save