From 7346bda6f022a208e2cef277eaf61fff640e755b Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 30 Aug 2022 17:44:41 -0700 Subject: [PATCH] lateral overriding is overriding --- cereal | 2 +- selfdrive/car/interfaces.py | 2 ++ selfdrive/controls/controlsd.py | 12 ++++++------ selfdrive/controls/lib/events.py | 13 +++++++++++-- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/cereal b/cereal index c4cc38c468..8f9885b972 160000 --- a/cereal +++ b/cereal @@ -1 +1 @@ -Subproject commit c4cc38c4689b5e06be1cbfbb26c0463c377c0a6d +Subproject commit 8f9885b9726cd2784db6886dd4ce01688b5ba732 diff --git a/selfdrive/car/interfaces.py b/selfdrive/car/interfaces.py index 9da6aabd67..7cd53a6d42 100644 --- a/selfdrive/car/interfaces.py +++ b/selfdrive/car/interfaces.py @@ -212,6 +212,8 @@ class CarInterfaceBase(ABC): events.add(EventName.parkBrake) if cs_out.accFaulted: events.add(EventName.accFaulted) + if cs_out.steeringPressed: + events.add(EventName.steerOverride) # Handle button presses events.events.extend(create_button_enable_events(cs_out.buttonEvents, pcm_cruise=self.CP.pcmCruise)) diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index b8b66a5677..f90b5e8a83 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -504,9 +504,9 @@ class Controls: self.soft_disable_timer = int(SOFT_DISABLE_TIME / DT_CTRL) self.current_alert_types.append(ET.SOFT_DISABLE) - elif self.events.any(ET.OVERRIDE): + elif self.events.any(ET.OVERRIDE_LAT) or self.events.any(ET.OVERRIDE_LONG): self.state = State.overriding - self.current_alert_types.append(ET.OVERRIDE) + self.current_alert_types += [ET.OVERRIDE_LAT, ET.OVERRIDE_LONG] # SOFT DISABLING elif self.state == State.softDisabling: @@ -536,10 +536,10 @@ class Controls: self.state = State.softDisabling self.soft_disable_timer = int(SOFT_DISABLE_TIME / DT_CTRL) self.current_alert_types.append(ET.SOFT_DISABLE) - elif not self.events.any(ET.OVERRIDE): + elif not (self.events.any(ET.OVERRIDE_LAT) or self.events.any(ET.OVERRIDE_LONG)): self.state = State.enabled else: - self.current_alert_types.append(ET.OVERRIDE) + self.current_alert_types += [ET.OVERRIDE_LAT, ET.OVERRIDE_LONG] # DISABLED elif self.state == State.disabled: @@ -550,7 +550,7 @@ class Controls: else: if self.events.any(ET.PRE_ENABLE): self.state = State.preEnabled - elif self.events.any(ET.OVERRIDE): + elif self.events.any(ET.OVERRIDE_LAT) or self.events.any(ET.OVERRIDE_LONG): self.state = State.overriding else: self.state = State.enabled @@ -582,7 +582,7 @@ class Controls: # Check which actuators can be enabled CC.latActive = self.active and not CS.steerFaultTemporary and not CS.steerFaultPermanent and \ CS.vEgo > self.CP.minSteerSpeed and not CS.standstill - CC.longActive = self.active and not self.events.any(ET.OVERRIDE) and self.CP.openpilotLongitudinalControl + CC.longActive = self.active and not self.events.any(ET.OVERRIDE_LONG) and self.CP.openpilotLongitudinalControl actuators = CC.actuators actuators.longControlState = self.LoC.long_control_state diff --git a/selfdrive/controls/lib/events.py b/selfdrive/controls/lib/events.py index 5139ead84b..f531ec82d4 100644 --- a/selfdrive/controls/lib/events.py +++ b/selfdrive/controls/lib/events.py @@ -31,7 +31,8 @@ class Priority(IntEnum): class ET: ENABLE = 'enable' PRE_ENABLE = 'preEnable' - OVERRIDE = 'override' + OVERRIDE_LAT = 'overrideLat' + OVERRIDE_LONG = 'overrideLong' NO_ENTRY = 'noEntry' WARNING = 'warning' USER_DISABLE = 'userDisable' @@ -623,7 +624,15 @@ EVENTS: Dict[int, Dict[str, Union[Alert, AlertCallbackType]]] = { }, EventName.gasPressedOverride: { - ET.OVERRIDE: Alert( + ET.OVERRIDE_LONG: Alert( + "", + "", + AlertStatus.normal, AlertSize.none, + Priority.LOWEST, VisualAlert.none, AudibleAlert.none, .1), + }, + + EventName.steerOverride: { + ET.OVERRIDE_LAT: Alert( "", "", AlertStatus.normal, AlertSize.none,