This commit is contained in:
Your Name
2024-04-28 14:55:01 -05:00
parent 90a4ed9cab
commit b2767a27f6
3 changed files with 27 additions and 21 deletions

View File

@@ -27,12 +27,13 @@ class DRIVER_MONITOR_SETTINGS():
# self._DISTRACTED_PROMPT_TIME_TILL_TERMINAL = 6.
# Temp.
self._AWARENESS_TIME = 60. # passive wheeltouch total timeout
self._AWARENESS_PRE_TIME_TILL_TERMINAL = 999.
self._AWARENESS_PROMPT_TIME_TILL_TERMINAL = 999.
self._DISTRACTED_TIME = 30. # active monitoring total timeout
self._DISTRACTED_PRE_TIME_TILL_TERMINAL = 999.
self._DISTRACTED_PROMPT_TIME_TILL_TERMINAL = 999.
# Goals: Temp only if daytime and privledged
self._AWARENESS_TIME = 50. # passive wheeltouch total timeout
self._AWARENESS_PRE_TIME_TILL_TERMINAL = 30.
self._AWARENESS_PROMPT_TIME_TILL_TERMINAL = 10.
self._DISTRACTED_TIME = 50. # active monitoring total timeout
self._DISTRACTED_PRE_TIME_TILL_TERMINAL = 30.
self._DISTRACTED_PROMPT_TIME_TILL_TERMINAL = 10.
self._FACE_THRESHOLD = 0.7
self._EYE_THRESHOLD = 0.65
@@ -310,14 +311,16 @@ class DriverStatus():
self.hi_stds = 0
def update_events(self, events, driver_engaged, ctrl_active, standstill):
if (driver_engaged and self.awareness > 0 and not self.active_monitoring_mode) or not ctrl_active: # reset only when on disengagement if red reached
# self.awareness > 0
if (driver_engaged and not self.active_monitoring_mode) or not ctrl_active: # reset only when on disengagement if red reached
self._reset_awareness()
return
driver_attentive = self.driver_distraction_filter.x < 0.37
awareness_prev = self.awareness
if (driver_attentive and self.face_detected and self.pose.low_std and self.awareness > 0):
# and self.awareness > 0
if (driver_attentive and self.face_detected and self.pose.low_std ):
if driver_engaged:
self._reset_awareness()
return
@@ -341,11 +344,12 @@ class DriverStatus():
alert = None
if self.awareness <= 0.:
# terminal red alert: disengagement required
alert = EventName.driverDistracted if self.active_monitoring_mode else EventName.driverUnresponsive
self.terminal_time += 1
if awareness_prev > 0.:
self.terminal_alert_cnt += 1
elif self.awareness <= self.threshold_prompt:
alert = EventName.driverDistracted if self.active_monitoring_mode else EventName.driverUnresponsive
# self.terminal_time += 1
# if awareness_prev > 0.:
# self.terminal_alert_cnt += 1
# elif self.awareness <= self.threshold_prompt:
if self.awareness <= self.threshold_prompt:
# prompt orange alert
alert = EventName.promptDriverDistracted if self.active_monitoring_mode else EventName.promptDriverUnresponsive
elif self.awareness <= self.threshold_pre: