continued: Update DM awareness times (#2527)

* Gets us 6 seconds before making sound (up from 2s; 9s originally)

* Average last two awareness times

* This alert shows up every ~20 seconds, distracting

* Revert "Average last two awareness times"

This reverts commit 2fd7e7a44c.

* update ref

* update test

* update ref

Co-authored-by: Shane Smiskol <shane@smiskol.com>
pull/2518/head^2
ZwX1616 2020-11-11 14:24:32 -08:00 committed by GitHub
parent 4954db0381
commit faf8b1fd82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -15,8 +15,8 @@ EventName = car.CarEvent.EventName
# ******************************************************************************************
_AWARENESS_TIME = 35. # passive wheel touch total timeout
_AWARENESS_PRE_TIME_TILL_TERMINAL = 7.
_AWARENESS_PROMPT_TIME_TILL_TERMINAL = 5.
_AWARENESS_PRE_TIME_TILL_TERMINAL = 12.
_AWARENESS_PROMPT_TIME_TILL_TERMINAL = 6.
_DISTRACTED_TIME = 11.
_DISTRACTED_PRE_TIME_TILL_TERMINAL = 8.
_DISTRACTED_PROMPT_TIME_TILL_TERMINAL = 6.
@ -251,13 +251,13 @@ class DriverStatus():
if self.awareness <= 0.:
# terminal red alert: disengagement required
alert = EventName.driverDistracted if self.active_monitoring_mode else EventName.driverUnresponsive
self.hi_std_alert_enabled = True
self.terminal_time += 1
if awareness_prev > 0.:
self.terminal_alert_cnt += 1
elif self.awareness <= self.threshold_prompt:
# prompt orange alert
alert = EventName.promptDriverDistracted if self.active_monitoring_mode else EventName.promptDriverUnresponsive
self.hi_std_alert_enabled = True
elif self.awareness <= self.threshold_pre:
# pre green alert
alert = EventName.preDriverDistracted if self.active_monitoring_mode else EventName.preDriverUnresponsive

View File

@ -218,8 +218,8 @@ class TestMonitoring(unittest.TestCase):
self.assertEqual(events_output[int((_HI_STD_TIMEOUT)/DT_DMON)].names[0], EventName.driverMonitorLowAcc)
self.assertTrue(EventName.preDriverDistracted in events_output[int((2*(_DISTRACTED_TIME-_DISTRACTED_PRE_TIME_TILL_TERMINAL))/DT_DMON)].names)
self.assertTrue(EventName.promptDriverDistracted in events_output[int((2*(_DISTRACTED_TIME-_DISTRACTED_PROMPT_TIME_TILL_TERMINAL))/DT_DMON)].names)
self.assertEqual(events_output[int((_DISTRACTED_TIME+1)/DT_DMON)].names[1], EventName.promptDriverDistracted)
self.assertEqual(events_output[int((_DISTRACTED_TIME*2.5)/DT_DMON)].names[1], EventName.promptDriverDistracted) # set_timer blocked
self.assertEqual(events_output[int((_DISTRACTED_TIME+1)/DT_DMON)].names[0], EventName.promptDriverDistracted)
self.assertEqual(events_output[int((_DISTRACTED_TIME*2.5)/DT_DMON)].names[0], EventName.promptDriverDistracted) # set_timer blocked
if __name__ == "__main__":
print('MAX_TERMINAL_ALERTS', MAX_TERMINAL_ALERTS)

View File

@ -1 +1 @@
b4a8c7c439c2430082ffb49ed675ada8f3bab8e6
7dde5eab03feb7e0801fe24e9fea0f3629987571