diff --git a/selfdrive/monitoring/dmonitoringd.py b/selfdrive/monitoring/dmonitoringd.py index 12addef..020a201 100755 --- a/selfdrive/monitoring/dmonitoringd.py +++ b/selfdrive/monitoring/dmonitoringd.py @@ -44,7 +44,18 @@ def dmonitoringd_thread(): # Get data from dmonitoringmodeld events = Events() - if sm.all_checks() and len(sm['liveCalibration'].rpyCalib): + # CLEARPILOT: narrow update_states gate. The original sm.all_checks() also + # required modelV2 fresh (stops at standstill in two-state modeld) and + # liveCalibration.valid (calibrationd cascades its own freq_ok to valid, which + # flaps). Both made DM freeze pose → face_detected stuck False → awareness + # decayed to 0 within 6s of engagement. Narrow the gate to the subs + # update_states actually reads, and only to alive+valid (skip freq_ok and + # skip liveCalibration.valid). rpyCalib presence is sufficient to know + # calibration has produced output. + if (sm.alive['driverStateV2'] and sm.valid['driverStateV2'] and + sm.alive['carState'] and sm.valid['carState'] and + sm.alive['controlsState'] and sm.valid['controlsState'] and + sm.alive['liveCalibration'] and len(sm['liveCalibration'].rpyCalib) > 0): driver_status.update_states(sm['driverStateV2'], sm['liveCalibration'].rpyCalib, sm['carState'].vEgo, sm['controlsState'].enabled) # Block engaging after max number of distrations