From 3e239def4b5391388e52a73251eb1cea854fa6a1 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 1 Oct 2024 17:12:04 -0700 Subject: [PATCH] structs: add lkasEnabled and lkasDisabled (#1317) * add lkasEnabled and lkasDisabled * not sure --- opendbc/car/mazda/carstate.py | 4 ++-- opendbc/car/nissan/carstate.py | 5 +++-- opendbc/car/structs.py | 2 ++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/opendbc/car/mazda/carstate.py b/opendbc/car/mazda/carstate.py index 7e69beb1..1f386a9f 100644 --- a/opendbc/car/mazda/carstate.py +++ b/opendbc/car/mazda/carstate.py @@ -19,7 +19,6 @@ class CarState(CarStateBase): self.acc_active_last = False self.low_speed_alert = False self.lkas_allowed_speed = False - self.lkas_disabled = False self.distance_button = 0 @@ -107,7 +106,8 @@ class CarState(CarStateBase): self.crz_btns_counter = cp.vl["CRZ_BTNS"]["CTR"] # camera signals - self.lkas_disabled = cp_cam.vl["CAM_LANEINFO"]["LANE_LINES"] == 0 + # TODO: is this needed anymore? + ret.lkasDisabled = cp_cam.vl["CAM_LANEINFO"]["LANE_LINES"] == 0 self.cam_lkas = cp_cam.vl["CAM_LKAS"] self.cam_laneinfo = cp_cam.vl["CAM_LANEINFO"] ret.steerFaultPermanent = cp_cam.vl["CAM_LKAS"]["ERR_BIT_1"] == 1 diff --git a/opendbc/car/nissan/carstate.py b/opendbc/car/nissan/carstate.py index 040fb193..f25ef17f 100644 --- a/opendbc/car/nissan/carstate.py +++ b/opendbc/car/nissan/carstate.py @@ -109,10 +109,11 @@ class CarState(CarStateBase): can_gear = int(cp.vl["GEARBOX"]["GEAR_SHIFTER"]) ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(can_gear, None)) + # TODO: is this needed anymore? if self.CP.carFingerprint == CAR.NISSAN_ALTIMA: - self.lkas_enabled = bool(cp.vl["LKAS_SETTINGS"]["LKAS_ENABLED"]) + ret.lkasEnabled = bool(cp.vl["LKAS_SETTINGS"]["LKAS_ENABLED"]) else: - self.lkas_enabled = bool(cp_adas.vl["LKAS_SETTINGS"]["LKAS_ENABLED"]) + ret.lkasEnabled = bool(cp_adas.vl["LKAS_SETTINGS"]["LKAS_ENABLED"]) self.cruise_throttle_msg = copy.copy(cp.vl["CRUISE_THROTTLE"]) diff --git a/opendbc/car/structs.py b/opendbc/car/structs.py index c140d62a..5dd920ba 100644 --- a/opendbc/car/structs.py +++ b/opendbc/car/structs.py @@ -75,6 +75,8 @@ class CarState: steeringPressed: bool = auto_field() # if the user is using the steering wheel steerFaultTemporary: bool = auto_field() # temporary EPS fault steerFaultPermanent: bool = auto_field() # permanent EPS fault + lkasDisabled: bool = auto_field() # LKAS being enabled is required to control car + lkasEnabled: bool = auto_field() # LKAS being disabled is required to control car stockAeb: bool = auto_field() stockFcw: bool = auto_field() espDisabled: bool = auto_field()