From e1318f21acbc2625816e18acddedf40083f99cfd Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 3 Sep 2024 15:53:06 -0700 Subject: [PATCH] interfaces returns RadarInterface (#1217) interfaces returns radarinterface --- opendbc/car/car_helpers.py | 3 ++- opendbc/car/tests/test_car_interfaces.py | 4 +--- opendbc/car/tests/test_lateral_limits.py | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/opendbc/car/car_helpers.py b/opendbc/car/car_helpers.py index f94c88ba8e..4d8cbabaa4 100644 --- a/opendbc/car/car_helpers.py +++ b/opendbc/car/car_helpers.py @@ -20,8 +20,9 @@ def load_interfaces(brand_names): CarInterface = __import__(path + '.interface', fromlist=['CarInterface']).CarInterface CarState = __import__(path + '.carstate', fromlist=['CarState']).CarState CarController = __import__(path + '.carcontroller', fromlist=['CarController']).CarController + RadarInterface = __import__(path + '.radar_interface', fromlist=['RadarInterface']).RadarInterface for model_name in brand_names[brand_name]: - ret[model_name] = (CarInterface, CarController, CarState) + ret[model_name] = (CarInterface, CarController, CarState, RadarInterface) return ret diff --git a/opendbc/car/tests/test_car_interfaces.py b/opendbc/car/tests/test_car_interfaces.py index f54bb3edae..0066c97b5d 100644 --- a/opendbc/car/tests/test_car_interfaces.py +++ b/opendbc/car/tests/test_car_interfaces.py @@ -2,7 +2,6 @@ import math import hypothesis.strategies as st from hypothesis import Phase, given, settings -import importlib from parameterized import parameterized from collections.abc import Callable from typing import Any @@ -54,7 +53,7 @@ class TestCarInterfaces: phases=(Phase.reuse, Phase.generate, Phase.shrink)) @given(data=st.data()) def test_car_interfaces(self, car_name, data): - CarInterface, CarController, CarState = interfaces[car_name] + CarInterface, CarController, CarState, RadarInterface = interfaces[car_name] args = get_fuzzy_car_interface_args(data.draw) @@ -104,7 +103,6 @@ def test_car_interfaces(self, car_name, data): now_nanos += DT_CTRL * 1e9 # 10ms # Test radar interface - RadarInterface = importlib.import_module(f'opendbc.car.{car_params.carName}.radar_interface').RadarInterface radar_interface = RadarInterface(car_params) assert radar_interface diff --git a/opendbc/car/tests/test_lateral_limits.py b/opendbc/car/tests/test_lateral_limits.py index 87c7a5e256..585289968d 100755 --- a/opendbc/car/tests/test_lateral_limits.py +++ b/opendbc/car/tests/test_lateral_limits.py @@ -28,7 +28,7 @@ class TestLateralLimits: @classmethod def setup_class(cls): - CarInterface, _, _ = interfaces[cls.car_model] + CarInterface, _, _, _ = interfaces[cls.car_model] CP = CarInterface.get_non_essential_params(cls.car_model) if CP.dashcamOnly: