Skip to content

Commit

Permalink
alert text simplification (commaai#23186)
Browse files Browse the repository at this point in the history
* alert text simplification

* little more

* user triggered

* little more

* less annoying ldw

* Update selfdrive/controls/lib/events.py

* update refs

* revert
  • Loading branch information
adeebshihadeh authored and twilsonco committed Feb 13, 2022
1 parent 66ff854 commit 743a98f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 25 deletions.
46 changes: 26 additions & 20 deletions selfdrive/controls/lib/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ def __init__(self, alert_text_2):
AudibleAlert.chimeWarningRepeat, .1, 2., 2.),


# less harsh version of SoftDisable, where the condition is user-triggered
class UserSoftDisableAlert(SoftDisableAlert):
def __init__(self, alert_text_2):
super().__init__(alert_text_2),
self.alert_text_1 = "openpilot will disengage"


class ImmediateDisableAlert(Alert):
def __init__(self, alert_text_2, alert_text_1="TAKE CONTROL IMMEDIATELY"):
super().__init__(alert_text_1, alert_text_2,
Expand Down Expand Up @@ -299,7 +306,7 @@ def joystick_alert(CP: car.CarParams, sm: messaging.SubMaster, metric: bool) ->
},

EventName.controlsInitializing: {
ET.NO_ENTRY: NoEntryAlert("Controls Initializing"),
ET.NO_ENTRY: NoEntryAlert("System Initializing"),
},

EventName.startup: {
Expand Down Expand Up @@ -362,7 +369,7 @@ def joystick_alert(CP: car.CarParams, sm: messaging.SubMaster, metric: bool) ->

EventName.invalidLkasSetting: {
ET.PERMANENT: Alert(
"Stock LKAS is turned on",
"Stock LKAS is on",
"Turn off stock LKAS to engage",
AlertStatus.normal, AlertSize.mid,
Priority.LOWER, VisualAlert.none, AudibleAlert.none, 0., 0., .2),
Expand All @@ -374,8 +381,8 @@ def joystick_alert(CP: car.CarParams, sm: messaging.SubMaster, metric: bool) ->
EventName.communityFeatureDisallowed: {
# LOW priority to overcome Cruise Error
ET.PERMANENT: Alert(
"openpilot Not Available",
"Enable Community Features in Settings to Engage",
"openpilot Unavailable",
"Enable Community Features in Settings",
AlertStatus.normal, AlertSize.mid,
Priority.LOW, VisualAlert.none, AudibleAlert.none, 0., 0., .2),
},
Expand Down Expand Up @@ -410,17 +417,16 @@ def joystick_alert(CP: car.CarParams, sm: messaging.SubMaster, metric: bool) ->

EventName.ldw: {
ET.PERMANENT: Alert(
"TAKE CONTROL",
"Lane Departure Detected",
AlertStatus.userPrompt, AlertSize.mid,
"", AlertSize.mid,
Priority.LOW, VisualAlert.ldw, AudibleAlert.chimePrompt, 1., 2., 3.),
},

# ********** events only containing alerts that display while engaged **********

EventName.gasPressed: {
ET.PRE_ENABLE: Alert(
"openpilot will not brake while gas pressed",
"Release Gas Pedal to Engage",
"",
AlertStatus.normal, AlertSize.small,
Priority.LOWEST, VisualAlert.none, AudibleAlert.none, .0, .0, .1, creation_delay=1.),
Expand Down Expand Up @@ -454,15 +460,15 @@ def joystick_alert(CP: car.CarParams, sm: messaging.SubMaster, metric: bool) ->

EventName.preDriverDistracted: {
ET.WARNING: Alert(
"KEEP EYES ON ROAD: Driver Distracted",
"Pay Attention",
"",
AlertStatus.normal, AlertSize.small,
Priority.LOW, VisualAlert.none, AudibleAlert.none, .0, .1, .1),
},

EventName.promptDriverDistracted: {
ET.WARNING: Alert(
"KEEP EYES ON ROAD",
"Pay Attention",
"Driver Distracted",
AlertStatus.userPrompt, AlertSize.mid,
Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2Repeat, .1, .1, .1),
Expand All @@ -478,15 +484,15 @@ def joystick_alert(CP: car.CarParams, sm: messaging.SubMaster, metric: bool) ->

EventName.preDriverUnresponsive: {
ET.WARNING: Alert(
"TOUCH STEERING WHEEL: No Face Detected",
"Touch Steering Wheel: No Face Detected",
"",
AlertStatus.normal, AlertSize.small,
Priority.LOW, VisualAlert.steerRequired, AudibleAlert.none, .0, .1, .1, alert_rate=0.75),
},

EventName.promptDriverUnresponsive: {
ET.WARNING: Alert(
"TOUCH STEERING WHEEL",
"Touch Steering Wheel",
"Driver Unresponsive",
AlertStatus.userPrompt, AlertSize.mid,
Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2Repeat, .1, .1, .1),
Expand Down Expand Up @@ -531,7 +537,7 @@ def joystick_alert(CP: car.CarParams, sm: messaging.SubMaster, metric: bool) ->
EventName.resumeRequired: {
ET.WARNING: Alert(
"STOPPED",
"Press Resume to Move",
"Press Resume to Go",
AlertStatus.userPrompt, AlertSize.mid,
Priority.LOW, VisualAlert.none, AudibleAlert.none, 0., 0., .2),
},
Expand Down Expand Up @@ -574,7 +580,7 @@ def joystick_alert(CP: car.CarParams, sm: messaging.SubMaster, metric: bool) ->

EventName.steerSaturated: {
ET.WARNING: Alert(
"TAKE CONTROL",
"Take Control",
"Turn Exceeds Steering Limit",
AlertStatus.userPrompt, AlertSize.mid,
Priority.LOW, VisualAlert.steerRequired, AudibleAlert.chimePrompt, 1., 1., 1.),
Expand Down Expand Up @@ -648,12 +654,12 @@ def joystick_alert(CP: car.CarParams, sm: messaging.SubMaster, metric: bool) ->

EventName.parkBrake: {
ET.USER_DISABLE: EngagementAlert(AudibleAlert.chimeDisengage),
ET.NO_ENTRY: NoEntryAlert("Park Brake Engaged"),
ET.NO_ENTRY: NoEntryAlert("Parking Brake Engaged"),
},

EventName.pedalPressed: {
ET.USER_DISABLE: EngagementAlert(AudibleAlert.chimeDisengage),
ET.NO_ENTRY: NoEntryAlert("Pedal Pressed During Attempt",
ET.NO_ENTRY: NoEntryAlert("Pedal Pressed",
visual_alert=VisualAlert.brakePressed),
},

Expand All @@ -664,7 +670,7 @@ def joystick_alert(CP: car.CarParams, sm: messaging.SubMaster, metric: bool) ->

EventName.wrongCruiseMode: {
ET.USER_DISABLE: EngagementAlert(AudibleAlert.chimeDisengage),
ET.NO_ENTRY: NoEntryAlert("Enable Adaptive Cruise"),
ET.NO_ENTRY: NoEntryAlert("Adaptive Cruise Disabled"),
},

EventName.steerTempUnavailable: {
Expand Down Expand Up @@ -720,7 +726,7 @@ def joystick_alert(CP: car.CarParams, sm: messaging.SubMaster, metric: bool) ->
},

EventName.wrongGear: {
ET.SOFT_DISABLE: SoftDisableAlert("Gear not D"),
ET.SOFT_DISABLE: UserSoftDisableAlert("Gear not D"),
ET.NO_ENTRY: NoEntryAlert("Gear not D"),
},

Expand All @@ -742,12 +748,12 @@ def joystick_alert(CP: car.CarParams, sm: messaging.SubMaster, metric: bool) ->
},

EventName.doorOpen: {
ET.SOFT_DISABLE: SoftDisableAlert("Door Open"),
ET.SOFT_DISABLE: UserSoftDisableAlert("Door Open"),
ET.NO_ENTRY: NoEntryAlert("Door Open"),
},

EventName.seatbeltNotLatched: {
ET.SOFT_DISABLE: SoftDisableAlert("Seatbelt Unlatched"),
ET.SOFT_DISABLE: UserSoftDisableAlert("Seatbelt Unlatched"),
ET.NO_ENTRY: NoEntryAlert("Seatbelt Unlatched"),
},

Expand Down Expand Up @@ -939,7 +945,7 @@ def joystick_alert(CP: car.CarParams, sm: messaging.SubMaster, metric: bool) ->
Priority.HIGH, VisualAlert.none, AudibleAlert.chimeDisengage, .4, 2., 3.),
},

# When the car is driving faster than most cars in the training data the model outputs can be unpredictable
# When the car is driving faster than most cars in the training data, the model outputs can be unpredictable.
EventName.speedTooHigh: {
ET.WARNING: Alert(
"Speed Too High",
Expand Down
6 changes: 1 addition & 5 deletions selfdrive/test/process_replay/ref_commit
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
<<<<<<< HEAD
280a712ece99c231ea036c3b66d6aafa55548211
=======
567866c06976f8f95fa7d1670b51d8723e663ea1
>>>>>>> 94d59314e (Revert ecef std until real fix (#22982))
280a712ece99c231ea036c3b66d6aafa55548211

0 comments on commit 743a98f

Please sign in to comment.