Skip to content

Commit

Permalink
interfaces returns radarinterface
Browse files Browse the repository at this point in the history
  • Loading branch information
sshane committed Sep 3, 2024
1 parent 3924ac5 commit 9ad1f09
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion selfdrive/car/tests/test_car_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,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
6 changes: 2 additions & 4 deletions selfdrive/car/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import copy
import dataclasses
import os
import importlib
import pytest
import random
import unittest # noqa: TID251
Expand Down Expand Up @@ -171,7 +170,7 @@ def setUpClass(cls):

cls.can_msgs = sorted(can_msgs, key=lambda msg: msg.logMonoTime)

cls.CarInterface, cls.CarController, cls.CarState = interfaces[cls.platform]
cls.CarInterface, cls.CarController, cls.CarState, cls.RadarInterface = interfaces[cls.platform]
cls.CP = cls.CarInterface.get_params(cls.platform, cls.fingerprint, car_fw, experimental_long, docs=False)
assert cls.CP
assert cls.CP.carFingerprint == cls.platform
Expand Down Expand Up @@ -232,8 +231,7 @@ def test_car_interface(self):
self.assertEqual(can_invalid_cnt, 0)

def test_radar_interface(self):
RadarInterface = importlib.import_module(f'opendbc.car.{self.CP.carName}.radar_interface').RadarInterface
RI = RadarInterface(self.CP)
RI = self.RadarInterface(self.CP)
assert RI

# Since OBD port is multiplexed to bus 1 (commonly radar bus) while fingerprinting,
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/controls/lib/tests/test_latcontrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class TestLatControl:

@parameterized.expand([(HONDA.HONDA_CIVIC, LatControlPID), (TOYOTA.TOYOTA_RAV4, LatControlTorque), (NISSAN.NISSAN_LEAF, LatControlAngle)])
def test_saturation(self, car_name, controller):
CarInterface, CarController, CarState = interfaces[car_name]
CarInterface, CarController, CarState, RadarInterface = interfaces[car_name]
CP = CarInterface.get_non_essential_params(car_name)
CI = CarInterface(CP, CarController, CarState)
CP = convert_to_capnp(CP)
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/controls/tests/test_state_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def make_event(event_types):
class TestStateMachine:

def setup_method(self):
CarInterface, CarController, CarState = interfaces[MOCK.MOCK]
CarInterface, CarController, CarState, RadarInterface = interfaces[MOCK.MOCK]
CP = CarInterface.get_non_essential_params(MOCK.MOCK)
CI = CarInterface(CP, CarController, CarState)

Expand Down
2 changes: 1 addition & 1 deletion selfdrive/test/process_replay/process_replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def card_fingerprint_callback(rc, pm, msgs, fingerprint):
def get_car_params_callback(rc, pm, msgs, fingerprint):
params = Params()
if fingerprint:
CarInterface, _, _ = interfaces[fingerprint]
CarInterface, _, _, _ = interfaces[fingerprint]
CP = CarInterface.get_non_essential_params(fingerprint)
else:
can = DummySocket()
Expand Down

0 comments on commit 9ad1f09

Please sign in to comment.