|
|
@ -88,15 +88,15 @@ class CarController: |
|
|
|
# STEERING_LTA does not seem to allow more rate by sending faster, and may wind up easier |
|
|
|
# STEERING_LTA does not seem to allow more rate by sending faster, and may wind up easier |
|
|
|
if self.frame % 2 == 0 and self.CP.carFingerprint in TSS2_CAR: |
|
|
|
if self.frame % 2 == 0 and self.CP.carFingerprint in TSS2_CAR: |
|
|
|
lta_active = lat_active and self.CP.steerControlType == SteerControlType.angle |
|
|
|
lta_active = lat_active and self.CP.steerControlType == SteerControlType.angle |
|
|
|
# cut steering torque with SETME_X64 when either EPS torque or driver torque is above |
|
|
|
# cut steering torque with TORQUE_WIND_DOWN when either EPS torque or driver torque is above |
|
|
|
# the threshold, to limit max lateral acceleration and for driver torque blending respectively. |
|
|
|
# the threshold, to limit max lateral acceleration and for driver torque blending respectively. |
|
|
|
full_torque_condition = (abs(CS.out.steeringTorqueEps) < self.params.STEER_MAX and |
|
|
|
full_torque_condition = (abs(CS.out.steeringTorqueEps) < self.params.STEER_MAX and |
|
|
|
abs(CS.out.steeringTorque) < MAX_LTA_DRIVER_TORQUE_ALLOWANCE) |
|
|
|
abs(CS.out.steeringTorque) < MAX_LTA_DRIVER_TORQUE_ALLOWANCE) |
|
|
|
|
|
|
|
|
|
|
|
# SETME_X64 at 0 ramps down torque at roughly the max down rate of 1500 units/sec |
|
|
|
# TORQUE_WIND_DOWN at 0 ramps down torque at roughly the max down rate of 1500 units/sec |
|
|
|
setme_x64 = 100 if lta_active and full_torque_condition else 0 |
|
|
|
torque_wind_down = 100 if lta_active and full_torque_condition else 0 |
|
|
|
can_sends.append(toyotacan.create_lta_steer_command(self.packer, self.CP.steerControlType, self.last_angle, |
|
|
|
can_sends.append(toyotacan.create_lta_steer_command(self.packer, self.CP.steerControlType, self.last_angle, |
|
|
|
lta_active, self.frame // 2, setme_x64)) |
|
|
|
lta_active, self.frame // 2, torque_wind_down)) |
|
|
|
|
|
|
|
|
|
|
|
# *** gas and brake *** |
|
|
|
# *** gas and brake *** |
|
|
|
if self.CP.enableGasInterceptor and CC.longActive: |
|
|
|
if self.CP.enableGasInterceptor and CC.longActive: |
|
|
|