Toyota allows you to keep your apply_steer, better control

pull/24067/head
Shane Smiskol 3 years ago
parent 443633303c
commit 04ac580fd9
  1. 14
      selfdrive/car/toyota/carcontroller.py

@ -62,18 +62,18 @@ class CarController:
# EPS_STATUS->LKA_STATE either goes to 21 or 25 on rising edge of a steering fault and
# the value seems to describe how many frames the steering rate was above 100 deg/s, so
# cut torque with some margin for the lower state
if abs(CS.out.steeringRateDeg) > STEER_FAULT_MAX_RATE:
if CC.latActive and abs(CS.out.steeringRateDeg) >= STEER_FAULT_MAX_RATE:
self.rate_limit_counter += 1
# TODO: unclear if it resets its internal state at another value
if not CC.latActive or abs(CS.out.steeringRateDeg) <= STEER_FAULT_MAX_RATE:
else:
# TODO: unclear if it resets its internal state at another value
self.rate_limit_counter = 0
# Cut steering if we're about to fault the EPS
if not CC.latActive or self.rate_limit_counter > STEER_FAULT_MAX_FRAMES:
apply_steer_req = 1
if not CC.latActive:
apply_steer = 0
apply_steer_req = 0
else:
apply_steer_req = 1
elif self.rate_limit_counter > STEER_FAULT_MAX_FRAMES:
apply_steer_req = 0
# TODO: probably can delete this. CS.pcm_acc_status uses a different signal
# than CS.cruiseState.enabled. confirm they're not meaningfully different

Loading…
Cancel
Save