From 249c6512bbfc6e1a51f2cb4d9af8d1d3244424bb Mon Sep 17 00:00:00 2001 From: dragonpilot Date: Mon, 19 Aug 2019 21:30:42 +1000 Subject: [PATCH 1/4] =?UTF-8?q?=E9=A7=95=E9=A7=9B=E7=9B=A3=E6=8E=A7?= =?UTF-8?q?=E6=94=B9=E8=87=B330=20=E5=88=86=E9=90=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- selfdrive/controls/lib/driver_monitor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/controls/lib/driver_monitor.py b/selfdrive/controls/lib/driver_monitor.py index c175adea6..11ea0ba44 100644 --- a/selfdrive/controls/lib/driver_monitor.py +++ b/selfdrive/controls/lib/driver_monitor.py @@ -5,7 +5,7 @@ from common.filter_simple import FirstOrderFilter from common.params import Params params = Params() -_AWARENESS_TIME = 90. # 1.5 minutes limit without user touching steering wheels make the car enter a terminal status +_AWARENESS_TIME = 1800. # 30 minutes limit without user touching steering wheels make the car enter a terminal status _AWARENESS_PRE_TIME_TILL_TERMINAL = 20. # a first alert is issued 20s before expiration _AWARENESS_PROMPT_TIME_TILL_TERMINAL = 5. # a second alert is issued 5s before start decelerating the car _DISTRACTED_TIME = 10. From 1d498095aaafcb48c86b0f43b38b08952764b586 Mon Sep 17 00:00:00 2001 From: dragonpilot Date: Tue, 20 Aug 2019 12:46:07 +1000 Subject: [PATCH 2/4] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=8F=AF=E8=A8=AD?= =?UTF-8?q?=E5=AE=9A=E7=9A=84=20steering=20monitor=20timer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/params.py | 1 + selfdrive/controls/lib/driver_monitor.py | 11 +++++++---- selfdrive/dragonpilot/dragonconf/__init__.py | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/common/params.py b/common/params.py index 44bba6763..8a4bbf202 100755 --- a/common/params.py +++ b/common/params.py @@ -109,6 +109,7 @@ keys = { "DragonUIDevMini": [TxType.PERSISTENT], "DragonBootTomTom": [TxType.PERSISTENT], "DragonBootAutonavi": [TxType.PERSISTENT], + "DragonSteeringMonitorTimer": [TxType.PERSISTENT], } diff --git a/selfdrive/controls/lib/driver_monitor.py b/selfdrive/controls/lib/driver_monitor.py index c175adea6..88c431949 100644 --- a/selfdrive/controls/lib/driver_monitor.py +++ b/selfdrive/controls/lib/driver_monitor.py @@ -98,6 +98,7 @@ class DriverStatus(): # dragonpilot self.dp_last_check = 0. self.dragon_enable_driver_safety_check = True + self.dragon_steering_monitor_timer = 180 def _reset_filters(self): self.driver_distraction_filter.x = 0. @@ -107,15 +108,15 @@ class DriverStatus(): def _set_timers(self, active_monitoring): if active_monitoring: # when falling back from passive mode to active mode, reset awareness to avoid false alert - if self.step_change == DT_CTRL / _AWARENESS_TIME: + if self.step_change == DT_CTRL / self.dragon_steering_monitor_timer: self.awareness = 1. self.threshold_pre = _DISTRACTED_PRE_TIME_TILL_TERMINAL / _DISTRACTED_TIME self.threshold_prompt = _DISTRACTED_PROMPT_TIME_TILL_TERMINAL / _DISTRACTED_TIME self.step_change = DT_CTRL / _DISTRACTED_TIME else: - self.threshold_pre = _AWARENESS_PRE_TIME_TILL_TERMINAL / _AWARENESS_TIME - self.threshold_prompt = _AWARENESS_PROMPT_TIME_TILL_TERMINAL / _AWARENESS_TIME - self.step_change = DT_CTRL / _AWARENESS_TIME + self.threshold_pre = _AWARENESS_PRE_TIME_TILL_TERMINAL / self.dragon_steering_monitor_timer + self.threshold_prompt = _AWARENESS_PROMPT_TIME_TILL_TERMINAL / self.dragon_steering_monitor_timer + self.step_change = DT_CTRL / self.dragon_steering_monitor_timer def _is_driver_distracted(self, pose, blink): # TODO: natural pose calib of each driver @@ -171,6 +172,8 @@ class DriverStatus(): ts = sec_since_boot() if ts - self.dp_last_check > 3.: self.dragon_enable_driver_safety_check = False if params.get("DragonEnableDriverSafetyCheck") == "0" else True + timer = params.get("DragonSteeringMonitorTimer") + self.dragon_steering_monitor_timer = 60 * 60 * 24 if timer == "0" else int(timer) * 60 self.dp_last_check = ts if not self.dragon_enable_driver_safety_check: diff --git a/selfdrive/dragonpilot/dragonconf/__init__.py b/selfdrive/dragonpilot/dragonconf/__init__.py index 7756743db..a0d6edd31 100644 --- a/selfdrive/dragonpilot/dragonconf/__init__.py +++ b/selfdrive/dragonpilot/dragonconf/__init__.py @@ -28,6 +28,7 @@ default_conf = { 'DragonUIDevMini': '1', 'DragonBootTomTom': '0', 'DragonBootAutonavi': '0', + 'DragonSteeringMonitorTimer': '3', } deprecated_conf = { From f07e24cba4d5a3c25533edbb7b1fc9b57b6e28df Mon Sep 17 00:00:00 2001 From: dragonpilot Date: Tue, 20 Aug 2019 15:56:06 +1000 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=AD=A3DragonSteeringMonitorTime?= =?UTF-8?q?r=20=E9=8C=AF=E8=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- selfdrive/controls/lib/driver_monitor.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/selfdrive/controls/lib/driver_monitor.py b/selfdrive/controls/lib/driver_monitor.py index cff869d09..c489655d4 100644 --- a/selfdrive/controls/lib/driver_monitor.py +++ b/selfdrive/controls/lib/driver_monitor.py @@ -5,7 +5,7 @@ from common.filter_simple import FirstOrderFilter from common.params import Params params = Params() -_AWARENESS_TIME = 1800. # 30 minutes limit without user touching steering wheels make the car enter a terminal status +_AWARENESS_TIME = int(params.get("DragonSteeringMonitorTimer")) _AWARENESS_PRE_TIME_TILL_TERMINAL = 20. # a first alert is issued 20s before expiration _AWARENESS_PROMPT_TIME_TILL_TERMINAL = 5. # a second alert is issued 5s before start decelerating the car _DISTRACTED_TIME = 10. @@ -98,7 +98,6 @@ class DriverStatus(): # dragonpilot self.dp_last_check = 0. self.dragon_enable_driver_safety_check = True - self.dragon_steering_monitor_timer = 180 def _reset_filters(self): self.driver_distraction_filter.x = 0. @@ -108,15 +107,15 @@ class DriverStatus(): def _set_timers(self, active_monitoring): if active_monitoring: # when falling back from passive mode to active mode, reset awareness to avoid false alert - if self.step_change == DT_CTRL / self.dragon_steering_monitor_timer: + if self.step_change == DT_CTRL / _AWARENESS_TIME: self.awareness = 1. self.threshold_pre = _DISTRACTED_PRE_TIME_TILL_TERMINAL / _DISTRACTED_TIME self.threshold_prompt = _DISTRACTED_PROMPT_TIME_TILL_TERMINAL / _DISTRACTED_TIME self.step_change = DT_CTRL / _DISTRACTED_TIME else: - self.threshold_pre = _AWARENESS_PRE_TIME_TILL_TERMINAL / self.dragon_steering_monitor_timer - self.threshold_prompt = _AWARENESS_PROMPT_TIME_TILL_TERMINAL / self.dragon_steering_monitor_timer - self.step_change = DT_CTRL / self.dragon_steering_monitor_timer + self.threshold_pre = _AWARENESS_PRE_TIME_TILL_TERMINAL / _AWARENESS_TIME + self.threshold_prompt = _AWARENESS_PROMPT_TIME_TILL_TERMINAL / _AWARENESS_TIME + self.step_change = DT_CTRL / _AWARENESS_TIME def _is_driver_distracted(self, pose, blink): # TODO: natural pose calib of each driver @@ -172,8 +171,6 @@ class DriverStatus(): ts = sec_since_boot() if ts - self.dp_last_check > 3.: self.dragon_enable_driver_safety_check = False if params.get("DragonEnableDriverSafetyCheck") == "0" else True - timer = params.get("DragonSteeringMonitorTimer") - self.dragon_steering_monitor_timer = 60 * 60 * 24 if timer == "0" else int(timer) * 60 self.dp_last_check = ts if not self.dragon_enable_driver_safety_check: From b6e97ad135dc9938f45d7538975393a9a7e3acc1 Mon Sep 17 00:00:00 2001 From: dragonpilot Date: Tue, 20 Aug 2019 16:21:17 +1000 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=AD=A3DragonSteeringMonitorTime?= =?UTF-8?q?r=20=E9=8C=AF=E8=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- selfdrive/controls/lib/driver_monitor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/controls/lib/driver_monitor.py b/selfdrive/controls/lib/driver_monitor.py index c489655d4..635714101 100644 --- a/selfdrive/controls/lib/driver_monitor.py +++ b/selfdrive/controls/lib/driver_monitor.py @@ -4,8 +4,8 @@ from selfdrive.controls.lib.drive_helpers import create_event, EventTypes as ET from common.filter_simple import FirstOrderFilter from common.params import Params params = Params() - -_AWARENESS_TIME = int(params.get("DragonSteeringMonitorTimer")) +_Timer = int(params.get("DragonSteeringMonitorTimer")) * 60 +_AWARENESS_TIME = _Timer if _Timer > 0 else 86400 _AWARENESS_PRE_TIME_TILL_TERMINAL = 20. # a first alert is issued 20s before expiration _AWARENESS_PROMPT_TIME_TILL_TERMINAL = 5. # a second alert is issued 5s before start decelerating the car _DISTRACTED_TIME = 10.