mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-01 03:22:07 +08:00
Use CP.vEgoStopping and clean up CP.startAccel (#22199)
* use CP.vEgoStopping and clean up * update ref old-commit-hash: 1e62b09e5dd70cae6721d2da9f7bcef59aa87c10
This commit is contained in:
@@ -105,8 +105,6 @@ class CarInterface(CarInterfaceBase):
|
||||
ret.longitudinalTuning.kiBP = [0.]
|
||||
ret.longitudinalTuning.kiV = [0.36]
|
||||
|
||||
ret.startAccel = 0.8
|
||||
|
||||
ret.steerLimitTimer = 0.4
|
||||
ret.radarTimeStep = 0.0667 # GM radar runs at 15Hz instead of standard 20Hz
|
||||
|
||||
|
||||
@@ -291,8 +291,6 @@ class CarInterface(CarInterfaceBase):
|
||||
ret.tireStiffnessFront, ret.tireStiffnessRear = scale_tire_stiffness(ret.mass, ret.wheelbase, ret.centerToFront,
|
||||
tire_stiffness_factor=tire_stiffness_factor)
|
||||
|
||||
ret.startAccel = 0.5
|
||||
|
||||
ret.steerActuatorDelay = 0.1
|
||||
ret.steerRateCost = 0.5
|
||||
ret.steerLimitTimer = 0.8
|
||||
|
||||
@@ -22,8 +22,6 @@ class CarInterface(CarInterfaceBase):
|
||||
ret.steerLimitTimer = 0.4
|
||||
tire_stiffness_factor = 1.
|
||||
|
||||
ret.startAccel = 1.0
|
||||
|
||||
if candidate == CAR.SANTA_FE:
|
||||
ret.lateralTuning.pid.kf = 0.00005
|
||||
ret.mass = 3982. * CV.LB_TO_KG + STD_CARGO_KG
|
||||
|
||||
@@ -72,10 +72,10 @@ class CarInterfaceBase():
|
||||
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.openpilotLongitudinalControl = False
|
||||
ret.startAccel = 0.0
|
||||
ret.minSpeedCan = 0.3
|
||||
ret.stoppingDecelRate = 0.8 # brake_travel/s while trying to stop
|
||||
ret.startingAccelRate = 3.2 # brake_travel/s while releasing on restart
|
||||
ret.vEgoStopping = 0.5
|
||||
ret.stoppingControl = True
|
||||
ret.longitudinalTuning.deadzoneBP = [0.]
|
||||
ret.longitudinalTuning.deadzoneV = [0.]
|
||||
|
||||
@@ -330,7 +330,6 @@ class CarInterface(CarInterfaceBase):
|
||||
ret.longitudinalTuning.kiV = [.35, .23, .20, .17, .1]
|
||||
ret.stoppingDecelRate = 0.3 # reach stopping target smoothly
|
||||
ret.startingAccelRate = 6.0 # release brakes fast
|
||||
ret.startAccel = 1.2 # Accelerate from 0 faster
|
||||
else:
|
||||
# Default longitudinal tune
|
||||
ret.longitudinalTuning.deadzoneBP = [0., 9.]
|
||||
|
||||
@@ -6,7 +6,6 @@ from selfdrive.modeld.constants import T_IDXS
|
||||
|
||||
LongCtrlState = car.CarControl.Actuators.LongControlState
|
||||
|
||||
STOPPING_EGO_SPEED = 0.5
|
||||
STOPPING_TARGET_SPEED_OFFSET = 0.01
|
||||
STARTING_TARGET_SPEED = 0.5
|
||||
DECEL_THRESHOLD_TO_PID = 0.8
|
||||
@@ -20,13 +19,12 @@ ACCEL_MIN_ISO = -3.5 # m/s^2
|
||||
ACCEL_MAX_ISO = 2.0 # m/s^2
|
||||
|
||||
|
||||
# TODO this logic isn't really car independent, does not belong here
|
||||
def long_control_state_trans(active, long_control_state, v_ego, v_target, v_pid,
|
||||
def long_control_state_trans(CP, active, long_control_state, v_ego, v_target, v_pid,
|
||||
output_accel, brake_pressed, cruise_standstill, min_speed_can):
|
||||
"""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 \
|
||||
(v_ego < STOPPING_EGO_SPEED and
|
||||
(v_ego < CP.vEgoStopping and
|
||||
((v_pid < stopping_target_speed and v_target < stopping_target_speed) or
|
||||
brake_pressed))
|
||||
|
||||
@@ -93,7 +91,7 @@ class LongControl():
|
||||
|
||||
# Update state machine
|
||||
output_accel = self.last_output_accel
|
||||
self.long_control_state = long_control_state_trans(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,
|
||||
CS.brakePressed, CS.cruiseState.standstill, CP.minSpeedCan)
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
f489c4e160cebde60907d3cd2bfbc06bd9d33aad
|
||||
65c39ad66072b5106399605761c48e6cad0ee3a5
|
||||
Reference in New Issue
Block a user