auto choose

pull/24947/head
ZwX1616 3 years ago
parent 222d129711
commit 8773fb430b
  1. 3
      selfdrive/monitoring/dmonitoringd.py
  2. 20
      selfdrive/monitoring/driver_monitor.py

@ -3,7 +3,6 @@ import gc
import cereal.messaging as messaging
from cereal import car
from common.params import Params
from common.realtime import set_realtime_priority
from selfdrive.controls.lib.events import Events
from selfdrive.locationd.calibrationd import Calibration
@ -20,7 +19,7 @@ def dmonitoringd_thread(sm=None, pm=None):
if sm is None:
sm = messaging.SubMaster(['driverStateV2', 'liveCalibration', 'carState', 'controlsState', 'modelV2'], poll=['driverStateV2'])
driver_status = DriverStatus(rhd=Params().get_bool("IsRHD"))
driver_status = DriverStatus()
sm['liveCalibration'].calStatus = Calibration.INVALID
sm['liveCalibration'].rpyCalib = [0, 0, 0]

@ -115,12 +115,12 @@ class DriverBlink():
self.right_blink = 0.
class DriverStatus():
def __init__(self, rhd=False, settings=DRIVER_MONITOR_SETTINGS()):
def __init__(self, settings=DRIVER_MONITOR_SETTINGS()):
# init policy settings
self.settings = settings
# init driver status
# self.wheelpos_learner = RunningStatFilter()
self.wheelpos_learner = RunningStatFilter()
self.pose = DriverPose(self.settings._POSE_OFFSET_MAX_COUNT)
self.pose_calibrated = False
self.blink = DriverBlink()
@ -137,7 +137,7 @@ class DriverStatus():
self.distracted_types = []
self.driver_distracted = False
self.driver_distraction_filter = FirstOrderFilter(0., self.settings._DISTRACTED_FILTER_TS, self.settings._DT_DMON)
self.wheel_on_right = rhd
self.wheel_on_right = False
self.face_detected = False
self.terminal_alert_cnt = 0
self.terminal_time = 0
@ -225,13 +225,13 @@ class DriverStatus():
self.settings._POSE_YAW_THRESHOLD_STRICT]) / self.settings._POSE_YAW_THRESHOLD
def update_states(self, driver_state, cal_rpy, car_speed, op_engaged):
# rhd_pred = driver_state.wheelOnRightProb
# if car_speed > 0.01:
# self.wheelpos_learner.push_and_update(rhd_pred)
# if self.wheelpos_learner.filtered_stat.n > self.settings._WHEELPOS_FILTER_MIN_COUNT:
# self.wheel_on_right = self.wheelpos_learner.filtered_stat.M > self.settings._WHEELPOS_THRESHOLD
# else:
# self.wheel_on_right = rhd_pred > self.settings._WHEELPOS_THRESHOLD
rhd_pred = driver_state.wheelOnRightProb
if car_speed > 0.01:
self.wheelpos_learner.push_and_update(rhd_pred)
if self.wheelpos_learner.filtered_stat.n > self.settings._WHEELPOS_FILTER_MIN_COUNT:
self.wheel_on_right = self.wheelpos_learner.filtered_stat.M > self.settings._WHEELPOS_THRESHOLD
else:
self.wheel_on_right = rhd_pred > self.settings._WHEELPOS_THRESHOLD
driver_data = driver_state.rightDriverData if self.wheel_on_right else driver_state.leftDriverData
if not all(len(x) > 0 for x in (driver_data.faceOrientation, driver_data.facePosition,
driver_data.faceOrientationStd, driver_data.facePositionStd,

Loading…
Cancel
Save