Longcontrol: remove starting state (#23328)

* remove starting state

* new ref

* ready for merge

* try this

* cereal now on master

Co-authored-by: Harald Schafer <harald.the.engineer@gmail.com>
This commit is contained in:
Shane Smiskol
2022-01-04 16:40:39 -07:00
committed by GitHub
parent 0357cf2af0
commit cf9792dc53
9 changed files with 8 additions and 26 deletions
+3 -15
View File
@@ -13,7 +13,7 @@ ACCEL_MAX_ISO = 2.0 # m/s^2
def long_control_state_trans(CP, active, long_control_state, v_ego, v_target_future,
output_accel, brake_pressed, cruise_standstill):
brake_pressed, cruise_standstill):
"""Update longitudinal control state machine"""
stopping_condition = (v_ego < 2.0 and cruise_standstill) or \
(v_ego < CP.vEgoStopping and
@@ -35,12 +35,6 @@ def long_control_state_trans(CP, active, long_control_state, v_ego, v_target_fut
elif long_control_state == LongCtrlState.stopping:
if starting_condition:
long_control_state = LongCtrlState.starting
elif long_control_state == LongCtrlState.starting:
if stopping_condition:
long_control_state = LongCtrlState.stopping
elif output_accel >= CP.startAccel:
long_control_state = LongCtrlState.pid
return long_control_state
@@ -88,8 +82,8 @@ class LongControl():
# Update state machine
output_accel = self.last_output_accel
self.long_control_state = long_control_state_trans(CP, active, self.long_control_state, CS.vEgo,
v_target_future, output_accel,
CS.brakePressed, CS.cruiseState.standstill)
v_target_future, CS.brakePressed,
CS.cruiseState.standstill)
if self.long_control_state == LongCtrlState.off or CS.gasPressed:
self.reset(CS.vEgo)
@@ -118,12 +112,6 @@ class LongControl():
output_accel = clip(output_accel, accel_limits[0], accel_limits[1])
self.reset(CS.vEgo)
# Intention is to move again, release brake fast before handing control to PID
elif self.long_control_state == LongCtrlState.starting:
if output_accel < CP.startAccel:
output_accel += CP.startingAccelRate * DT_CTRL
self.reset(CS.vEgo)
self.last_output_accel = output_accel
final_accel = clip(output_accel, accel_limits[0], accel_limits[1])