From 423de1223b68546c34d80f681a0c1bf7395c10c2 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 15 Nov 2024 02:57:04 -0600 Subject: [PATCH] Toyota: fix acceleration rate limit (#1490) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit oof 🤦 --- opendbc/car/toyota/carcontroller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/toyota/carcontroller.py b/opendbc/car/toyota/carcontroller.py index a83af997..57878798 100644 --- a/opendbc/car/toyota/carcontroller.py +++ b/opendbc/car/toyota/carcontroller.py @@ -178,6 +178,7 @@ class CarController(CarControllerBase): pcm_accel_cmd = actuators.accel if CC.longActive: pcm_accel_cmd = rate_limit(pcm_accel_cmd, self.prev_accel, ACCEL_WINDDOWN_LIMIT, ACCEL_WINDUP_LIMIT) + self.prev_accel = pcm_accel_cmd # calculate amount of acceleration PCM should apply to reach target, given pitch accel_due_to_pitch = math.sin(CC.orientationNED[1]) * ACCELERATION_DUE_TO_GRAVITY if len(CC.orientationNED) == 3 else 0.0 @@ -212,7 +213,6 @@ class CarController(CarControllerBase): can_sends.append(toyotacan.create_accel_command(self.packer, pcm_accel_cmd, pcm_cancel_cmd, self.permit_braking, self.standstill_req, lead, CS.acc_type, fcw_alert, self.distance_button)) self.accel = pcm_accel_cmd - self.prev_accel = actuators.accel else: # we can spam can to cancel the system even if we are using lat only control