Test car interfaces: init controllers (#31282)

* not pytest?

* copy what build release does

* test controls step with CI and lat/long controllers, car controller.update, etc

* clean up

* not needed

* not here

* here

* better cmt

* fix test_fuzzy

* see what's failing

* need conftest for OPENPILOT_PREFIX to work!

* up

* clean up

* test

* fix

* params put is slow

* stash

* Revert "stash"

This reverts commit 22cc9f814c.

* stash

bad

* just freaking merge

* sort

* rm
pull/31291/head
Shane Smiskol 1 year ago committed by GitHub
parent d0a1fa636a
commit 0110540300
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 15
      selfdrive/car/tests/test_car_interfaces.py

@ -14,6 +14,10 @@ from openpilot.selfdrive.car.car_helpers import interfaces
from openpilot.selfdrive.car.fingerprints import all_known_cars from openpilot.selfdrive.car.fingerprints import all_known_cars
from openpilot.selfdrive.car.fw_versions import FW_VERSIONS from openpilot.selfdrive.car.fw_versions import FW_VERSIONS
from openpilot.selfdrive.car.interfaces import get_interface_attr from openpilot.selfdrive.car.interfaces import get_interface_attr
from openpilot.selfdrive.controls.lib.latcontrol_angle import LatControlAngle
from openpilot.selfdrive.controls.lib.latcontrol_pid import LatControlPID
from openpilot.selfdrive.controls.lib.latcontrol_torque import LatControlTorque
from openpilot.selfdrive.controls.lib.longcontrol import LongControl
from openpilot.selfdrive.test.fuzzy_generation import DrawType, FuzzyGenerator from openpilot.selfdrive.test.fuzzy_generation import DrawType, FuzzyGenerator
ALL_ECUS = list({ecu for ecus in FW_VERSIONS.values() for ecu in ecus.keys()}) ALL_ECUS = list({ecu for ecus in FW_VERSIONS.values() for ecu in ecus.keys()})
@ -105,6 +109,17 @@ class TestCarInterfaces(unittest.TestCase):
car_interface.apply(CC, now_nanos) car_interface.apply(CC, now_nanos)
now_nanos += DT_CTRL * 1e9 # 10ms now_nanos += DT_CTRL * 1e9 # 10ms
# Test controller initialization
# TODO: wait until card refactor is merged to run controller a few times,
# hypothesis also slows down significantly with just one more message draw
LongControl(car_params)
if car_params.steerControlType == car.CarParams.SteerControlType.angle:
LatControlAngle(car_params, car_interface)
elif car_params.lateralTuning.which() == 'pid':
LatControlPID(car_params, car_interface)
elif car_params.lateralTuning.which() == 'torque':
LatControlTorque(car_params, car_interface)
# Test radar interface # Test radar interface
RadarInterface = importlib.import_module(f'selfdrive.car.{car_params.carName}.radar_interface').RadarInterface RadarInterface = importlib.import_module(f'selfdrive.car.{car_params.carName}.radar_interface').RadarInterface
radar_interface = RadarInterface(car_params) radar_interface = RadarInterface(car_params)

Loading…
Cancel
Save