Toyota: set permit braking when stopping (#1447)

* we need to brake when stopping always

* stopping
This commit is contained in:
Shane Smiskol 2024-11-06 16:59:29 -06:00 committed by GitHub
parent 6be3d04493
commit f090bf6fa2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 2 deletions

View File

@ -56,6 +56,7 @@ class CarController(CarControllerBase):
def update(self, CC, CS, now_nanos):
actuators = CC.actuators
stopping = actuators.longControlState == LongCtrlState.stopping
hud_control = CC.hudControl
pcm_cancel_cmd = CC.cruiseControl.cancel
lat_active = CC.latActive and abs(CS.out.steeringTorque) < MAX_USER_TORQUE
@ -155,7 +156,7 @@ class CarController(CarControllerBase):
# let PCM handle stopping for now
pcm_accel_compensation = 0.0
if actuators.longControlState != LongCtrlState.stopping:
if not stopping:
pcm_accel_compensation = 2.0 * (CS.pcm_accel_net - net_acceleration_request)
# prevent compensation windup
@ -167,7 +168,7 @@ class CarController(CarControllerBase):
# Along with rate limiting positive jerk below, this greatly improves gas response time
# Consider the net acceleration request that the PCM should be applying (pitch included)
if net_acceleration_request < 0.1:
if net_acceleration_request < 0.1 or stopping:
self.permit_braking = True
elif net_acceleration_request > 0.2:
self.permit_braking = False