per camera alerts (#20992)

* per camera alert

* bump cereal

* cleanup

* space
pull/20995/head
Adeeb Shihadeh 4 years ago committed by GitHub
parent f3d41de9d8
commit 12ed986333
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      cereal
  2. 37
      selfdrive/controls/controlsd.py
  3. 19
      selfdrive/controls/lib/events.py

@ -1 +1 @@
Subproject commit a8055c3f212825096d754c22b25606ef40164054 Subproject commit b1675bac3d0f759605748daeb93e801a76f7d729

@ -72,7 +72,6 @@ class Controls:
if TICI: if TICI:
self.log_sock = messaging.sub_sock('androidLog') self.log_sock = messaging.sub_sock('androidLog')
self.crc_seen = False
# wait for one pandaState and one CAN packet # wait for one pandaState and one CAN packet
print("Waiting for CAN messages...") print("Waiting for CAN messages...")
@ -258,24 +257,24 @@ class Controls:
self.events.add(EventName.fcw) self.events.add(EventName.fcw)
if TICI and self.enable_lte_onroad: if TICI and self.enable_lte_onroad:
if not self.crc_seen: logs = messaging.drain_sock(self.log_sock, wait_for_one=False)
logs = messaging.drain_sock(self.log_sock, wait_for_one=False) messages = []
messages = [] for m in logs:
for m in logs: try:
try: messages.append(m.androidLog.message)
messages.append(m.androidLog.message) except UnicodeDecodeError:
except UnicodeDecodeError: pass
pass
for err in ["ERROR_CRC", "ERROR_ECC", "ERROR_STREAM_UNDERFLOW", "APPLY FAILED"]:
for err in ["ERROR_CRC", "ERROR_ECC", "ERROR_STREAM_UNDERFLOW", "APPLY FAILED"]: for m in messages:
err_cnt = sum(err in m for m in messages) if err not in m:
if err_cnt: continue
self.crc_seen = True
self.events.add(EventName.cameraError) csid = m.split("CSID:")[-1].split(" ")[0]
break evt = {"0": EventName.wideRoadCameraError, "1": EventName.roadCameraError,
"2": EventName.driverCameraError}.get(csid, None)
if self.crc_seen: if evt is not None:
self.events.add(EventName.cameraError) self.events.add(evt)
# TODO: fix simulator # TODO: fix simulator
if not SIMULATION: if not SIMULATION:

@ -169,10 +169,10 @@ class EngagementAlert(Alert):
audible_alert, .2, 0., 0.), audible_alert, .2, 0., 0.),
class NormalPermanentAlert(Alert): class NormalPermanentAlert(Alert):
def __init__(self, alert_text_1, alert_text_2): def __init__(self, alert_text_1: str, alert_text_2: str, duration_text: float = 0.2):
super().__init__(alert_text_1, alert_text_2, super().__init__(alert_text_1, alert_text_2,
AlertStatus.normal, AlertSize.mid if len(alert_text_2) else AlertSize.small, AlertStatus.normal, AlertSize.mid if len(alert_text_2) else AlertSize.small,
Priority.LOWER, VisualAlert.none, AudibleAlert.none, 0., 0., .2), Priority.LOWER, VisualAlert.none, AudibleAlert.none, 0., 0., duration_text),
# ********** alert callback functions ********** # ********** alert callback functions **********
@ -672,8 +672,19 @@ EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, boo
ET.IMMEDIATE_DISABLE: ImmediateDisableAlert("Controls Mismatch"), ET.IMMEDIATE_DISABLE: ImmediateDisableAlert("Controls Mismatch"),
}, },
EventName.cameraError: { EventName.roadCameraError: {
ET.PERMANENT: NormalPermanentAlert("CRC Error", ""), ET.PERMANENT: NormalPermanentAlert("Road Camera Error", "",
duration_text=10.),
},
EventName.driverCameraError: {
ET.PERMANENT: NormalPermanentAlert("Driver Camera Error", "",
duration_text=10.),
},
EventName.wideRoadCameraError: {
ET.PERMANENT: NormalPermanentAlert("Wide Road Camera Error", "",
duration_text=10.),
}, },
EventName.usbError: { EventName.usbError: {

Loading…
Cancel
Save