|
|
@ -136,21 +136,21 @@ class TestMonitoring(unittest.TestCase): |
|
|
|
# engaged, invisible driver, down to orange, driver touches wheel; then down to orange again, driver appears |
|
|
|
# engaged, invisible driver, down to orange, driver touches wheel; then down to orange again, driver appears |
|
|
|
# - both actions should clear the alert, but momentary appearance should not |
|
|
|
# - both actions should clear the alert, but momentary appearance should not |
|
|
|
def test_sometimes_transparent_commuter(self): |
|
|
|
def test_sometimes_transparent_commuter(self): |
|
|
|
_visible_time = np.random.choice([0.5, 10]) |
|
|
|
_visible_time = np.random.choice([0.5, 10]) |
|
|
|
ds_vector = always_no_face[:]*2 |
|
|
|
ds_vector = always_no_face[:]*2 |
|
|
|
interaction_vector = always_false[:]*2 |
|
|
|
interaction_vector = always_false[:]*2 |
|
|
|
ds_vector[int((2*INVISIBLE_SECONDS_TO_ORANGE+1)/DT_DMON):int((2*INVISIBLE_SECONDS_TO_ORANGE+1+_visible_time)/DT_DMON)] = [msg_ATTENTIVE] * int(_visible_time/DT_DMON) |
|
|
|
ds_vector[int((2*INVISIBLE_SECONDS_TO_ORANGE+1)/DT_DMON):int((2*INVISIBLE_SECONDS_TO_ORANGE+1+_visible_time)/DT_DMON)] = [msg_ATTENTIVE] * int(_visible_time/DT_DMON) |
|
|
|
interaction_vector[int((INVISIBLE_SECONDS_TO_ORANGE)/DT_DMON):int((INVISIBLE_SECONDS_TO_ORANGE+1)/DT_DMON)] = [True] * int(1/DT_DMON) |
|
|
|
interaction_vector[int((INVISIBLE_SECONDS_TO_ORANGE)/DT_DMON):int((INVISIBLE_SECONDS_TO_ORANGE+1)/DT_DMON)] = [True] * int(1/DT_DMON) |
|
|
|
events, _ = self._run_seq(ds_vector, interaction_vector, 2*always_true, 2*always_false) |
|
|
|
events, _ = self._run_seq(ds_vector, interaction_vector, 2*always_true, 2*always_false) |
|
|
|
self.assertTrue(len(events[int(INVISIBLE_SECONDS_TO_ORANGE*0.5/DT_DMON)]) == 0) |
|
|
|
self.assertTrue(len(events[int(INVISIBLE_SECONDS_TO_ORANGE*0.5/DT_DMON)]) == 0) |
|
|
|
self.assertEqual(events[int((INVISIBLE_SECONDS_TO_ORANGE-0.1)/DT_DMON)].names[0], EventName.promptDriverUnresponsive) |
|
|
|
self.assertEqual(events[int((INVISIBLE_SECONDS_TO_ORANGE-0.1)/DT_DMON)].names[0], EventName.promptDriverUnresponsive) |
|
|
|
self.assertTrue(len(events[int((INVISIBLE_SECONDS_TO_ORANGE+0.1)/DT_DMON)]) == 0) |
|
|
|
self.assertTrue(len(events[int((INVISIBLE_SECONDS_TO_ORANGE+0.1)/DT_DMON)]) == 0) |
|
|
|
if _visible_time == 0.5: |
|
|
|
if _visible_time == 0.5: |
|
|
|
self.assertEqual(events[int((INVISIBLE_SECONDS_TO_ORANGE*2+1-0.1)/DT_DMON)].names[0], EventName.promptDriverUnresponsive) |
|
|
|
self.assertEqual(events[int((INVISIBLE_SECONDS_TO_ORANGE*2+1-0.1)/DT_DMON)].names[0], EventName.promptDriverUnresponsive) |
|
|
|
self.assertEqual(events[int((INVISIBLE_SECONDS_TO_ORANGE*2+1+0.1+_visible_time)/DT_DMON)].names[0], EventName.preDriverUnresponsive) |
|
|
|
self.assertEqual(events[int((INVISIBLE_SECONDS_TO_ORANGE*2+1+0.1+_visible_time)/DT_DMON)].names[0], EventName.preDriverUnresponsive) |
|
|
|
elif _visible_time == 10: |
|
|
|
elif _visible_time == 10: |
|
|
|
self.assertEqual(events[int((INVISIBLE_SECONDS_TO_ORANGE*2+1-0.1)/DT_DMON)].names[0], EventName.promptDriverUnresponsive) |
|
|
|
self.assertEqual(events[int((INVISIBLE_SECONDS_TO_ORANGE*2+1-0.1)/DT_DMON)].names[0], EventName.promptDriverUnresponsive) |
|
|
|
self.assertTrue(len(events[int((INVISIBLE_SECONDS_TO_ORANGE*2+1+0.1+_visible_time)/DT_DMON)]) == 0) |
|
|
|
self.assertTrue(len(events[int((INVISIBLE_SECONDS_TO_ORANGE*2+1+0.1+_visible_time)/DT_DMON)]) == 0) |
|
|
|
|
|
|
|
|
|
|
|
# engaged, invisible driver, down to red, driver appears and then touches wheel, then disengages/reengages |
|
|
|
# engaged, invisible driver, down to red, driver appears and then touches wheel, then disengages/reengages |
|
|
|
# - only disengage will clear the alert |
|
|
|
# - only disengage will clear the alert |
|
|
|