From f165fed722d6ef78624008b9699debc9acd50251 Mon Sep 17 00:00:00 2001 From: dragonpilot Date: Fri, 27 Sep 2019 14:50:59 +1000 Subject: [PATCH] Add ability to toggle driver monitoring --- common/params.py | 1 + selfdrive/controls/lib/driver_monitor.py | 4 ++++ selfdrive/dragonpilot/dragonconf/__init__.py | 1 + 3 files changed, 6 insertions(+) diff --git a/common/params.py b/common/params.py index f1a7528ce..0d2d69cb1 100755 --- a/common/params.py +++ b/common/params.py @@ -130,6 +130,7 @@ keys = { "DragonUILead": [TxType.PERSISTENT], "DragonUIPath": [TxType.PERSISTENT], "DragonUIBlinker": [TxType.PERSISTENT], + "DragonEnableDriverMonitoring": [TxType.PERSISTENT], } diff --git a/selfdrive/controls/lib/driver_monitor.py b/selfdrive/controls/lib/driver_monitor.py index 40f835e9a..ad595e784 100644 --- a/selfdrive/controls/lib/driver_monitor.py +++ b/selfdrive/controls/lib/driver_monitor.py @@ -100,6 +100,7 @@ class DriverStatus(): self.awareness_time = float(params.get("DragonSteeringMonitorTimer")) self.awareness_time = 86400 if self.awareness_time <= 0. else self.awareness_time * 60. self.dragon_enable_driver_safety_check = False if params.get("DragonEnableDriverSafetyCheck") == "0" else True + self.dragon_enable_driver_monitoring = False if params.get("DragonEnableDriverMonitoring") == "0" else True self._set_timers(active_monitoring=True) @@ -162,6 +163,9 @@ class DriverStatus(): self.pose.roll, self.pose.pitch, self.pose.yaw = head_orientation_from_descriptor(driver_monitoring.faceOrientation, driver_monitoring.facePosition, cal_rpy) self.blink.left_blink = driver_monitoring.leftBlinkProb * (driver_monitoring.leftEyeProb>_EYE_THRESHOLD) self.blink.right_blink = driver_monitoring.rightBlinkProb * (driver_monitoring.rightEyeProb>_EYE_THRESHOLD) + # we simply set to rhd to avoid driver monitoring + if not self.dragon_enable_driver_monitoring: + self.is_rhd_region = True self.face_detected = driver_monitoring.faceProb > _FACE_THRESHOLD and not self.is_rhd_region self.driver_distracted = self._is_driver_distracted(self.pose, self.blink)>0 diff --git a/selfdrive/dragonpilot/dragonconf/__init__.py b/selfdrive/dragonpilot/dragonconf/__init__.py index de42b0342..70060ffab 100644 --- a/selfdrive/dragonpilot/dragonconf/__init__.py +++ b/selfdrive/dragonpilot/dragonconf/__init__.py @@ -50,6 +50,7 @@ default_conf = { 'DragonUILead': '1', 'DragonUIPath': '1', 'DragonUIBlinker': '0', + 'DragonEnableDriverMonitoring': '1', } deprecated_conf = {