From 28df6990177e75193c2c5948a1277f3266dbbdb5 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 11 Jul 2025 21:55:08 -0700 Subject: [PATCH] descriptive --- selfdrive/selfdrived/alerts_offroad.json | 2 +- selfdrive/selfdrived/events.py | 2 +- selfdrive/selfdrived/selfdrived.py | 15 +++++++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/selfdrive/selfdrived/alerts_offroad.json b/selfdrive/selfdrived/alerts_offroad.json index 004f2d5b19..6a542d420a 100644 --- a/selfdrive/selfdrived/alerts_offroad.json +++ b/selfdrive/selfdrived/alerts_offroad.json @@ -46,7 +46,7 @@ "severity": 0 }, "Offroad_LateralIsoViolation": { - "text": "openpilot observed your vehicle violating standard lateral safety limits. Please contact support at https://comma.ai/support.", + "text": "openpilot observed your vehicle violating ISO 11270 lateral safety limits. Please contact support at https://comma.ai/support.", "severity": 1 } } diff --git a/selfdrive/selfdrived/events.py b/selfdrive/selfdrived/events.py index 035c049bbb..e6b4bbba68 100755 --- a/selfdrive/selfdrived/events.py +++ b/selfdrive/selfdrived/events.py @@ -761,7 +761,7 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = { 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? + ET.NO_ENTRY: NoEntryAlert("Lateral ISO Violation"), }, EventName.overheat: { diff --git a/selfdrive/selfdrived/selfdrived.py b/selfdrive/selfdrived/selfdrived.py index ea947e380b..c07db7332c 100755 --- a/selfdrive/selfdrived/selfdrived.py +++ b/selfdrive/selfdrived/selfdrived.py @@ -41,11 +41,13 @@ SafetyModel = car.CarParams.SafetyModel IGNORED_SAFETY_MODES = (SafetyModel.silent, SafetyModel.noOutput) -def check_lateral_iso_violation(active, controls_state, car_state, live_parameters): +def check_lateral_iso_violation(car_control, controls_state, car_state, live_parameters): roll_compensated_lateral_accel = controls_state.curvature * car_state.vEgo ** 2 - live_parameters.roll * ACCELERATION_DUE_TO_GRAVITY + print('roll_compensated_lateral_accel:', roll_compensated_lateral_accel) + # TODO: some temporal tolerance? - if active: + if car_control.latActive: if abs(roll_compensated_lateral_accel) > (ISO_LATERAL_ACCEL + 2): # TODO: 2x. this is to just test rn return True @@ -241,8 +243,9 @@ class SelfdriveD: if self.sm['driverAssistance'].leftLaneDeparture or self.sm['driverAssistance'].rightLaneDeparture: self.events.add(EventName.ldw) - if not self.lateral_iso_violation and check_lateral_iso_violation(self.active, self.sm['controlsState'], - self.sm['carState'], self.sm['liveParameters']): + # Check for lateral ISO violations + if not self.lateral_iso_violation and check_lateral_iso_violation(self.sm['carControl'], self.sm['controlsState'], + CS, self.sm['liveParameters']): set_offroad_alert("Offroad_LateralIsoViolation", True) self.lateral_iso_violation = True @@ -399,8 +402,8 @@ class SelfdriveD: self.events.add(EventName.personalityChanged) def data_sample(self): - car_state = messaging.recv_one(self.car_state_sock) - CS = car_state.carState if car_state else self.CS_prev + _car_state = messaging.recv_one(self.car_state_sock) + CS = _car_state.carState if _car_state else self.CS_prev self.sm.update(0)