diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index b715d1d4f7..3525e70abb 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -421,7 +421,7 @@ class Controls: self.current_alert_types = [ET.PERMANENT] - # ENABLED, SOFT DISABLING, PRE ENABLING + # ENABLED, SOFT DISABLING, PRE ENABLING, OVERRIDING if self.state != State.disabled: # user and immediate disable always have priority in a non-disabled state if self.events.any(ET.USER_DISABLE): @@ -440,6 +440,10 @@ 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): + self.state = State.overriding + self.current_alert_types.append(ET.OVERRIDE) + # SOFT DISABLING elif self.state == State.softDisabling: if not self.events.any(ET.SOFT_DISABLE): @@ -462,6 +466,13 @@ class Controls: else: self.current_alert_types.append(ET.PRE_ENABLE) + # OVERRIDING + elif self.state == State.overriding: + if not self.events.any(ET.OVERRIDE): + self.state = State.enabled + else: + self.current_alert_types.append(ET.OVERRIDE) + # DISABLED elif self.state == State.disabled: if self.events.any(ET.ENABLE): @@ -471,6 +482,8 @@ class Controls: else: if self.events.any(ET.PRE_ENABLE): self.state = State.preEnabled + elif self.events.any(ET.OVERRIDE): + self.state = State.overriding else: self.state = State.enabled self.current_alert_types.append(ET.ENABLE) @@ -500,7 +513,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 + CC.longActive = self.active and self.state != State.overriding actuators = CC.actuators actuators.longControlState = self.LoC.long_control_state diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 5eb1f9194c..96cd65af79 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -203,7 +203,7 @@ void UIState::updateStatus() { status = STATUS_WARNING; } else if (alert_status == cereal::ControlsState::AlertStatus::CRITICAL) { status = STATUS_ALERT; - } else if (state == cereal::ControlsState::OpenpilotState::PRE_ENABLED) { + } else if (state == cereal::ControlsState::OpenpilotState::PRE_ENABLED || state == cereal::ControlsState::OpenpilotState::OVERRIDING) { status = STATUS_OVERRIDE; } else { status = controls_state.getEnabled() ? STATUS_ENGAGED : STATUS_DISENGAGED;