parent
							
								
									29685c91e8
								
							
						
					
					
						commit
						fdbf213be8
					
				
				 55 changed files with 1684 additions and 1110 deletions
			
			
		| @ -1,3 +1,3 @@ | ||||
| version https://git-lfs.github.com/spec/v1 | ||||
| oid sha256:89c2ebca16b5c6dae5e614a19e48cd02d1078da7bcf99c989a385b90ec3de915 | ||||
| size 2586712 | ||||
| oid sha256:b4ebea7b71bee8e519ac6135fab68178fa81cc7dcae1eb02ff65f55b45f9c980 | ||||
| size 2586402 | ||||
|  | ||||
| @ -1,3 +1,3 @@ | ||||
| version https://git-lfs.github.com/spec/v1 | ||||
| oid sha256:3148d75436f0ce8033600622bde7f3ae4add83290e637256c0fafe2a54fb3088 | ||||
| size 18180653 | ||||
| oid sha256:14093cbddcc8c2d0ec40de70e286c72d09c6fdf85920dfeaf373d6ebc91c9ee6 | ||||
| size 18352349 | ||||
|  | ||||
| @ -0,0 +1,3 @@ | ||||
| version https://git-lfs.github.com/spec/v1 | ||||
| oid sha256:c898025ae57cbc55d29af9381fe65fd2db4704beb46c606411c4522d059bfe0b | ||||
| size 428188 | ||||
| @ -0,0 +1,3 @@ | ||||
| version https://git-lfs.github.com/spec/v1 | ||||
| oid sha256:bd26959d1a73071764378885fbb1a2941cfd4a15650361a5b6fbeccf81900def | ||||
| size 159998 | ||||
| @ -0,0 +1,3 @@ | ||||
| version https://git-lfs.github.com/spec/v1 | ||||
| oid sha256:6c0cf1b6fcdb5489146b2973aed01c4deb2bed34d9610e39b8dc3596d6e1e9af | ||||
| size 71030 | ||||
| @ -1,3 +0,0 @@ | ||||
| version https://git-lfs.github.com/spec/v1 | ||||
| oid sha256:27d907bc15d51415a0e7efa45cb4aeea7990fa315996a60a8e6620e69872d275 | ||||
| size 30966 | ||||
| @ -1,3 +0,0 @@ | ||||
| version https://git-lfs.github.com/spec/v1 | ||||
| oid sha256:eebdb5490ebd2bddd1b93a863820068bc4d591e2cdcda823d946ba3fcde984b4 | ||||
| size 30963 | ||||
| @ -1,3 +0,0 @@ | ||||
| version https://git-lfs.github.com/spec/v1 | ||||
| oid sha256:1e1f296234cdfeeb3d1e318c5b6a097fd27cc29baf4cb0d5d60929e26fef7f95 | ||||
| size 30965 | ||||
| @ -1,3 +0,0 @@ | ||||
| version https://git-lfs.github.com/spec/v1 | ||||
| oid sha256:62525ebc394905b0a02580d69afbf51fabf0f4f78c837a7b360acba88d93b7fa | ||||
| size 31592 | ||||
| @ -1,3 +0,0 @@ | ||||
| version https://git-lfs.github.com/spec/v1 | ||||
| oid sha256:1e417442f9d38b99fc0be9ab21e1d56c4f7c3f723a7563241c26208b799f64b1 | ||||
| size 30965 | ||||
| @ -0,0 +1,3 @@ | ||||
| version https://git-lfs.github.com/spec/v1 | ||||
| oid sha256:d39d45560063a9b3f0b2c473cda5ea1e052b38ee3fd7dcbd4465043b37f661ed | ||||
| size 128798 | ||||
| @ -0,0 +1,3 @@ | ||||
| version https://git-lfs.github.com/spec/v1 | ||||
| oid sha256:8249c685cab9896799290f28a53cc3751dd3fbf31c300e03fd039cd129e6c03c | ||||
| size 119446 | ||||
| @ -1 +1 @@ | ||||
| #define COMMA_VERSION "0.5.5-release" | ||||
| #define COMMA_VERSION "0.5.6-release" | ||||
|  | ||||
| @ -0,0 +1,627 @@ | ||||
| from cereal import car, log | ||||
| 
 | ||||
| # Priority | ||||
| class Priority: | ||||
|   LOWEST = 0 | ||||
|   LOW_LOWEST = 1 | ||||
|   LOW = 2 | ||||
|   MID = 3 | ||||
|   HIGH = 4 | ||||
|   HIGHEST = 5 | ||||
| 
 | ||||
| AlertSize = log.Live100Data.AlertSize | ||||
| AlertStatus = log.Live100Data.AlertStatus | ||||
| AudibleAlert = car.CarControl.HUDControl.AudibleAlert | ||||
| VisualAlert = car.CarControl.HUDControl.VisualAlert | ||||
| 
 | ||||
| class Alert(object): | ||||
|   def __init__(self, | ||||
|                alert_type, | ||||
|                alert_text_1, | ||||
|                alert_text_2, | ||||
|                alert_status, | ||||
|                alert_size, | ||||
|                alert_priority, | ||||
|                visual_alert, | ||||
|                audible_alert, | ||||
|                duration_sound, | ||||
|                duration_hud_alert, | ||||
|                duration_text, | ||||
|                alert_rate=0.): | ||||
| 
 | ||||
|     self.alert_type = alert_type | ||||
|     self.alert_text_1 = alert_text_1 | ||||
|     self.alert_text_2 = alert_text_2 | ||||
|     self.alert_status = alert_status | ||||
|     self.alert_size = alert_size | ||||
|     self.alert_priority = alert_priority | ||||
|     self.visual_alert = visual_alert | ||||
|     self.audible_alert = audible_alert | ||||
| 
 | ||||
|     self.duration_sound = duration_sound | ||||
|     self.duration_hud_alert = duration_hud_alert | ||||
|     self.duration_text = duration_text | ||||
| 
 | ||||
|     self.start_time = 0. | ||||
|     self.alert_rate = alert_rate | ||||
| 
 | ||||
|     # typecheck that enums are valid on startup | ||||
|     tst = car.CarControl.new_message() | ||||
|     tst.hudControl.visualAlert = self.visual_alert | ||||
| 
 | ||||
|   def __str__(self): | ||||
|     return self.alert_text_1 + "/" + self.alert_text_2 + " " + str(self.alert_priority) + "  " + str( | ||||
|       self.visual_alert) + " " + str(self.audible_alert) | ||||
| 
 | ||||
|   def __gt__(self, alert2): | ||||
|     return self.alert_priority > alert2.alert_priority | ||||
| 
 | ||||
| 
 | ||||
| ALERTS = [ | ||||
|   # Miscellaneous alerts | ||||
|   Alert( | ||||
|       "enable", | ||||
|       "", | ||||
|       "", | ||||
|       AlertStatus.normal, AlertSize.none, | ||||
|       Priority.MID, VisualAlert.none, AudibleAlert.chimeEngage, .2, 0., 0.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "disable", | ||||
|       "", | ||||
|       "", | ||||
|       AlertStatus.normal, AlertSize.none, | ||||
|       Priority.MID, VisualAlert.none, AudibleAlert.chimeDisengage, .2, 0., 0.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "fcw", | ||||
|       "BRAKE!", | ||||
|       "Risk of Collision", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.HIGHEST, VisualAlert.fcw, AudibleAlert.chimeWarningRepeat, 1., 2., 2.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "steerSaturated", | ||||
|       "TAKE CONTROL", | ||||
|       "Turn Exceeds Steering Limit", | ||||
|       AlertStatus.userPrompt, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.steerRequired, AudibleAlert.chimePrompt, 1., 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "steerTempUnavailable", | ||||
|       "TAKE CONTROL", | ||||
|       "Steering Temporarily Unavailable", | ||||
|       AlertStatus.userPrompt, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.steerRequired, AudibleAlert.chimeWarning1, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "steerTempUnavailableMute", | ||||
|       "TAKE CONTROL", | ||||
|       "Steering Temporarily Unavailable", | ||||
|       AlertStatus.userPrompt, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.none, .2, .2, .2), | ||||
| 
 | ||||
|   Alert( | ||||
|       "preDriverDistracted", | ||||
|       "KEEP EYES ON ROAD: User Appears Distracted", | ||||
|       "", | ||||
|       AlertStatus.normal, AlertSize.small, | ||||
|       Priority.LOW, VisualAlert.steerRequired, AudibleAlert.none, .0, .1, .1, alert_rate=0.75), | ||||
| 
 | ||||
|   Alert( | ||||
|       "promptDriverDistracted", | ||||
|       "KEEP EYES ON ROAD", | ||||
|       "User Appears Distracted", | ||||
|       AlertStatus.userPrompt, AlertSize.mid, | ||||
|       Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2, .1, .1, .1), | ||||
| 
 | ||||
|   Alert( | ||||
|       "driverDistracted", | ||||
|       "DISENGAGE IMMEDIATELY", | ||||
|       "User Was Distracted", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.HIGH, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, .1, .1, .1), | ||||
| 
 | ||||
|   Alert( | ||||
|       "preDriverUnresponsive", | ||||
|       "TOUCH STEERING WHEEL: No Driver Monitoring", | ||||
|       "", | ||||
|       AlertStatus.normal, AlertSize.small, | ||||
|       Priority.LOW, VisualAlert.steerRequired, AudibleAlert.none, .0, .1, .1, alert_rate=0.75), | ||||
| 
 | ||||
|   Alert( | ||||
|       "promptDriverUnresponsive", | ||||
|       "TOUCH STEERING WHEEL", | ||||
|       "User Is Unresponsive", | ||||
|       AlertStatus.userPrompt, AlertSize.mid, | ||||
|       Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2, .1, .1, .1), | ||||
| 
 | ||||
|   Alert( | ||||
|       "driverUnresponsive", | ||||
|       "DISENGAGE IMMEDIATELY", | ||||
|       "User Was Unresponsive", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.HIGH, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, .1, .1, .1), | ||||
| 
 | ||||
|   Alert( | ||||
|       "driverMonitorOff", | ||||
|       "DRIVER MONITOR IS UNAVAILABLE", | ||||
|       "Accuracy Is Low", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.none, .4, 0., 4.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "driverMonitorOn", | ||||
|       "DRIVER MONITOR IS AVAILABLE", | ||||
|       "Accuracy Is High", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.none, .4, 0., 4.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "geofence", | ||||
|       "DISENGAGEMENT REQUIRED", | ||||
|       "Not in Geofenced Area", | ||||
|       AlertStatus.userPrompt, AlertSize.mid, | ||||
|       Priority.HIGH, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, .1, .1, .1), | ||||
| 
 | ||||
|   Alert( | ||||
|       "startup", | ||||
|       "Be ready to take over at any time", | ||||
|       "Always keep hands on wheel and eyes on road", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW_LOWEST, VisualAlert.none, AudibleAlert.none, 0., 0., 15.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "ethicalDilemma", | ||||
|       "TAKE CONTROL IMMEDIATELY", | ||||
|       "Ethical Dilemma Detected", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "steerTempUnavailableNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Steering Temporarily Unavailable", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 0., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "manualRestart", | ||||
|       "TAKE CONTROL", | ||||
|       "Resume Driving Manually", | ||||
|       AlertStatus.userPrompt, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.none, 0., 0., .2), | ||||
| 
 | ||||
|   Alert( | ||||
|       "resumeRequired", | ||||
|       "STOPPED", | ||||
|       "Press Resume to Move", | ||||
|       AlertStatus.userPrompt, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.none, 0., 0., .2), | ||||
| 
 | ||||
|   Alert( | ||||
|       "belowSteerSpeed", | ||||
|       "TAKE CONTROL", | ||||
|       "Steer Unavailable Below ", | ||||
|       AlertStatus.userPrompt, AlertSize.mid, | ||||
|       Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning1, 0., 0., .1), | ||||
| 
 | ||||
|   Alert( | ||||
|       "debugAlert", | ||||
|       "DEBUG ALERT", | ||||
|       "", | ||||
|       AlertStatus.userPrompt, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.none, .1, .1, .1), | ||||
| 
 | ||||
|   # Non-entry only alerts | ||||
|   Alert( | ||||
|       "wrongCarModeNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Main Switch Off", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 0., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "dataNeededNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Data Needed for Calibration. Upload Drive, Try Again", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 0., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "outOfSpaceNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Out of Storage Space", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 0., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "pedalPressedNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Pedal Pressed During Attempt", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, "brakePressed", AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "speedTooLowNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Speed Too Low", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "brakeHoldNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Brake Hold Active", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "parkBrakeNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Park Brake Engaged", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "lowSpeedLockoutNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Cruise Fault: Restart the Car", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "lowBatteryNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Low Battery", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   # Cancellation alerts causing soft disabling | ||||
|   Alert( | ||||
|       "overheat", | ||||
|       "TAKE CONTROL IMMEDIATELY", | ||||
|       "System Overheated", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2, .1, 2., 2.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "wrongGear", | ||||
|       "TAKE CONTROL IMMEDIATELY", | ||||
|       "Gear not D", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2, .1, 2., 2.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "calibrationInvalid", | ||||
|       "TAKE CONTROL IMMEDIATELY", | ||||
|       "Calibration Invalid: Reposition EON and Recalibrate", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2, .1, 2., 2.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "calibrationIncomplete", | ||||
|       "TAKE CONTROL IMMEDIATELY", | ||||
|       "Calibration in Progress", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2, .1, 2., 2.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "doorOpen", | ||||
|       "TAKE CONTROL IMMEDIATELY", | ||||
|       "Door Open", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2, .1, 2., 2.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "seatbeltNotLatched", | ||||
|       "TAKE CONTROL IMMEDIATELY", | ||||
|       "Seatbelt Unlatched", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2, .1, 2., 2.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "espDisabled", | ||||
|       "TAKE CONTROL IMMEDIATELY", | ||||
|       "ESP Off", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2, .1, 2., 2.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "lowBattery", | ||||
|       "TAKE CONTROL IMMEDIATELY", | ||||
|       "Low Battery", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.MID, VisualAlert.steerRequired, AudibleAlert.chimeWarning2, .1, 2., 2.), | ||||
| 
 | ||||
|   # Cancellation alerts causing immediate disabling | ||||
|   Alert( | ||||
|       "radarCommIssue", | ||||
|       "TAKE CONTROL IMMEDIATELY", | ||||
|       "Radar Error: Restart the Car", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "radarFault", | ||||
|       "TAKE CONTROL IMMEDIATELY", | ||||
|       "Radar Error: Restart the Car", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "modelCommIssue", | ||||
|       "TAKE CONTROL IMMEDIATELY", | ||||
|       "Model Error: Check Internet Connection", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "controlsFailed", | ||||
|       "TAKE CONTROL IMMEDIATELY", | ||||
|       "Controls Failed", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "controlsMismatch", | ||||
|       "TAKE CONTROL IMMEDIATELY", | ||||
|       "Controls Mismatch", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "commIssue", | ||||
|       "TAKE CONTROL IMMEDIATELY", | ||||
|       "CAN Error: Check Connections", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "steerUnavailable", | ||||
|       "TAKE CONTROL IMMEDIATELY", | ||||
|       "LKAS Fault: Restart the Car", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "brakeUnavailable", | ||||
|       "TAKE CONTROL IMMEDIATELY", | ||||
|       "Cruise Fault: Restart the Car", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "gasUnavailable", | ||||
|       "TAKE CONTROL IMMEDIATELY", | ||||
|       "Gas Fault: Restart the Car", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "reverseGear", | ||||
|       "TAKE CONTROL IMMEDIATELY", | ||||
|       "Reverse Gear", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "cruiseDisabled", | ||||
|       "TAKE CONTROL IMMEDIATELY", | ||||
|       "Cruise Is Off", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "plannerError", | ||||
|       "TAKE CONTROL IMMEDIATELY", | ||||
|       "Planner Solution Error", | ||||
|       AlertStatus.critical, AlertSize.full, | ||||
|       Priority.HIGHEST, VisualAlert.steerRequired, AudibleAlert.chimeWarningRepeat, 1., 3., 4.), | ||||
| 
 | ||||
|   # not loud cancellations (user is in control) | ||||
|   Alert( | ||||
|       "noTarget", | ||||
|       "openpilot Canceled", | ||||
|       "No close lead car", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.HIGH, VisualAlert.none, AudibleAlert.chimeDisengage, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "speedTooLow", | ||||
|       "openpilot Canceled", | ||||
|       "Speed too low", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.HIGH, VisualAlert.none, AudibleAlert.chimeDisengage, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "invalidGiraffeHonda", | ||||
|       "Invalid Giraffe Configuration", | ||||
|       "Set 0111 for openpilot. 1011 for stock", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.HIGH, VisualAlert.none, AudibleAlert.chimeDisengage, .4, 2., 3.), | ||||
| 
 | ||||
|   # Cancellation alerts causing non-entry | ||||
|   Alert( | ||||
|       "overheatNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "System overheated", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "wrongGearNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Gear not D", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "calibrationInvalidNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Calibration Invalid: Reposition EON and Recalibrate", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "calibrationIncompleteNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Calibration in Progress", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "doorOpenNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Door open", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "seatbeltNotLatchedNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Seatbelt unlatched", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "espDisabledNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "ESP Off", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "geofenceNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Not in Geofenced Area", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.MID, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "radarCommIssueNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Radar Error: Restart the Car", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "radarFaultNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Radar Error: Restart the Car", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "modelCommIssueNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Model Error: Check Internet Connection", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "controlsFailedNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Controls Failed", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "commIssueNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "CAN Error: Check Connections", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "steerUnavailableNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "LKAS Fault: Restart the Car", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "brakeUnavailableNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Cruise Fault: Restart the Car", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "gasUnavailableNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Gas Error: Restart the Car", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "reverseGearNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Reverse Gear", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "cruiseDisabledNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Cruise is Off", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "noTargetNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "No Close Lead Car", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "plannerErrorNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Planner Solution Error", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeError, .4, 2., 3.), | ||||
| 
 | ||||
|   Alert( | ||||
|       "invalidGiraffeHondaNoEntry", | ||||
|       "openpilot Unavailable", | ||||
|       "Set 0111 for openpilot. 1011 for stock", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW, VisualAlert.none, AudibleAlert.chimeDisengage, .4, 2., 3.), | ||||
| 
 | ||||
|   # permanent alerts | ||||
|   Alert( | ||||
|       "steerUnavailablePermanent", | ||||
|       "LKAS Fault: Restart the car to engage", | ||||
|       "", | ||||
|       AlertStatus.normal, AlertSize.small, | ||||
|       Priority.LOW_LOWEST, VisualAlert.none, AudibleAlert.none, 0., 0., .2), | ||||
| 
 | ||||
|   Alert( | ||||
|       "brakeUnavailablePermanent", | ||||
|       "Cruise Fault: Restart the car to engage", | ||||
|       "", | ||||
|       AlertStatus.normal, AlertSize.small, | ||||
|       Priority.LOW_LOWEST, VisualAlert.none, AudibleAlert.none, 0., 0., .2), | ||||
| 
 | ||||
|   Alert( | ||||
|       "lowSpeedLockoutPermanent", | ||||
|       "Cruise Fault: Restart the car to engage", | ||||
|       "", | ||||
|       AlertStatus.normal, AlertSize.small, | ||||
|       Priority.LOW_LOWEST, VisualAlert.none, AudibleAlert.none, 0., 0., .2), | ||||
| 
 | ||||
|   Alert( | ||||
|       "calibrationIncompletePermanent", | ||||
|       "Calibration in Progress: ", | ||||
|       "Drive Above ", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOWEST, VisualAlert.none, AudibleAlert.none, 0., 0., .2), | ||||
| 
 | ||||
|   Alert( | ||||
|       "invalidGiraffeHondaPermanent", | ||||
|       "Invalid Giraffe Configuration", | ||||
|       "Set 0111 for openpilot. 1011 for stock", | ||||
|       AlertStatus.normal, AlertSize.mid, | ||||
|       Priority.LOW_LOWEST, VisualAlert.none, AudibleAlert.none, 0., 0., .2), | ||||
| ] | ||||
| @ -1,3 +1,3 @@ | ||||
| version https://git-lfs.github.com/spec/v1 | ||||
| oid sha256:a983a2cd87781d7f535f822ae703b30d88cdd23eec97ff1ee80725c7ef80041d | ||||
| oid sha256:7002238879fa8c88dcd9ea252b0cd13fa196add47bad265d9e9e12b291770494 | ||||
| size 1630952 | ||||
|  | ||||
| @ -1,3 +1,3 @@ | ||||
| version https://git-lfs.github.com/spec/v1 | ||||
| oid sha256:4cedc9397a255d0c5fd4a034fabd4748ab6e0b5f9fc910ccdc3f79b878860e29 | ||||
| oid sha256:9d9f15e0a4694b2ba094ad83e649702980cf3a87251007b85c3692ae02a6774b | ||||
| size 1171544 | ||||
|  | ||||
| @ -1,3 +1,3 @@ | ||||
| version https://git-lfs.github.com/spec/v1 | ||||
| oid sha256:ec93ea7d63f2f3222828b142e7752eb5a6e1b880a822ee3ba62c2ca43d1beac0 | ||||
| oid sha256:6f5a24d35eb787240b034b66bfa50817761b5d7b60111b17781dafeeb00a18f9 | ||||
| size 1159016 | ||||
|  | ||||
| @ -0,0 +1,184 @@ | ||||
| #include <stdio.h> | ||||
| #include <assert.h> | ||||
| #include <unistd.h> | ||||
| #include <stdlib.h> | ||||
| #include <getopt.h> | ||||
| 
 | ||||
| #include "common/timing.h" | ||||
| #include "slplay.h" | ||||
| 
 | ||||
| SLEngineItf engineInterface = NULL; | ||||
| SLObjectItf outputMix = NULL; | ||||
| SLObjectItf engine = NULL; | ||||
| uri_player players[32] = {{NULL, NULL, NULL}}; | ||||
| 
 | ||||
| uint64_t loop_start = 0; | ||||
| uint64_t loop_start_ctx = 0; | ||||
| 
 | ||||
| uri_player* get_player_by_uri(const char* uri) { | ||||
|   for (uri_player *s = players; s->uri != NULL; s++) { | ||||
|     if (strcmp(s->uri, uri) == 0) { | ||||
|       return s; | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   return NULL; | ||||
| } | ||||
| 
 | ||||
| uri_player* slplay_create_player_for_uri(const char* uri, char **error) { | ||||
|   uri_player player = { uri, NULL, NULL }; | ||||
| 
 | ||||
|   SLresult result; | ||||
|   SLDataLocator_URI locUri = {SL_DATALOCATOR_URI, (SLchar *) uri}; | ||||
|   SLDataFormat_MIME formatMime = {SL_DATAFORMAT_MIME, NULL, SL_CONTAINERTYPE_UNSPECIFIED}; | ||||
|   SLDataSource audioSrc = {&locUri, &formatMime}; | ||||
| 
 | ||||
|   SLDataLocator_OutputMix outMix = {SL_DATALOCATOR_OUTPUTMIX, outputMix}; | ||||
|   SLDataSink audioSnk = {&outMix, NULL}; | ||||
| 
 | ||||
|   result = (*engineInterface)->CreateAudioPlayer(engineInterface, &player.player, &audioSrc, &audioSnk, 0, NULL, NULL); | ||||
|   if (result != SL_RESULT_SUCCESS) { | ||||
|     *error = strdup("Failed to create audio player"); | ||||
|     return NULL; | ||||
|   } | ||||
| 
 | ||||
|   result = (*(player.player))->Realize(player.player, SL_BOOLEAN_FALSE); | ||||
|   if (result != SL_RESULT_SUCCESS) { | ||||
|     *error = strdup("Failed to realize audio player"); | ||||
|     return NULL; | ||||
|   } | ||||
| 
 | ||||
|   result = (*(player.player))->GetInterface(player.player, SL_IID_PLAY, &(player.playInterface)); | ||||
|   if (result != SL_RESULT_SUCCESS) { | ||||
|     *error = strdup("Failed to get player interface"); | ||||
|     return NULL; | ||||
|   } | ||||
| 
 | ||||
|   result = (*(player.playInterface))->SetPlayState(player.playInterface, SL_PLAYSTATE_PAUSED); | ||||
|   if (result != SL_RESULT_SUCCESS) { | ||||
|     *error = strdup("Failed to initialize playstate to SL_PLAYSTATE_PAUSED"); | ||||
|     return NULL; | ||||
|   } | ||||
| 
 | ||||
|   uri_player *p = players; | ||||
|   while (p->uri != NULL) { | ||||
|     p++; | ||||
|   } | ||||
|   *p = player; | ||||
| 
 | ||||
|   return p; | ||||
| } | ||||
| 
 | ||||
| void slplay_setup(char **error) { | ||||
|   SLresult result; | ||||
|   SLEngineOption engineOptions[] = {{SL_ENGINEOPTION_THREADSAFE, SL_BOOLEAN_TRUE}}; | ||||
|   result = slCreateEngine(&engine, 1, engineOptions, 0, NULL, NULL); | ||||
|   if (result != SL_RESULT_SUCCESS) { | ||||
|     *error = strdup("Failed to create OpenSL engine"); | ||||
|   } | ||||
| 
 | ||||
|   result = (*engine)->Realize(engine, SL_BOOLEAN_FALSE); | ||||
|   if (result != SL_RESULT_SUCCESS) { | ||||
|     *error = strdup("Failed to realize OpenSL engine"); | ||||
|   } | ||||
| 
 | ||||
|   result = (*engine)->GetInterface(engine, SL_IID_ENGINE, &engineInterface); | ||||
|   if (result != SL_RESULT_SUCCESS) { | ||||
|     *error = strdup("Failed to realize OpenSL engine"); | ||||
|   } | ||||
| 
 | ||||
|   const SLInterfaceID ids[1] = {SL_IID_VOLUME}; | ||||
|   const SLboolean req[1] = {SL_BOOLEAN_FALSE}; | ||||
|   result = (*engineInterface)->CreateOutputMix(engineInterface, &outputMix, 1, ids, req); | ||||
|   if (result != SL_RESULT_SUCCESS) { | ||||
|     *error = strdup("Failed to create output mix"); | ||||
|   } | ||||
| 
 | ||||
|   result = (*outputMix)->Realize(outputMix, SL_BOOLEAN_FALSE); | ||||
|   if (result != SL_RESULT_SUCCESS) { | ||||
|     *error = strdup("Failed to realize output mix"); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| void slplay_destroy() { | ||||
|   for (uri_player *player = players; player->uri != NULL; player++) { | ||||
|     if (player->player) { | ||||
|       (*(player->player))->Destroy(player->player); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   (*outputMix)->Destroy(outputMix); | ||||
|   (*engine)->Destroy(engine); | ||||
| } | ||||
| 
 | ||||
| void slplay_stop (uri_player* player, char **error) { | ||||
|   SLPlayItf playInterface = player->playInterface; | ||||
|   SLresult result; | ||||
| 
 | ||||
|   // stop a loop
 | ||||
|   loop_start = 0; | ||||
| 
 | ||||
|   result = (*playInterface)->SetPlayState(playInterface, SL_PLAYSTATE_PAUSED); | ||||
|   if (result != SL_RESULT_SUCCESS) { | ||||
|     *error = strdup("Failed to set SL_PLAYSTATE_STOPPED"); | ||||
|     return; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| void slplay_stop_uri(const char* uri, char **error) { | ||||
|   uri_player* player = get_player_by_uri(uri); | ||||
|   slplay_stop(player, error); | ||||
| } | ||||
| 
 | ||||
| void SLAPIENTRY slplay_callback(SLPlayItf playItf, void *context, SLuint32 event) { | ||||
|   uint64_t cb_loop_start = *((uint64_t*)context); | ||||
|   if (event == SL_PLAYEVENT_HEADATEND && cb_loop_start == loop_start) { | ||||
|     (*playItf)->SetPlayState(playItf, SL_PLAYSTATE_STOPPED); | ||||
|     (*playItf)->SetMarkerPosition(playItf, 0); | ||||
|     (*playItf)->SetPlayState(playItf, SL_PLAYSTATE_PLAYING); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| void slplay_play (const char *uri, bool loop, char **error) { | ||||
|   SLresult result; | ||||
| 
 | ||||
|   uri_player* player = get_player_by_uri(uri); | ||||
|   if (player == NULL) { | ||||
|     player = slplay_create_player_for_uri(uri, error); | ||||
|     if (*error) { | ||||
|       return; | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   SLPlayItf playInterface = player->playInterface; | ||||
|   if (loop) { | ||||
|     loop_start = nanos_since_boot(); | ||||
|     loop_start_ctx = loop_start; | ||||
|     result = (*playInterface)->RegisterCallback(playInterface, slplay_callback, &loop_start_ctx); | ||||
|     if (result != SL_RESULT_SUCCESS) { | ||||
|       char error[64]; | ||||
|       snprintf(error, sizeof(error), "Failed to register callback. %d", result); | ||||
|       *error = error[0]; | ||||
|       return; | ||||
|     } | ||||
| 
 | ||||
|     result = (*playInterface)->SetCallbackEventsMask(playInterface, SL_PLAYEVENT_HEADATEND); | ||||
|     if (result != SL_RESULT_SUCCESS) { | ||||
|       *error = strdup("Failed to set callback event mask"); | ||||
|       return; | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   // Reset the audio player
 | ||||
|   result = (*playInterface)->ClearMarkerPosition(playInterface); | ||||
|   if (result != SL_RESULT_SUCCESS) { | ||||
|     *error = strdup("Failed to clear marker position"); | ||||
|     return; | ||||
|   } | ||||
|   result = (*playInterface)->SetPlayState(playInterface, SL_PLAYSTATE_PAUSED); | ||||
|   result = (*playInterface)->SetPlayState(playInterface, SL_PLAYSTATE_STOPPED); | ||||
|   result = (*playInterface)->SetPlayState(playInterface, SL_PLAYSTATE_PLAYING); | ||||
|   if (result != SL_RESULT_SUCCESS) { | ||||
|     *error = strdup("Failed to set SL_PLAYSTATE_PLAYING"); | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,21 @@ | ||||
| #ifndef SLPLAY_H | ||||
| #define SLPLAY_H | ||||
| 
 | ||||
| #include <SLES/OpenSLES.h> | ||||
| #include <SLES/OpenSLES_Android.h> | ||||
| #include <stdbool.h> | ||||
| 
 | ||||
| typedef struct { | ||||
|   const char* uri; | ||||
|   SLObjectItf player; | ||||
|   SLPlayItf playInterface; | ||||
| } uri_player; | ||||
| 
 | ||||
| void slplay_setup(char **error); | ||||
| uri_player* slplay_create_player_for_uri(const char* uri, char **error); | ||||
| void slplay_play (const char *uri, bool loop, char **error); | ||||
| void slplay_stop_uri (const char* uri, char **error); | ||||
| void slplay_destroy(); | ||||
| 
 | ||||
| #endif | ||||
| 
 | ||||
| @ -0,0 +1,6 @@ | ||||
| #!/bin/sh | ||||
| set -e | ||||
| 
 | ||||
| make | ||||
| export LD_LIBRARY_PATH=/system/lib64:$LD_LIBRARY_PATH | ||||
| exec ./ui | ||||
| @ -1,3 +1,3 @@ | ||||
| version https://git-lfs.github.com/spec/v1 | ||||
| oid sha256:31516242f4af3af1f71a7969aae43451213eb51f93bf2d923d37cc5b4bc143a8 | ||||
| oid sha256:ac8b787e8d8ef84d9d02ebaf7c68686e88eca6ec9965c9480e07bce3b4394ff8 | ||||
| size 9069496 | ||||
|  | ||||
					Loading…
					
					
				
		Reference in new issue