|
|
@ -81,21 +81,16 @@ class CarInterfaceBase(ABC): |
|
|
|
self.silent_steer_warning = True |
|
|
|
self.silent_steer_warning = True |
|
|
|
self.v_ego_cluster_seen = False |
|
|
|
self.v_ego_cluster_seen = False |
|
|
|
|
|
|
|
|
|
|
|
self.CS = None |
|
|
|
self.CS = CarState(CP) |
|
|
|
self.can_parsers = [] |
|
|
|
self.cp = self.CS.get_can_parser(CP) |
|
|
|
if CarState is not None: |
|
|
|
self.cp_cam = self.CS.get_cam_can_parser(CP) |
|
|
|
self.CS = CarState(CP) |
|
|
|
self.cp_adas = self.CS.get_adas_can_parser(CP) |
|
|
|
|
|
|
|
self.cp_body = self.CS.get_body_can_parser(CP) |
|
|
|
self.cp = self.CS.get_can_parser(CP) |
|
|
|
self.cp_loopback = self.CS.get_loopback_can_parser(CP) |
|
|
|
self.cp_cam = self.CS.get_cam_can_parser(CP) |
|
|
|
self.can_parsers = [self.cp, self.cp_cam, self.cp_adas, self.cp_body, self.cp_loopback] |
|
|
|
self.cp_adas = self.CS.get_adas_can_parser(CP) |
|
|
|
|
|
|
|
self.cp_body = self.CS.get_body_can_parser(CP) |
|
|
|
dbc_name = "" if self.cp is None else self.cp.dbc_name |
|
|
|
self.cp_loopback = self.CS.get_loopback_can_parser(CP) |
|
|
|
self.CC: CarControllerBase = CarController(dbc_name, CP, self.VM) |
|
|
|
self.can_parsers = [self.cp, self.cp_cam, self.cp_adas, self.cp_body, self.cp_loopback] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.CC: CarControllerBase = None |
|
|
|
|
|
|
|
if CarController is not None: |
|
|
|
|
|
|
|
self.CC = CarController(self.cp.dbc_name, CP, self.VM) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def apply(self, c: car.CarControl, now_nanos: int) -> tuple[car.CarControl.Actuators, list[tuple[int, int, bytes, int]]]: |
|
|
|
def apply(self, c: car.CarControl, now_nanos: int) -> tuple[car.CarControl.Actuators, list[tuple[int, int, bytes, int]]]: |
|
|
|
return self.CC.update(c, self.CS, now_nanos) |
|
|
|
return self.CC.update(c, self.CS, now_nanos) |
|
|
@ -438,6 +433,10 @@ class CarStateBase(ABC): |
|
|
|
} |
|
|
|
} |
|
|
|
return d.get(gear.upper(), GearShifter.unknown) |
|
|
|
return d.get(gear.upper(), GearShifter.unknown) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
|
|
def get_can_parser(CP): |
|
|
|
|
|
|
|
return None |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
@staticmethod |
|
|
|
def get_cam_can_parser(CP): |
|
|
|
def get_cam_can_parser(CP): |
|
|
|
return None |
|
|
|
return None |
|
|
@ -459,6 +458,9 @@ SendCan = tuple[int, int, bytes, int] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CarControllerBase(ABC): |
|
|
|
class CarControllerBase(ABC): |
|
|
|
|
|
|
|
def __init__(self, dbc_name: str, CP, VM): |
|
|
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
@abstractmethod |
|
|
|
@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[SendCan]]: |
|
|
|
pass |
|
|
|
pass |
|
|
|