mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-08-07 17:25:40 +08:00
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 22cc9f814c0699f7046970763663205907f2890b. * stash bad * just freaking merge * sort * rm
This commit is contained in:
@@ -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.fw_versions import FW_VERSIONS
|
||||
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
|
||||
|
||||
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)
|
||||
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
|
||||
RadarInterface = importlib.import_module(f'selfdrive.car.{car_params.carName}.radar_interface').RadarInterface
|
||||
radar_interface = RadarInterface(car_params)
|
||||
|
||||
Reference in New Issue
Block a user