No lkas block logic

Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>
This commit is contained in:
Jafar Al-Gharaibeh
2021-12-03 00:39:27 -06:00
parent 49f8ce1715
commit 3969530804
+6 -12
View File
@@ -3,7 +3,7 @@ from selfdrive.config import Conversions as CV
from opendbc.can.can_define import CANDefine
from opendbc.can.parser import CANParser
from selfdrive.car.interfaces import CarStateBase
from selfdrive.car.mazda.values import DBC, LKAS_LIMITS, GEN1, TI_STATE
from selfdrive.car.mazda.values import DBC, LKAS_LIMITS, GEN1, TI_STATE, CAR
class CarState(CarStateBase):
def __init__(self, CP):
@@ -14,7 +14,6 @@ class CarState(CarStateBase):
self.crz_btns_counter = 0
self.acc_active_last = False
self.low_speed_alert = False
self.lkas_allowed_speed = False
self.lkas_disabled = False
@@ -100,16 +99,11 @@ class CarState(CarStateBase):
ret.cruiseState.enabled = cp.vl["CRZ_CTRL"]["CRZ_ACTIVE"] == 1
ret.cruiseState.speed = cp.vl["CRZ_EVENTS"]["CRZ_SPEED"] * CV.KPH_TO_MS
if ret.cruiseState.enabled:
if not self.lkas_allowed_speed and self.acc_active_last:
self.low_speed_alert = True
else:
self.low_speed_alert = False
# Check if LKAS is disabled due to lack of driver torque when all other states indicate
# it should be enabled (steer lockout). Don't warn until we actually get lkas active
# and lose it again, i.e, after initial lkas activation
ret.steerWarning = self.lkas_allowed_speed and lkas_blocked
# On if no driver torque the last 5 seconds
if self.CP.carFingerprint not in (CAR.CX5_2022, CAR.CX9_2021):
ret.steerWarning = cp.vl["STEER_RATE"]["HANDS_OFF_5_SECONDS"] == 1
else:
ret.steerWarning = False
self.acc_active_last = ret.cruiseState.enabled