diff --git a/.importlinter b/.importlinter index 4a98922727..32e755a02f 100644 --- a/.importlinter +++ b/.importlinter @@ -77,4 +77,5 @@ ignore_imports = openpilot.selfdrive.car.car_specific -> openpilot.selfdrive.controls.lib.events openpilot.selfdrive.car.car_specific -> cereal openpilot.selfdrive.car.car_specific -> cereal.messaging + openpilot.selfdrive.car.card -> capnp unmatched_ignore_imports_alerting = warn diff --git a/selfdrive/car/__init__.py b/selfdrive/car/__init__.py index 7a95538315..4ee16095cc 100644 --- a/selfdrive/car/__init__.py +++ b/selfdrive/car/__init__.py @@ -5,8 +5,6 @@ from dataclasses import dataclass from enum import IntFlag, ReprEnum, EnumType from dataclasses import replace -import capnp - from panda.python.uds import SERVICE_TYPE from openpilot.selfdrive.car import structs from openpilot.selfdrive.car.can_definitions import CanData @@ -35,9 +33,9 @@ def apply_hysteresis(val: float, val_steady: float, hyst_gap: float) -> float: return val_steady -def create_button_events(cur_btn: int, prev_btn: int, buttons_dict: dict[int, capnp.lib.capnp._EnumModule], +def create_button_events(cur_btn: int, prev_btn: int, buttons_dict: dict[int, structs.CarState.ButtonEvent.Type], unpressed_btn: int = 0) -> list[structs.CarState.ButtonEvent]: - events: list[capnp.lib.capnp._DynamicStructBuilder] = [] + events: list[structs.CarState.ButtonEvent] = [] if cur_btn == prev_btn: return events diff --git a/selfdrive/car/interfaces.py b/selfdrive/car/interfaces.py index 7c156bcc0a..cc1454e72a 100644 --- a/selfdrive/car/interfaces.py +++ b/selfdrive/car/interfaces.py @@ -9,7 +9,6 @@ from typing import Any, NamedTuple from collections.abc import Callable from functools import cache -from cereal import car from openpilot.common.basedir import BASEDIR from openpilot.common.simple_kalman import KF1D, get_kalman_gain from openpilot.selfdrive.car import DT_CTRL, apply_hysteresis, gen_empty_fingerprint, scale_rot_inertia, scale_tire_stiffness, get_friction, STD_CARGO_KG @@ -223,7 +222,7 @@ class CarInterfaceBase(ABC): def _update(self) -> structs.CarState: return self.CS.update(*self.can_parsers) - def update(self, can_packets: list[tuple[int, list[CanData]]]) -> car.CarState: + def update(self, can_packets: list[tuple[int, list[CanData]]]) -> structs.CarState: # parse can for cp in self.can_parsers: if cp is not None: