show which cameras are malfunctioning (#24558)
old-commit-hash: 0b1f6e3620793a0a06708464387613cec2937591
This commit is contained in:
@@ -282,6 +282,12 @@ def comm_issue_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaste
|
||||
return NoEntryAlert(msg, alert_text_1="Communication Issue Between Processes")
|
||||
|
||||
|
||||
def camera_malfunction_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int) -> Alert:
|
||||
all_cams = ('roadCameraState', 'driverCameraState', 'wideRoadCameraState')
|
||||
bad_cams = [s for s in all_cams if s in sm.data.keys() and not sm.all_checks([s, ])]
|
||||
return NormalPermanentAlert("Camera Malfunction", ', '.join(bad_cams))
|
||||
|
||||
|
||||
def calibration_invalid_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int) -> Alert:
|
||||
rpy = sm['liveCalibration'].rpyCalib
|
||||
yaw = math.degrees(rpy[2] if len(rpy) == 3 else math.nan)
|
||||
@@ -551,7 +557,7 @@ EVENTS: Dict[int, Dict[str, Union[Alert, AlertCallbackType]]] = {
|
||||
|
||||
# Camera is not outputting frames
|
||||
EventName.cameraMalfunction: {
|
||||
ET.PERMANENT: NormalPermanentAlert("Camera Malfunction", "Likely Hardware Issue"),
|
||||
ET.PERMANENT: camera_malfunction_alert,
|
||||
},
|
||||
# Camera framerate too low
|
||||
EventName.cameraFrameRate: {
|
||||
@@ -882,9 +888,9 @@ EVENTS: Dict[int, Dict[str, Union[Alert, AlertCallbackType]]] = {
|
||||
# are received on the car side this usually means the relay hasn't opened correctly
|
||||
# and this alert is thrown.
|
||||
EventName.relayMalfunction: {
|
||||
ET.IMMEDIATE_DISABLE: ImmediateDisableAlert("Harness Malfunction"),
|
||||
ET.PERMANENT: NormalPermanentAlert("Harness Malfunction", "Check Hardware"),
|
||||
ET.NO_ENTRY: NoEntryAlert("Harness Malfunction"),
|
||||
ET.IMMEDIATE_DISABLE: ImmediateDisableAlert("Harness Relay Malfunction"),
|
||||
ET.PERMANENT: NormalPermanentAlert("Harness Relay Malfunction", "Check Hardware"),
|
||||
ET.NO_ENTRY: NoEntryAlert("Harness Relay Malfunction"),
|
||||
},
|
||||
|
||||
EventName.noTarget: {
|
||||
|
||||
@@ -42,15 +42,19 @@ def cycle_alerts(duration=200, is_metric=False):
|
||||
#(EventName.outOfSpace, ET.PERMANENT),
|
||||
#(EventName.modeldLagging, ET.PERMANENT),
|
||||
#(EventName.processNotRunning, ET.NO_ENTRY),
|
||||
(EventName.commIssue, ET.NO_ENTRY),
|
||||
(EventName.calibrationInvalid, ET.PERMANENT),
|
||||
(EventName.posenetInvalid, ET.NO_ENTRY),
|
||||
#(EventName.commIssue, ET.NO_ENTRY),
|
||||
#(EventName.calibrationInvalid, ET.PERMANENT),
|
||||
(EventName.cameraMalfunction, ET.PERMANENT),
|
||||
(EventName.cameraFrameRate, ET.PERMANENT),
|
||||
]
|
||||
|
||||
cameras = ['roadCameraState', 'wideRoadCameraState', 'driverCameraState']
|
||||
|
||||
CS = car.CarState.new_message()
|
||||
CP = CarInterface.get_params("HONDA CIVIC 2016")
|
||||
sm = messaging.SubMaster(['deviceState', 'pandaStates', 'roadCameraState', 'modelV2', 'liveCalibration',
|
||||
'driverMonitoringState', 'longitudinalPlan', 'lateralPlan', 'liveLocationKalman', 'managerState'])
|
||||
'driverMonitoringState', 'longitudinalPlan', 'lateralPlan', 'liveLocationKalman',
|
||||
'managerState'] + cameras)
|
||||
|
||||
pm = messaging.PubMaster(['controlsState', 'pandaStates', 'deviceState'])
|
||||
|
||||
@@ -84,9 +88,10 @@ def cycle_alerts(duration=200, is_metric=False):
|
||||
sm['liveCalibration'].rpyCalib = [-1 * random.random() for _ in range(random.randint(0, 3))]
|
||||
|
||||
for s in sm.data.keys():
|
||||
sm.alive[s] = random.random() > 0.08
|
||||
sm.valid[s] = random.random() > 0.08
|
||||
sm.freq_ok[s] = random.random() > 0.08
|
||||
prob = 0.3 if s in cameras else 0.08
|
||||
sm.alive[s] = random.random() > prob
|
||||
sm.valid[s] = random.random() > prob
|
||||
sm.freq_ok[s] = random.random() > prob
|
||||
|
||||
a = events.create_alerts([et, ], [CP, CS, sm, is_metric, 0])
|
||||
AM.add_many(frame, a)
|
||||
|
||||
Reference in New Issue
Block a user