@ -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 )