From 98e1d840de3cb8cf801e7b23cafc5fc605550344 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 1 Oct 2024 23:06:57 -0700 Subject: [PATCH] CarState: add invalidLkasSetting (#33700) * invalidLkasSetting * clean up car specific a bit * clean this up * deprecate! * bump * this was just broken lol * updaterefs --- cereal/car.capnp | 3 ++- opendbc_repo | 2 +- selfdrive/car/car_specific.py | 9 +++------ selfdrive/selfdrived/events.py | 10 +++------- selfdrive/test/process_replay/ref_commit | 2 +- 5 files changed, 10 insertions(+), 16 deletions(-) diff --git a/cereal/car.capnp b/cereal/car.capnp index 3ef78973e..e53f3ce25 100644 --- a/cereal/car.capnp +++ b/cereal/car.capnp @@ -103,7 +103,6 @@ struct OnroadEvent @0x9b1657f34caf3ad3 { selfdriveInitializing @98; usbError @99; cruiseMismatch @106; - lkasDisabled @107; canBusMissing @111; selfdrivedLagging @112; resumeBlocked @113; @@ -150,6 +149,7 @@ struct OnroadEvent @0x9b1657f34caf3ad3 { highCpuUsageDEPRECATED @105; startupNoFwDEPRECATED @104; lowSpeedLockoutDEPRECATED @31; + lkasDisabledDEPRECATED @107; } } @@ -199,6 +199,7 @@ struct CarState { steeringPressed @9 :Bool; # if the user is using the steering wheel steerFaultTemporary @35 :Bool; # temporary EPS fault steerFaultPermanent @36 :Bool; # permanent EPS fault + invalidLkasSetting @55 :Bool; # stock LKAS is incorrectly configured (i.e. on or off) stockAeb @30 :Bool; stockFcw @31 :Bool; espDisabled @32 :Bool; diff --git a/opendbc_repo b/opendbc_repo index 2b91038bf..0cdc684e0 160000 --- a/opendbc_repo +++ b/opendbc_repo @@ -1 +1 @@ -Subproject commit 2b91038bf7f1c2287f1d32c98cd84e45cc0e243e +Subproject commit 0cdc684e097f386554bbc1a6946a4efe8bc7cfd6 diff --git a/selfdrive/car/car_specific.py b/selfdrive/car/car_specific.py index 105358800..83927a6b0 100644 --- a/selfdrive/car/car_specific.py +++ b/selfdrive/car/car_specific.py @@ -50,15 +50,10 @@ class CarSpecificEvents: elif self.CP.carName == 'nissan': events = self.create_common_events(CS.out, CS_prev, extra_gears=[GearShifter.brake]) - if CS.lkas_enabled: # type: ignore[attr-defined] - events.add(EventName.invalidLkasSetting) - elif self.CP.carName == 'mazda': events = self.create_common_events(CS.out, CS_prev) - if CS.lkas_disabled: # type: ignore[attr-defined] - events.add(EventName.lkasDisabled) - elif CS.low_speed_alert: # type: ignore[attr-defined] + if CS.low_speed_alert: # type: ignore[attr-defined] events.add(EventName.belowSteerSpeed) elif self.CP.carName == 'chrysler': @@ -211,6 +206,8 @@ class CarSpecificEvents: events.add(EventName.gasPressedOverride) if CS.vehicleSensorsInvalid: events.add(EventName.vehicleSensorsInvalid) + if CS.invalidLkasSetting: + events.add(EventName.invalidLkasSetting) # Handle button presses for b in CS.buttonEvents: diff --git a/selfdrive/selfdrived/events.py b/selfdrive/selfdrived/events.py index cb7112662..070ca60ca 100755 --- a/selfdrive/selfdrived/events.py +++ b/selfdrive/selfdrived/events.py @@ -394,8 +394,9 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = { }, EventName.invalidLkasSetting: { - ET.PERMANENT: NormalPermanentAlert("Stock LKAS is on", - "Turn off stock LKAS to engage"), + ET.PERMANENT: NormalPermanentAlert("Invalid LKAS setting", + "Toggle stock LKAS on or off to engage"), + ET.NO_ENTRY: NoEntryAlert("Invalid LKAS setting"), }, EventName.cruiseMismatch: { @@ -945,11 +946,6 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = { ET.NO_ENTRY: NoEntryAlert("Slow down to engage"), }, - EventName.lkasDisabled: { - ET.PERMANENT: NormalPermanentAlert("LKAS Disabled: Enable LKAS to engage"), - ET.NO_ENTRY: NoEntryAlert("LKAS Disabled"), - }, - EventName.vehicleSensorsInvalid: { ET.IMMEDIATE_DISABLE: ImmediateDisableAlert("Vehicle Sensors Invalid"), ET.PERMANENT: NormalPermanentAlert("Vehicle Sensors Calibrating", "Drive to Calibrate"), diff --git a/selfdrive/test/process_replay/ref_commit b/selfdrive/test/process_replay/ref_commit index 8e012f79c..30daa6e26 100644 --- a/selfdrive/test/process_replay/ref_commit +++ b/selfdrive/test/process_replay/ref_commit @@ -1 +1 @@ -2384c1fdb2db449fb6b09f5dc47b3314f4b1cfcf \ No newline at end of file +1b4480f5ebf5a4003dde22f19bbcf989294bc724 \ No newline at end of file