Toyota: fix acceleration rate limit (#1490)

oof 🤦
This commit is contained in:
Shane Smiskol 2024-11-15 02:57:04 -06:00 committed by GitHub
parent 40951c19ee
commit 423de1223b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -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