Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions openpilot/selfdrive/selfdrived/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,7 @@ def invalid_lkas_setting_alert(CP: car.CarParams, CS: car.CarState, sm: messagin
# Thrown when manager detects a service exited unexpectedly while driving
EventName.processNotRunning: {
ET.NO_ENTRY: process_not_running_alert,
ET.PERMANENT: NormalPermanentAlert("Process Not Running", priority=Priority.LOW),
ET.SOFT_DISABLE: soft_disable_alert("Process Not Running"),
},

Expand Down
31 changes: 29 additions & 2 deletions openpilot/selfdrive/selfdrived/tests/test_alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
from openpilot.cereal.messaging import SubMaster
from openpilot.common.basedir import BASEDIR
from openpilot.common.params import Params
from openpilot.selfdrive.selfdrived.events import Alert, EVENTS, ET
from openpilot.selfdrive.selfdrived.alertmanager import set_offroad_alert
from openpilot.selfdrive.selfdrived.events import Alert, EVENTS, ET, Events
from openpilot.selfdrive.selfdrived.alertmanager import set_offroad_alert, AlertManager
from openpilot.selfdrive.test.process_replay.process_replay import CONFIGS

AlertSize = log.SelfdriveState.AlertSize
EventName = log.OnroadEvent.EventName

OFFROAD_ALERTS_PATH = os.path.join(BASEDIR, "openpilot/selfdrive/selfdrived/alerts_offroad.json")

Expand Down Expand Up @@ -129,3 +130,29 @@ def test_offroad_alerts_extra_text(self):
written_alert = params.get(a)
assert "a"*i == written_alert['extra']
assert alert["text"] == written_alert['text']

# processNotRunning is a controls crash; when not engaged it should be shown over a
# downstream fault like steerUnavailable. https://github.com/commaai/openpilot/issues/34751
def test_process_not_running_permanent_not_shadowed(self):
events = Events()
events.add(EventName.steerUnavailable)
events.add(EventName.processNotRunning)
callback_args = [self.CP, self.CS, self.sm, False, 100, log.LongitudinalPersonality.standard]
alerts = events.create_alerts([ET.PERMANENT], callback_args)

am = AlertManager()
am.add_many(0, alerts)
am.process_alerts(0, set())
assert am.current_alert.alert_text_1 == "Process Not Running"

# ...but when engaged, the permanent alert must NOT mask the soft disable "take control" warning
def test_process_not_running_permanent_does_not_mask_soft_disable(self):
events = Events()
events.add(EventName.processNotRunning)
callback_args = [self.CP, self.CS, self.sm, False, 100, log.LongitudinalPersonality.standard]
alerts = events.create_alerts([ET.PERMANENT, ET.SOFT_DISABLE], callback_args)

am = AlertManager()
am.add_many(0, alerts)
am.process_alerts(0, set())
assert am.current_alert.alert_text_1 == "TAKE CONTROL IMMEDIATELY"
Loading