Skip to content

Commit

Permalink
interfaces returns RadarInterfaces (#33444)
Browse files Browse the repository at this point in the history
* interfaces returns radarinterface

* bump

* bump

* bump
old-commit-hash: f94ef10
  • Loading branch information
sshane authored Sep 4, 2024
1 parent 1e92af9 commit d0f0632
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 9 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 @@ -173,7 +172,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 @@ -234,8 +233,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 d0f0632

Please sign in to comment.