mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-05 00:05:59 +08:00
No lkas block logic
Signed-off-by: Jafar Al-Gharaibeh <to.jafar@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user