Add ability to toggle driver monitoring

This commit is contained in:
dragonpilot
2019-09-27 14:50:59 +10:00
parent 145319bcd3
commit f165fed722
3 changed files with 6 additions and 0 deletions
+1
View File
@@ -130,6 +130,7 @@ keys = {
"DragonUILead": [TxType.PERSISTENT],
"DragonUIPath": [TxType.PERSISTENT],
"DragonUIBlinker": [TxType.PERSISTENT],
"DragonEnableDriverMonitoring": [TxType.PERSISTENT],
}
+4
View File
@@ -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
@@ -50,6 +50,7 @@ default_conf = {
'DragonUILead': '1',
'DragonUIPath': '1',
'DragonUIBlinker': '0',
'DragonEnableDriverMonitoring': '1',
}
deprecated_conf = {