Toyota: remove 100°/sec steering lockout (#24067)

* try a method to kill those faults

* cut torque for 1 frame

* sign doesn't seem to matter

* clean up

* better name

* Toyota allows you to keep your apply_steer, better control

* the logic was wrong entire time?

* cut steer for two frames

* Revert "cut steer for two frames"

This reverts commit 13a68ecc56.

* better variable names and comments

better variable names and comments

* should be good

* add safety

* actual number of frames

* constant

* bump panda

* bump panda

* bump panda

* bump panda

* bump panda

* bump panda

* bump panda

* fix to use min valid frames

* rm line

* simplify check

* bump panda

* bump panda to master
pull/25687/head
Shane Smiskol 3 years ago committed by GitHub
parent 719d5f7856
commit 50d117ed9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      panda
  2. 17
      selfdrive/car/toyota/carcontroller.py

@ -1 +1 @@
Subproject commit 13d64d4cc38295401ff1ffcf6a233a4b9625fd9f Subproject commit 0ca23b67786d0fa2a3162371aadeca52d24a8958

@ -10,6 +10,10 @@ from opendbc.can.packer import CANPacker
VisualAlert = car.CarControl.HUDControl.VisualAlert VisualAlert = car.CarControl.HUDControl.VisualAlert
# constants for fault workaround
MAX_STEER_RATE = 100 # deg/s
MAX_STEER_RATE_FRAMES = 18 # control frames allowed where steering rate >= MAX_STEER_RATE
class CarController: class CarController:
def __init__(self, dbc_name, CP, VM): def __init__(self, dbc_name, CP, VM):
@ -20,6 +24,7 @@ class CarController:
self.alert_active = False self.alert_active = False
self.last_standstill = False self.last_standstill = False
self.standstill_req = False self.standstill_req = False
self.steer_rate_counter = 0
self.packer = CANPacker(dbc_name) self.packer = CANPacker(dbc_name)
self.gas = 0 self.gas = 0
@ -52,11 +57,19 @@ class CarController:
new_steer = int(round(actuators.steer * CarControllerParams.STEER_MAX)) new_steer = int(round(actuators.steer * CarControllerParams.STEER_MAX))
apply_steer = apply_toyota_steer_torque_limits(new_steer, self.last_steer, CS.out.steeringTorqueEps, self.torque_rate_limits) apply_steer = apply_toyota_steer_torque_limits(new_steer, self.last_steer, CS.out.steeringTorqueEps, self.torque_rate_limits)
# Count up to MAX_STEER_RATE_FRAMES, at which point we need to cut torque to avoid a steering fault
if CC.latActive and abs(CS.out.steeringRateDeg) >= MAX_STEER_RATE:
self.steer_rate_counter += 1
else:
self.steer_rate_counter = 0
apply_steer_req = 1
if not CC.latActive: if not CC.latActive:
apply_steer = 0 apply_steer = 0
apply_steer_req = 0 apply_steer_req = 0
else: elif self.steer_rate_counter > MAX_STEER_RATE_FRAMES:
apply_steer_req = 1 apply_steer_req = 0
self.steer_rate_counter = 0
# TODO: probably can delete this. CS.pcm_acc_status uses a different signal # TODO: probably can delete this. CS.pcm_acc_status uses a different signal
# than CS.cruiseState.enabled. confirm they're not meaningfully different # than CS.cruiseState.enabled. confirm they're not meaningfully different

Loading…
Cancel
Save