mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-26 08:22:05 +08:00
test onroad: ensure 100% engageability (#28132)
This commit is contained in:
@@ -2,8 +2,9 @@ import os
|
||||
import time
|
||||
from functools import wraps
|
||||
|
||||
from system.hardware import PC
|
||||
import cereal.messaging as messaging
|
||||
from selfdrive.manager.process_config import managed_processes
|
||||
from system.hardware import PC
|
||||
from system.version import training_version, terms_version
|
||||
|
||||
|
||||
@@ -15,6 +16,11 @@ def set_params_enabled():
|
||||
params.put_bool("OpenpilotEnabledToggle", True)
|
||||
params.put_bool("Passive", False)
|
||||
|
||||
# valid calib
|
||||
msg = messaging.new_message('liveCalibration')
|
||||
msg.liveCalibration.validBlocks = 20
|
||||
msg.liveCalibration.rpyCalib = [0.0, 0.0, 0.0]
|
||||
params.put("CalibrationParams", msg.to_bytes())
|
||||
|
||||
def phone_only(f):
|
||||
@wraps(f)
|
||||
|
||||
@@ -338,6 +338,17 @@ class TestOnroad(unittest.TestCase):
|
||||
expected = EVENTS[car.CarEvent.EventName.startup][ET.PERMANENT].alert_text_1
|
||||
self.assertEqual(startup_alert, expected, "wrong startup alert")
|
||||
|
||||
def test_engagable(self):
|
||||
no_entries = Counter()
|
||||
for m in self.service_msgs['carEvents']:
|
||||
for evt in m.carEvents:
|
||||
if evt.noEntry:
|
||||
no_entries[evt.name] += 1
|
||||
|
||||
eng = [m.controlsState.engageable for m in self.service_msgs['controlsState']]
|
||||
assert all(eng), \
|
||||
f"Not engageable for whole segment:\n- controlsState.engageable: {Counter(eng)}\n- No entry events: {no_entries}"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user