|
|
|
@ -12,7 +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 DT_CTRL, apply_hysteresis, gen_empty_fingerprint, scale_rot_inertia, scale_tire_stiffness, get_friction, STD_CARGO_KG |
|
|
|
|
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.conversions import Conversions as CV |
|
|
|
|
from openpilot.selfdrive.car.helpers import clip |
|
|
|
@ -53,7 +54,6 @@ class LatControlInputs(NamedTuple): |
|
|
|
|
aego: float |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SendCan = tuple[int, bytes, int] |
|
|
|
|
TorqueFromLateralAccelCallbackType = Callable[[LatControlInputs, car.CarParams.LateralTorqueTuning, float, float, bool, bool], float] |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -110,7 +110,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[SendCan]]: |
|
|
|
|
def apply(self, c: car.CarControl, now_nanos: int) -> tuple[car.CarControl.Actuators, list[CanMsgType]]: |
|
|
|
|
return self.CC.update(c, self.CS, now_nanos) |
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
@ -230,7 +230,7 @@ class CarInterfaceBase(ABC): |
|
|
|
|
def _update(self, c: car.CarControl) -> car.CarState: |
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
def update(self, c: car.CarControl, can_packets: list[int, list[int, bytes, int]]) -> car.CarState: |
|
|
|
|
def update(self, c: car.CarControl, can_packets: list[tuple[int, list[CanMsgType]]]) -> car.CarState: |
|
|
|
|
# parse can |
|
|
|
|
for cp in self.can_parsers: |
|
|
|
|
if cp is not None: |
|
|
|
@ -469,7 +469,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[SendCan]]: |
|
|
|
|
def update(self, CC: car.CarControl.Actuators, CS: car.CarState, now_nanos: int) -> tuple[car.CarControl.Actuators, list[CanMsgType]]: |
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
|
|
|