|
|
|
@ -12,9 +12,8 @@ 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 CanMsgType, DT_CTRL, apply_hysteresis, gen_empty_fingerprint, scale_rot_inertia, scale_tire_stiffness, get_friction, \ |
|
|
|
|
STD_CARGO_KG |
|
|
|
|
from openpilot.selfdrive.car.can_definitions import CanSendCallable |
|
|
|
|
from openpilot.selfdrive.car import DT_CTRL, apply_hysteresis, gen_empty_fingerprint, scale_rot_inertia, scale_tire_stiffness, get_friction, STD_CARGO_KG |
|
|
|
|
from openpilot.selfdrive.car.can_definitions import CanMsg, CanSendCallable |
|
|
|
|
from openpilot.selfdrive.car.conversions import Conversions as CV |
|
|
|
|
from openpilot.selfdrive.car.helpers import clip |
|
|
|
|
from openpilot.selfdrive.car.values import PLATFORMS |
|
|
|
@ -110,7 +109,7 @@ class CarInterfaceBase(ABC): |
|
|
|
|
dbc_name = "" if self.cp is None else self.cp.dbc_name |
|
|
|
|
self.CC: CarControllerBase = CarController(dbc_name, CP) |
|
|
|
|
|
|
|
|
|
def apply(self, c: car.CarControl, now_nanos: int) -> tuple[car.CarControl.Actuators, list[CanMsgType]]: |
|
|
|
|
def apply(self, c: car.CarControl, now_nanos: int) -> tuple[car.CarControl.Actuators, list[CanMsg]]: |
|
|
|
|
return self.CC.update(c, self.CS, now_nanos) |
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
@ -230,7 +229,7 @@ class CarInterfaceBase(ABC): |
|
|
|
|
def _update(self, c: car.CarControl) -> car.CarState: |
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
def update(self, c: car.CarControl, can_packets: list[tuple[int, list[CanMsgType]]]) -> car.CarState: |
|
|
|
|
def update(self, c: car.CarControl, can_packets: list[tuple[int, list[CanMsg]]]) -> car.CarState: |
|
|
|
|
# parse can |
|
|
|
|
for cp in self.can_parsers: |
|
|
|
|
if cp is not None: |
|
|
|
@ -469,7 +468,7 @@ class CarControllerBase(ABC): |
|
|
|
|
self.frame = 0 |
|
|
|
|
|
|
|
|
|
@abstractmethod |
|
|
|
|
def update(self, CC: car.CarControl.Actuators, CS: car.CarState, now_nanos: int) -> tuple[car.CarControl.Actuators, list[CanMsgType]]: |
|
|
|
|
def update(self, CC: car.CarControl.Actuators, CS: car.CarState, now_nanos: int) -> tuple[car.CarControl.Actuators, list[CanMsg]]: |
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
|
|
|