need this check

This commit is contained in:
Jason Wen
2024-11-20 02:31:04 -05:00
parent 95697afdf8
commit 89ba9a7bf3
4 changed files with 11 additions and 8 deletions
+1 -1
View File
@@ -991,8 +991,8 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
Priority.LOW, VisualAlert.none, AudibleAlert.none, 1.),
},
# FIXME-SP: no longer used, remove prior merging
EventName.silentPedalPressed: {
ET.USER_DISABLE: EngagementAlert(AudibleAlert.none),
ET.NO_ENTRY: NoEntryAlert("Pedal Pressed During Attempt",
visual_alert=VisualAlert.brakePressed),
},
+1
View File
@@ -64,6 +64,7 @@ class ModularAssistiveDrivingSystem:
transition_paused_state()
if self.selfdrive.events.has(EventName.pedalPressed):
self.selfdrive.events.add(EventName.silentPedalPressed)
transition_paused_state()
if not CS.brakePressed and not CS.brakeHoldActive and not CS.parkingBrake and not CS.regenBraking:
+1 -1
View File
@@ -31,7 +31,7 @@ class StateMachine:
if self.state != State.disabled:
# user and immediate disable always have priority in a non-disabled state
if events.contains(ET.USER_DISABLE):
if events.has(EventName.silentLkasDisable):
if events.has(EventName.silentLkasDisable) or events.has(EventName.silentPedalPressed):
self.state = State.paused
else:
self.state = State.disabled
@@ -59,15 +59,17 @@ class TestMADSStateMachine:
self.events.clear()
def test_user_disable_to_paused(self):
paused_events = (EventName.silentLkasDisable, EventName.silentPedalPressed)
for state in ALL_STATES:
for et in MAINTAIN_STATES[state]:
self.events.add(make_event([et, ET.USER_DISABLE]))
self.events.add(EventName.silentLkasDisable)
self.state_machine.state = state
self.state_machine.update(self.events)
final_state = State.paused if self.events.has(EventName.silentLkasDisable) and state != State.disabled else State.disabled
assert self.state_machine.state == final_state
self.events.clear()
for en in paused_events:
self.events.add(en)
self.state_machine.state = state
self.state_machine.update(self.events)
final_state = State.paused if self.events.has(en) and state != State.disabled else State.disabled
assert self.state_machine.state == final_state
self.events.clear()
def test_soft_disable(self):
for state in ALL_STATES: