Skip to content

Commit

Permalink
interfaces returns RadarInterface (#1217)
Browse files Browse the repository at this point in the history
interfaces returns radarinterface
  • Loading branch information
sshane authored Sep 3, 2024
1 parent ca3b5c4 commit e1318f2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion opendbc/car/car_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
4 changes: 1 addition & 3 deletions opendbc/car/tests/test_car_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion opendbc/car/tests/test_lateral_limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit e1318f2

Please sign in to comment.