From b10802d9a2f051a9c616c6341a170f6f340579c6 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 11 Jul 2025 21:16:27 -0700 Subject: [PATCH] build out lockout --- cereal/log.capnp | 1 + selfdrive/selfdrived/events.py | 6 ++++++ selfdrive/selfdrived/selfdrived.py | 8 ++++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/cereal/log.capnp b/cereal/log.capnp index 7f41cffa15..8fd22c9283 100644 --- a/cereal/log.capnp +++ b/cereal/log.capnp @@ -128,6 +128,7 @@ struct OnroadEvent @0xc4fa6047f024e718 { personalityChanged @91; aeb @92; userFlag @95; + lateralIsoViolation @96; soundsUnavailableDEPRECATED @47; } diff --git a/selfdrive/selfdrived/events.py b/selfdrive/selfdrived/events.py index 369685f398..035c049bbb 100755 --- a/selfdrive/selfdrived/events.py +++ b/selfdrive/selfdrived/events.py @@ -758,6 +758,12 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = { ET.NO_ENTRY: NoEntryAlert("Distraction Level Too High"), }, + EventName.lateralIsoViolation: { + # TODO: call Iso something else if we don't explain it in the offroad alert? + ET.SOFT_DISABLE: soft_disable_alert("Lateral ISO Violation"), + ET.NO_ENTRY: NoEntryAlert("Lateral ISO Violation"), # TODO: call Iso something else if we don't explain it in the offroad alert? + }, + EventName.overheat: { ET.PERMANENT: overheat_alert, ET.SOFT_DISABLE: soft_disable_alert("System Overheated"), diff --git a/selfdrive/selfdrived/selfdrived.py b/selfdrive/selfdrived/selfdrived.py index bc93b26616..719545704e 100755 --- a/selfdrive/selfdrived/selfdrived.py +++ b/selfdrive/selfdrived/selfdrived.py @@ -107,6 +107,7 @@ class SelfdriveD: self.active = False self.mismatch_counter = 0 self.cruise_mismatch_counter = 0 + self.lateral_iso_violation = False self.last_steering_pressed_frame = 0 self.distance_traveled = 0 self.last_functional_fan_frame = 0 @@ -232,9 +233,12 @@ class SelfdriveD: if self.sm['driverAssistance'].leftLaneDeparture or self.sm['driverAssistance'].rightLaneDeparture: self.events.add(EventName.ldw) - if check_lateral_iso_violation(self.sm): + if not self.lateral_iso_violation and check_lateral_iso_violation(self.sm): set_offroad_alert("Offroad_LateralIsoViolation", True) - # TODO: lockout for rest of drive like DM attention warning + self.lateral_iso_violation = True + + if self.lateral_iso_violation: + self.events.add(EventName.lateralIsoViolation) # Handle lane change if self.sm['modelV2'].meta.laneChangeState == LaneChangeState.preLaneChange: