mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-27 00:52:05 +08:00
Toyota: prevent lagged gas after heavy braking (#1279)
This commit is contained in:
@@ -18,7 +18,9 @@ SteerControlType = car.CarParams.SteerControlType
|
||||
VisualAlert = car.CarControl.HUDControl.VisualAlert
|
||||
LongCtrlState = car.CarControl.Actuators.LongControlState
|
||||
|
||||
ACCELERATION_DUE_TO_GRAVITY = 9.81
|
||||
ACCELERATION_DUE_TO_GRAVITY = 9.81 # m/s^2
|
||||
|
||||
ACCEL_WINDUP_LIMIT = 0.5 # m/s^2 / frame
|
||||
|
||||
# LKA limits
|
||||
# EPS faults if you apply torque while the steering rate is above 100 deg/s for too long
|
||||
@@ -231,9 +233,8 @@ class CarController(CarControllerBase):
|
||||
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
|
||||
# internal PCM gas command can get stuck unwinding from negative accel so we apply a generous rate limit
|
||||
pcm_accel_cmd = min(pcm_accel_cmd, self.accel + ACCEL_WINDUP_LIMIT) if CC.longActive else 0.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, reverse_acc))
|
||||
|
||||
Reference in New Issue
Block a user