From 0b7648ad2cb048b5f55a338dbd26cada01671124 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 20 Sep 2024 20:46:59 -0700 Subject: [PATCH] Toyota: don't apply PCM compensation in the stopping state (#1264) check inside so we ramp down smoothly not cut out compensation --- opendbc/car/toyota/carcontroller.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/opendbc/car/toyota/carcontroller.py b/opendbc/car/toyota/carcontroller.py index 89a31941..d2ab902f 100644 --- a/opendbc/car/toyota/carcontroller.py +++ b/opendbc/car/toyota/carcontroller.py @@ -10,6 +10,7 @@ from opendbc.car.toyota.values import CAR, STATIC_DSU_MSGS, NO_STOP_TIMER_CAR, T UNSUPPORTED_DSU_CAR from opendbc.can.packer import CANPacker +LongCtrlState = structs.CarControl.Actuators.LongControlState SteerControlType = structs.CarParams.SteerControlType VisualAlert = structs.CarControl.HUDControl.VisualAlert @@ -111,7 +112,10 @@ class CarController(CarControllerBase): accel_due_to_pitch = math.sin(CS.slope_angle) * ACCELERATION_DUE_TO_GRAVITY net_acceleration_request = actuators.accel + accel_due_to_pitch - pcm_accel_compensation = 2.0 * (CS.pcm_accel_net - net_acceleration_request) + # let PCM handle stopping for now + pcm_accel_compensation = 0.0 + if actuators.longControlState != LongCtrlState.stopping: + pcm_accel_compensation = 2.0 * (CS.pcm_accel_net - net_acceleration_request) # prevent compensation windup pcm_accel_compensation = clip(pcm_accel_compensation, actuators.accel - self.params.ACCEL_MAX,