|
|
|
@ -1,17 +1,15 @@ |
|
|
|
|
#!/usr/bin/env python3 |
|
|
|
|
import unittest |
|
|
|
|
from unittest import mock |
|
|
|
|
|
|
|
|
|
from cereal import car, log |
|
|
|
|
from openpilot.common.realtime import DT_CTRL |
|
|
|
|
from openpilot.selfdrive.car.car_helpers import interfaces |
|
|
|
|
from openpilot.selfdrive.controls.controlsd import Controls, SOFT_DISABLE_TIME |
|
|
|
|
from openpilot.selfdrive.controls.lib.events import Events, ET, Alert, Priority, AlertSize, AlertStatus, VisualAlert, \ |
|
|
|
|
AudibleAlert, EVENTS as _EVENTS |
|
|
|
|
AudibleAlert, EVENTS |
|
|
|
|
|
|
|
|
|
State = log.ControlsState.OpenpilotState |
|
|
|
|
|
|
|
|
|
EVENTS = _EVENTS.copy() |
|
|
|
|
# The event types that maintain the current state |
|
|
|
|
MAINTAIN_STATES = {State.enabled: (None,), State.disabled: (None,), State.softDisabling: (ET.SOFT_DISABLE,), |
|
|
|
|
State.preEnabled: (ET.PRE_ENABLE,), State.overriding: (ET.OVERRIDE_LATERAL, ET.OVERRIDE_LONGITUDINAL)} |
|
|
|
@ -29,7 +27,6 @@ def make_event(event_types): |
|
|
|
|
return 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@mock.patch("openpilot.selfdrive.controls.lib.events.EVENTS", EVENTS) |
|
|
|
|
class TestStateMachine(unittest.TestCase): |
|
|
|
|
|
|
|
|
|
def setUp(self): |
|
|
|
|