more events

This commit is contained in:
Jason Wen
2024-11-25 00:05:07 -05:00
parent 207eff5c30
commit 7fbdc63f11
4 changed files with 22 additions and 2 deletions
+2
View File
@@ -195,6 +195,8 @@ struct OnroadEvent @0xc4fa6047f024e718 {
silentBrakeHold @158;
silentWrongGear @159;
silentReverseGear @160;
silentDoorOpen @161;
silentSeatbeltNotLatched @162;
soundsUnavailableDEPRECATED @47;
}
+10
View File
@@ -1036,6 +1036,16 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
ET.NO_ENTRY: NoEntryAlert("Reverse Gear"),
},
EventName.silentDoorOpen: {
ET.SOFT_DISABLE: user_soft_disable_alert("Door Open"),
ET.NO_ENTRY: NoEntryAlert("Door Open"),
},
EventName.silentSeatbeltNotLatched: {
ET.SOFT_DISABLE: user_soft_disable_alert("Seatbelt Unlatched"),
ET.NO_ENTRY: NoEntryAlert("Seatbelt Unlatched"),
},
}
+6
View File
@@ -54,6 +54,12 @@ class ModularAssistiveDrivingSystem:
if self.events.has(EventName.brakeHold):
self.events.replace(EventName.brakeHold, EventName.silentBrakeHold)
transition_paused_state()
if self.events.has(EventName.doorOpen):
self.events.replace(EventName.doorOpen, EventName.silentDoorOpen)
transition_paused_state()
if self.events.has(EventName.seatbeltNotLatched):
self.events.replace(EventName.seatbeltNotLatched, EventName.silentSeatbeltNotLatched)
transition_paused_state()
if self.disengage_lateral_on_brake_toggle:
if self.events.has(EventName.pedalPressed):
+4 -2
View File
@@ -9,8 +9,10 @@ EventName = log.OnroadEvent.EventName
ACTIVE_STATES = (State.enabled, State.softDisabling, State.overriding)
ENABLED_STATES = (State.paused, *ACTIVE_STATES)
GEARS_ALLOW_PAUSED_SILENT = [EventName.silentWrongGear, EventName.silentReverseGear, EventName.silentBrakeHold]
GEARS_ALLOW_PAUSED = [EventName.wrongGear, EventName.reverseGear, EventName.brakeHold, *GEARS_ALLOW_PAUSED_SILENT]
GEARS_ALLOW_PAUSED_SILENT = [EventName.silentWrongGear, EventName.silentReverseGear, EventName.silentBrakeHold,
EventName.silentDoorOpen, EventName.silentSeatbeltNotLatched]
GEARS_ALLOW_PAUSED = [EventName.wrongGear, EventName.reverseGear, EventName.brakeHold,
EventName.doorOpen, EventName.seatbeltNotLatched, *GEARS_ALLOW_PAUSED_SILENT]
class StateMachine: