mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-08 15:12:10 +08:00
remove CAN capnp conversion from car interfaces (#33218)
remove pandad from interfaces old-commit-hash: ba7a60c5a20c5f252bc89ba3e2559edf5ab65c59
This commit is contained in:
@@ -38,7 +38,6 @@ ignore_imports =
|
||||
openpilot.selfdrive.car.ecu_addrs -> openpilot.common.params
|
||||
# requires generic CAN send/receive functions
|
||||
openpilot.selfdrive.car.ecu_addrs -> openpilot.selfdrive.pandad
|
||||
openpilot.selfdrive.car.interfaces -> openpilot.selfdrive.pandad
|
||||
openpilot.selfdrive.car.isotp_parallel_query -> openpilot.selfdrive.pandad
|
||||
openpilot.selfdrive.car.tests.test_fw_fingerprint -> openpilot.selfdrive.pandad
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ from openpilot.common.params import Params
|
||||
from openpilot.common.realtime import config_realtime_process, Priority, Ratekeeper
|
||||
from openpilot.common.swaglog import cloudlog, ForwardingHandler
|
||||
|
||||
from openpilot.selfdrive.pandad import can_list_to_can_capnp
|
||||
from openpilot.selfdrive.pandad import can_capnp_to_list, can_list_to_can_capnp
|
||||
from openpilot.selfdrive.car import DT_CTRL, carlog
|
||||
from openpilot.selfdrive.car.car_helpers import get_car, get_one_can
|
||||
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
|
||||
@@ -108,7 +108,7 @@ class Car:
|
||||
|
||||
# Update carState from CAN
|
||||
can_strs = messaging.drain_sock_raw(self.can_sock, wait_for_one=True)
|
||||
CS = self.CI.update(self.CC_prev, can_strs)
|
||||
CS = self.CI.update(self.CC_prev, can_capnp_to_list(can_strs))
|
||||
|
||||
self.sm.update(0)
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ from openpilot.selfdrive.car.conversions import Conversions as CV
|
||||
from openpilot.selfdrive.car.helpers import clip
|
||||
from openpilot.selfdrive.car.values import PLATFORMS
|
||||
from openpilot.selfdrive.controls.lib.events import Events
|
||||
from openpilot.selfdrive.pandad import can_capnp_to_list
|
||||
|
||||
ButtonType = car.CarState.ButtonEvent.Type
|
||||
GearShifter = car.CarState.GearShifter
|
||||
@@ -229,12 +228,11 @@ class CarInterfaceBase(ABC):
|
||||
def _update(self, c: car.CarControl) -> car.CarState:
|
||||
pass
|
||||
|
||||
def update(self, c: car.CarControl, can_strings: list[bytes]) -> car.CarState:
|
||||
def update(self, c: car.CarControl, can_packets: list[int, list[int, bytes, int]]) -> car.CarState:
|
||||
# parse can
|
||||
can_list = can_capnp_to_list(can_strings)
|
||||
for cp in self.can_parsers:
|
||||
if cp is not None:
|
||||
cp.update_strings(can_list)
|
||||
cp.update_strings(can_packets)
|
||||
|
||||
# get CarState
|
||||
ret = self._update(c)
|
||||
|
||||
@@ -217,7 +217,7 @@ class TestCarModelBase(unittest.TestCase):
|
||||
CC = car.CarControl.new_message().as_reader()
|
||||
|
||||
for i, msg in enumerate(self.can_msgs):
|
||||
CS = self.CI.update(CC, (msg.as_builder().to_bytes(),))
|
||||
CS = self.CI.update(CC, can_capnp_to_list((msg.as_builder().to_bytes(),)))
|
||||
self.CI.apply(CC, msg.logMonoTime)
|
||||
|
||||
if CS.canValid:
|
||||
@@ -358,7 +358,7 @@ class TestCarModelBase(unittest.TestCase):
|
||||
can = messaging.new_message('can', 1)
|
||||
can.can = [log.CanData(address=address, dat=dat, src=bus)]
|
||||
|
||||
CS = self.CI.update(CC, (can.to_bytes(),))
|
||||
CS = self.CI.update(CC, can_capnp_to_list((can.to_bytes(),)))
|
||||
|
||||
if self.safety.get_gas_pressed_prev() != prev_panda_gas:
|
||||
self.assertEqual(CS.gasPressed, self.safety.get_gas_pressed_prev())
|
||||
@@ -397,7 +397,7 @@ class TestCarModelBase(unittest.TestCase):
|
||||
|
||||
# warm up pass, as initial states may be different
|
||||
for can in self.can_msgs[:300]:
|
||||
self.CI.update(CC, (can.as_builder().to_bytes(), ))
|
||||
self.CI.update(CC, can_capnp_to_list((can.as_builder().to_bytes(), )))
|
||||
for msg in filter(lambda m: m.src in range(64), can.can):
|
||||
to_send = libpanda_py.make_CANPacket(msg.address, msg.src % 4, msg.dat)
|
||||
self.safety.safety_rx_hook(to_send)
|
||||
@@ -407,7 +407,7 @@ class TestCarModelBase(unittest.TestCase):
|
||||
checks = defaultdict(int)
|
||||
card = Car(CI=self.CI)
|
||||
for idx, can in enumerate(self.can_msgs):
|
||||
CS = self.CI.update(CC, (can.as_builder().to_bytes(), ))
|
||||
CS = self.CI.update(CC, can_capnp_to_list((can.as_builder().to_bytes(), )))
|
||||
for msg in filter(lambda m: m.src in range(64), can.can):
|
||||
to_send = libpanda_py.make_CANPacket(msg.address, msg.src % 4, msg.dat)
|
||||
ret = self.safety.safety_rx_hook(to_send)
|
||||
|
||||
Reference in New Issue
Block a user