diff --git a/selfdrive/car/__init__.py b/selfdrive/car/__init__.py index a34452e5ca..5f806ee2ff 100644 --- a/selfdrive/car/__init__.py +++ b/selfdrive/car/__init__.py @@ -9,8 +9,8 @@ import capnp from cereal import car from panda.python.uds import SERVICE_TYPE -from openpilot.selfdrive.car.can_definitions import CanData from openpilot.selfdrive.car import structs +from openpilot.selfdrive.car.can_definitions import CanData from openpilot.selfdrive.car.docs_definitions import CarDocs from openpilot.selfdrive.car.helpers import clip, interp diff --git a/selfdrive/car/ford/carstate.py b/selfdrive/car/ford/carstate.py index 64d7e4e782..14c3174163 100644 --- a/selfdrive/car/ford/carstate.py +++ b/selfdrive/car/ford/carstate.py @@ -1,7 +1,7 @@ from opendbc.can.can_define import CANDefine from opendbc.can.parser import CANParser -from openpilot.selfdrive.car.conversions import Conversions as CV from openpilot.selfdrive.car import structs +from openpilot.selfdrive.car.conversions import Conversions as CV from openpilot.selfdrive.car.ford.fordcan import CanBus from openpilot.selfdrive.car.ford.values import DBC, CarControllerParams, FordFlags from openpilot.selfdrive.car.interfaces import CarStateBase diff --git a/selfdrive/car/interfaces.py b/selfdrive/car/interfaces.py index 2d40b86f84..00333aac14 100644 --- a/selfdrive/car/interfaces.py +++ b/selfdrive/car/interfaces.py @@ -101,7 +101,7 @@ class CarInterfaceBase(ABC): # TODO: this # self.CS: CarStateBase = CarState(CP) - self.CS = CarState(CP) + self.CS: CarStateBase = CarState(CP) self.cp = self.CS.get_can_parser(CP) self.cp_cam = self.CS.get_cam_can_parser(CP) self.cp_adas = self.CS.get_adas_can_parser(CP) @@ -385,10 +385,9 @@ class CarStateBase(ABC): K = get_kalman_gain(DT_CTRL, np.array(A), np.array(C), np.array(Q), R) self.v_ego_kf = KF1D(x0=x0, A=A, C=C[0], K=K) - # TODO: this - # @abstractmethod - # def update(self, *args) -> structs.CarState: - # raise NotImplementedError + @abstractmethod + def update(self, *args) -> structs.CarState: + pass def update_speed_kf(self, v_ego_raw): if abs(v_ego_raw - self.v_ego_kf.x[0][0]) > 2.0: # Prevent large accelerations when car starts at non zero speed diff --git a/selfdrive/car/toyota/carstate.py b/selfdrive/car/toyota/carstate.py index b6f16e96be..6088f89f30 100644 --- a/selfdrive/car/toyota/carstate.py +++ b/selfdrive/car/toyota/carstate.py @@ -2,9 +2,8 @@ import copy from opendbc.can.can_define import CANDefine from opendbc.can.parser import CANParser -from openpilot.selfdrive.car import DT_CTRL +from openpilot.selfdrive.car import DT_CTRL, structs from openpilot.selfdrive.car.conversions import Conversions as CV -from openpilot.selfdrive.car import structs from openpilot.selfdrive.car.filter_simple import FirstOrderFilter from openpilot.selfdrive.car.helpers import mean from openpilot.selfdrive.car.interfaces import CarStateBase diff --git a/selfdrive/car/toyota/interface.py b/selfdrive/car/toyota/interface.py index c7c6fe0da1..58778c7b97 100644 --- a/selfdrive/car/toyota/interface.py +++ b/selfdrive/car/toyota/interface.py @@ -1,10 +1,10 @@ from cereal import car from panda import Panda from panda.python import uds +from openpilot.selfdrive.car.toyota.carstate import CarState from openpilot.selfdrive.car.toyota.values import Ecu, CAR, DBC, ToyotaFlags, CarControllerParams, TSS2_CAR, RADAR_ACC_CAR, NO_DSU_CAR, \ MIN_ACC_SPEED, EPS_SCALE, UNSUPPORTED_DSU_CAR, NO_STOP_TIMER_CAR, ANGLE_CONTROL_CAR -from openpilot.selfdrive.car import create_button_events, get_safety_config -from openpilot.selfdrive.car import structs +from openpilot.selfdrive.car import create_button_events, get_safety_config, structs from openpilot.selfdrive.car.disable_ecu import disable_ecu from openpilot.selfdrive.car.interfaces import CarInterfaceBase @@ -14,6 +14,8 @@ SteerControlType = structs.CarParams.SteerControlType class CarInterface(CarInterfaceBase): + CS: CarState + @staticmethod def get_pid_accel_limits(CP, current_speed, cruise_speed): return CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX