From f2c4bb7365cad8c2209ccdf1a4d16a3dd030d065 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Mon, 23 Sep 2024 20:56:07 -0700 Subject: [PATCH] Lexus: prevent lagged gas after heavy braking (#1266) * fix slow gas after heavy braking * only target this specific case * better comment * Update opendbc/car/toyota/carcontroller.py --- opendbc/car/toyota/carcontroller.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/opendbc/car/toyota/carcontroller.py b/opendbc/car/toyota/carcontroller.py index d2ab902faf..48c8e434cc 100644 --- a/opendbc/car/toyota/carcontroller.py +++ b/opendbc/car/toyota/carcontroller.py @@ -158,6 +158,10 @@ def update(self, CC, CS, now_nanos): if pcm_cancel_cmd and self.CP.carFingerprint in UNSUPPORTED_DSU_CAR: can_sends.append(toyotacan.create_acc_cancel_command(self.packer)) elif self.CP.openpilotLongitudinalControl: + # internal PCM gas command can get stuck unwinding from negative accel. send one frame of zero when transitioning from braking to gas + if pcm_accel_cmd > 0 > self.accel and abs(pcm_accel_cmd - self.accel) > 0.5: + pcm_accel_cmd = 0 + can_sends.append(toyotacan.create_accel_command(self.packer, pcm_accel_cmd, pcm_cancel_cmd, self.standstill_req, lead, CS.acc_type, fcw_alert, self.distance_button)) self.accel = pcm_accel_cmd