diff --git a/selfdrive/car/body/carcontroller.py b/selfdrive/car/body/carcontroller.py index c45dc7f0d2..0771d7a471 100644 --- a/selfdrive/car/body/carcontroller.py +++ b/selfdrive/car/body/carcontroller.py @@ -17,7 +17,7 @@ MAX_TURN_INTEGRATOR = 0.1 # meters class CarController(CarControllerBase): def __init__(self, dbc_name, CP, VM): - self.frame = 0 + super().__init__(dbc_name, CP, VM) self.packer = CANPacker(dbc_name) # PIDs diff --git a/selfdrive/car/chrysler/carcontroller.py b/selfdrive/car/chrysler/carcontroller.py index c9e7e2c9ed..c0c03e0e05 100644 --- a/selfdrive/car/chrysler/carcontroller.py +++ b/selfdrive/car/chrysler/carcontroller.py @@ -7,9 +7,8 @@ from openpilot.selfdrive.car.interfaces import CarControllerBase class CarController(CarControllerBase): def __init__(self, dbc_name, CP, VM): - self.CP = CP + super().__init__(dbc_name, CP, VM) self.apply_steer_last = 0 - self.frame = 0 self.hud_count = 0 self.last_lkas_falling_edge = 0 diff --git a/selfdrive/car/chrysler/radar_interface.py b/selfdrive/car/chrysler/radar_interface.py index d982958422..f1d863d1e1 100755 --- a/selfdrive/car/chrysler/radar_interface.py +++ b/selfdrive/car/chrysler/radar_interface.py @@ -39,7 +39,6 @@ def _address_to_track(address): class RadarInterface(RadarInterfaceBase): def __init__(self, CP): super().__init__(CP) - self.CP = CP self.rcp = _create_radar_can_parser(CP.carFingerprint) self.updated_messages = set() self.trigger_msg = LAST_MSG diff --git a/selfdrive/car/ford/carcontroller.py b/selfdrive/car/ford/carcontroller.py index 09bba46565..d090adf694 100644 --- a/selfdrive/car/ford/carcontroller.py +++ b/selfdrive/car/ford/carcontroller.py @@ -25,11 +25,10 @@ def apply_ford_curvature_limits(apply_curvature, apply_curvature_last, current_c class CarController(CarControllerBase): def __init__(self, dbc_name, CP, VM): - self.CP = CP + super().__init__(dbc_name, CP, VM) self.VM = VM self.packer = CANPacker(dbc_name) self.CAN = fordcan.CanBus(CP) - self.frame = 0 self.apply_curvature_last = 0 self.main_on_last = False diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py index 013e72ad0b..cac4f13ed5 100644 --- a/selfdrive/car/gm/carcontroller.py +++ b/selfdrive/car/gm/carcontroller.py @@ -19,12 +19,11 @@ MIN_STEER_MSG_INTERVAL_MS = 15 class CarController(CarControllerBase): def __init__(self, dbc_name, CP, VM): - self.CP = CP + super().__init__(dbc_name, CP, VM) self.start_time = 0. self.apply_steer_last = 0 self.apply_gas = 0 self.apply_brake = 0 - self.frame = 0 self.last_steer_frame = 0 self.last_button_frame = 0 self.cancel_counter = 0 diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 84ccf29d18..5748812648 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -105,11 +105,10 @@ def rate_limit_steer(new_steer, last_steer): class CarController(CarControllerBase): def __init__(self, dbc_name, CP, VM): - self.CP = CP + super().__init__(dbc_name, CP, VM) self.packer = CANPacker(dbc_name) self.params = CarControllerParams(CP) self.CAN = hondacan.CanBus(CP) - self.frame = 0 self.braking = False self.brake_steady = 0. diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index 75aeb0efd6..84b565f0cd 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -44,12 +44,11 @@ def process_hud_alert(enabled, fingerprint, hud_control): class CarController(CarControllerBase): def __init__(self, dbc_name, CP, VM): - self.CP = CP + super().__init__(dbc_name, CP, VM) self.CAN = CanBus(CP) self.params = CarControllerParams(CP) self.packer = CANPacker(dbc_name) self.angle_limit_counter = 0 - self.frame = 0 self.accel_last = 0 self.apply_steer_last = 0 diff --git a/selfdrive/car/interfaces.py b/selfdrive/car/interfaces.py index d37e171da7..e491de3ed6 100644 --- a/selfdrive/car/interfaces.py +++ b/selfdrive/car/interfaces.py @@ -344,6 +344,7 @@ class CarInterfaceBase(ABC): class RadarInterfaceBase(ABC): def __init__(self, CP): + self.CP = CP self.rcp = None self.pts = {} self.delay = 0 @@ -466,7 +467,8 @@ SendCan = tuple[int, int, bytes, int] class CarControllerBase(ABC): def __init__(self, dbc_name: str, CP, VM): - pass + self.CP = CP + self.frame = 0 @abstractmethod def update(self, CC: car.CarControl.Actuators, CS: car.CarState, now_nanos: int) -> tuple[car.CarControl.Actuators, list[SendCan]]: diff --git a/selfdrive/car/mazda/carcontroller.py b/selfdrive/car/mazda/carcontroller.py index 3d41634879..23441a3a78 100644 --- a/selfdrive/car/mazda/carcontroller.py +++ b/selfdrive/car/mazda/carcontroller.py @@ -10,11 +10,10 @@ VisualAlert = car.CarControl.HUDControl.VisualAlert class CarController(CarControllerBase): def __init__(self, dbc_name, CP, VM): - self.CP = CP + super().__init__(dbc_name, CP, VM) self.apply_steer_last = 0 self.packer = CANPacker(dbc_name) self.brake_counter = 0 - self.frame = 0 def update(self, CC, CS, now_nanos): can_sends = [] diff --git a/selfdrive/car/nissan/carcontroller.py b/selfdrive/car/nissan/carcontroller.py index c7bd231398..473282edfc 100644 --- a/selfdrive/car/nissan/carcontroller.py +++ b/selfdrive/car/nissan/carcontroller.py @@ -10,9 +10,8 @@ VisualAlert = car.CarControl.HUDControl.VisualAlert class CarController(CarControllerBase): def __init__(self, dbc_name, CP, VM): - self.CP = CP + super().__init__(dbc_name, CP, VM) self.car_fingerprint = CP.carFingerprint - self.frame = 0 self.lkas_max_torque = 0 self.apply_angle_last = 0 diff --git a/selfdrive/car/subaru/carcontroller.py b/selfdrive/car/subaru/carcontroller.py index 3e1b62c974..6ce006df8b 100644 --- a/selfdrive/car/subaru/carcontroller.py +++ b/selfdrive/car/subaru/carcontroller.py @@ -13,9 +13,8 @@ MAX_STEER_RATE_FRAMES = 7 # tx control frames needed before torque can be cut class CarController(CarControllerBase): def __init__(self, dbc_name, CP, VM): - self.CP = CP + super().__init__(dbc_name, CP, VM) self.apply_steer_last = 0 - self.frame = 0 self.cruise_button_prev = 0 self.steer_rate_counter = 0 diff --git a/selfdrive/car/tesla/carcontroller.py b/selfdrive/car/tesla/carcontroller.py index e460111e32..8ee2a2165e 100644 --- a/selfdrive/car/tesla/carcontroller.py +++ b/selfdrive/car/tesla/carcontroller.py @@ -8,8 +8,7 @@ from openpilot.selfdrive.car.tesla.values import DBC, CANBUS, CarControllerParam class CarController(CarControllerBase): def __init__(self, dbc_name, CP, VM): - self.CP = CP - self.frame = 0 + super().__init__(dbc_name, CP, VM) self.apply_angle_last = 0 self.packer = CANPacker(dbc_name) self.pt_packer = CANPacker(DBC[CP.carFingerprint]['pt']) diff --git a/selfdrive/car/tesla/radar_interface.py b/selfdrive/car/tesla/radar_interface.py index ae5077824b..1684e42e7f 100755 --- a/selfdrive/car/tesla/radar_interface.py +++ b/selfdrive/car/tesla/radar_interface.py @@ -8,7 +8,6 @@ from openpilot.selfdrive.car.interfaces import RadarInterfaceBase class RadarInterface(RadarInterfaceBase): def __init__(self, CP): super().__init__(CP) - self.CP = CP if CP.carFingerprint == CAR.TESLA_MODELS_RAVEN: messages = [('RadarStatus', 16)] diff --git a/selfdrive/car/toyota/carcontroller.py b/selfdrive/car/toyota/carcontroller.py index ea71dd536b..f844b7dc44 100644 --- a/selfdrive/car/toyota/carcontroller.py +++ b/selfdrive/car/toyota/carcontroller.py @@ -27,9 +27,8 @@ MAX_LTA_DRIVER_TORQUE_ALLOWANCE = 150 # slightly above steering pressed allows class CarController(CarControllerBase): def __init__(self, dbc_name, CP, VM): - self.CP = CP + super().__init__(dbc_name, CP, VM) self.params = CarControllerParams(self.CP) - self.frame = 0 self.last_steer = 0 self.last_angle = 0 self.alert_active = False diff --git a/selfdrive/car/volkswagen/carcontroller.py b/selfdrive/car/volkswagen/carcontroller.py index 8e8652d3be..228900b6e9 100644 --- a/selfdrive/car/volkswagen/carcontroller.py +++ b/selfdrive/car/volkswagen/carcontroller.py @@ -13,7 +13,7 @@ LongCtrlState = car.CarControl.Actuators.LongControlState class CarController(CarControllerBase): def __init__(self, dbc_name, CP, VM): - self.CP = CP + super().__init__(dbc_name, CP, VM) self.CCP = CarControllerParams(CP) self.CCS = pqcan if CP.flags & VolkswagenFlags.PQ else mqbcan self.packer_pt = CANPacker(dbc_name) @@ -21,7 +21,6 @@ class CarController(CarControllerBase): self.apply_steer_last = 0 self.gra_acc_counter_last = None - self.frame = 0 self.eps_timer_soft_disable_alert = False self.hca_frame_timer_running = 0 self.hca_frame_same_torque = 0