Corolla TSS2: support new Toyota tune (#1513)

* local changes

* we do need a pid after all

https://connect.comma.ai/a2bddce0b6747e10/00000477--adee1464ae/532/570

* back

* local changes

* hmmm

* add line

* 0.5

* probably can always be 0.35

* no debug

---------

Co-authored-by: Comma Device <device@comma.ai>
This commit is contained in:
Shane Smiskol 2024-11-21 22:10:11 -06:00 committed by GitHub
parent b4e8a4970f
commit c04557c8ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -20,7 +20,7 @@ VisualAlert = structs.CarControl.HUDControl.VisualAlert
# The up limit allows the brakes/gas to unwind quickly leaving a stop,
# the down limit roughly matches the rate of ACCEL_NET, reducing PCM compensation windup
ACCEL_WINDUP_LIMIT = 0.5 # m/s^2 / frame
ACCEL_WINDUP_LIMIT = 6.0 * DT_CTRL * 3 # m/s^2 / frame
ACCEL_WINDDOWN_LIMIT = -4.0 * DT_CTRL * 3 # m/s^2 / frame
# LKA limits
@ -51,7 +51,6 @@ class CarController(CarControllerBase):
self.distance_button = 0
self.pitch = FirstOrderFilter(0, 0.5, DT_CTRL)
self.net_acceleration_request = FirstOrderFilter(0, 0.15, DT_CTRL * 3)
self.accel_pid = PIDController(2.0, 0.5, 1 / (DT_CTRL * 3))
self.pcm_accel_compensation = FirstOrderFilter(0, 0.5, DT_CTRL * 3)
@ -63,8 +62,10 @@ class CarController(CarControllerBase):
# so we error correct on the filtered PCM acceleration request using the actuator delay.
# TODO: move the delay into the interface
self.pcm_accel_net = FirstOrderFilter(0, self.CP.longitudinalActuatorDelay, DT_CTRL * 3)
self.net_acceleration_request = FirstOrderFilter(0, 0.15, DT_CTRL * 3)
if not any(fw.ecu == Ecu.hybrid for fw in self.CP.carFw):
self.pcm_accel_net.update_alpha(self.CP.longitudinalActuatorDelay + 0.2)
self.net_acceleration_request.update_alpha(self.CP.longitudinalActuatorDelay + 0.2)
self.packer = CANPacker(dbc_names[Bus.pt])
self.accel = 0

View File

@ -47,7 +47,7 @@ class CarInterface(CarInterfaceBase):
found_ecus = [fw.ecu for fw in car_fw]
ret.enableDsu = len(found_ecus) > 0 and Ecu.dsu not in found_ecus and candidate not in (NO_DSU_CAR | UNSUPPORTED_DSU_CAR)
if candidate == CAR.LEXUS_ES_TSS2 and Ecu.hybrid not in found_ecus:
if candidate in (CAR.LEXUS_ES_TSS2, CAR.TOYOTA_COROLLA_TSS2) and Ecu.hybrid not in found_ecus:
ret.flags |= ToyotaFlags.RAISED_ACCEL_LIMIT.value
if candidate == CAR.TOYOTA_PRIUS: