silent lkas disable

This commit is contained in:
Jason Wen
2024-11-19 01:09:54 -05:00
parent 4c23b2728a
commit 347914d9bf
4 changed files with 18 additions and 17 deletions
+4 -3
View File
@@ -191,9 +191,10 @@ struct OnroadEvent @0xc4fa6047f024e718 {
manualLongitudinalRequired @154;
silentPedalPressed @155;
silentLkasEnable @156;
silentBrakeHold @157;
silentWrongGear @158;
silentReverseGear @159;
silentLkasDisable @157;
silentBrakeHold @158;
silentWrongGear @159;
silentReverseGear @160;
soundsUnavailableDEPRECATED @47;
}
+5 -12
View File
@@ -992,11 +992,6 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
},
EventName.silentPedalPressed: {
ET.USER_DISABLE: Alert(
"",
"",
AlertStatus.normal, AlertSize.none,
Priority.MID, VisualAlert.none, AudibleAlert.none, .2),
ET.NO_ENTRY: NoEntryAlert("Pedal Pressed During Attempt",
visual_alert=VisualAlert.brakePressed),
},
@@ -1009,17 +1004,20 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
Priority.MID, VisualAlert.none, AudibleAlert.none, .2, 0.),
},
EventName.silentBrakeHold: {
EventName.silentLkasDisable: {
ET.USER_DISABLE: Alert(
"",
"",
AlertStatus.normal, AlertSize.none,
Priority.MID, VisualAlert.none, AudibleAlert.none, .2, 0.),
},
EventName.silentBrakeHold: {
ET.NO_ENTRY: NoEntryAlert("Brake Hold Active"),
},
EventName.silentWrongGear: {
ET.USER_DISABLE: Alert(
ET.PERMANENT: Alert(
"Gear not D",
"openpilot Unavailable",
AlertStatus.normal, AlertSize.mid,
@@ -1037,11 +1035,6 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
"",
AlertStatus.normal, AlertSize.full,
Priority.LOWEST, VisualAlert.none, AudibleAlert.none, .2, creation_delay=0.5),
ET.USER_DISABLE: Alert(
"Reverse\nGear",
"",
AlertStatus.normal, AlertSize.full,
Priority.LOWEST, VisualAlert.none, AudibleAlert.none, .2, creation_delay=0.),
ET.NO_ENTRY: NoEntryAlert("Reverse Gear"),
},
+8
View File
@@ -43,11 +43,17 @@ class ModularAssistiveDrivingSystem:
if self.state_machine.state == State.paused and self.enabled:
self.selfdrive.events.add(EventName.silentLkasEnable)
def transition_paused_state():
if self.state_machine.state != State.paused:
self.selfdrive.events.add(EventName.silentLkasDisable)
if not self.selfdrive.enabled:
if self.selfdrive.events.has(EventName.wrongGear) and not self.selfdrive.events.has(EventName.reverseGear):
self.selfdrive.events.replace(EventName.wrongGear, EventName.silentWrongGear)
transition_paused_state()
if self.selfdrive.events.has(EventName.reverseGear) and CS.vEgo < 5:
self.selfdrive.events.replace(EventName.reverseGear, EventName.silentReverseGear)
transition_paused_state()
if not self.selfdrive.events.has(EventName.silentWrongGear) and not self.selfdrive.events.has(EventName.silentReverseGear):
update_silent_lkas_enable()
@@ -55,9 +61,11 @@ class ModularAssistiveDrivingSystem:
if self.disengage_lateral_on_brake_toggle:
if self.selfdrive.events.has(EventName.brakeHold):
self.selfdrive.events.replace(EventName.brakeHold, EventName.silentBrakeHold)
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:
update_silent_lkas_enable()
+1 -2
View File
@@ -31,8 +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.silentPedalPressed) or events.has(EventName.silentBrakeHold) or \
events.has(EventName.silentWrongGear) or events.has(EventName.silentReverseGear):
if events.has(EventName.silentLkasDisable):
self.state = State.paused
else:
self.state = State.disabled