mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-10-01 03:43:51 +08:00
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:
@@ -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])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user