CarController: call to super's init (#33148)

* this should be common

* super!

* bump

* and frame is common

* bump
pull/32009/head
Shane Smiskol 10 months ago committed by GitHub
parent 80f9278a73
commit 1b6ac2d876
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      selfdrive/car/body/carcontroller.py
  2. 3
      selfdrive/car/chrysler/carcontroller.py
  3. 1
      selfdrive/car/chrysler/radar_interface.py
  4. 3
      selfdrive/car/ford/carcontroller.py
  5. 3
      selfdrive/car/gm/carcontroller.py
  6. 3
      selfdrive/car/honda/carcontroller.py
  7. 3
      selfdrive/car/hyundai/carcontroller.py
  8. 4
      selfdrive/car/interfaces.py
  9. 3
      selfdrive/car/mazda/carcontroller.py
  10. 3
      selfdrive/car/nissan/carcontroller.py
  11. 3
      selfdrive/car/subaru/carcontroller.py
  12. 3
      selfdrive/car/tesla/carcontroller.py
  13. 1
      selfdrive/car/tesla/radar_interface.py
  14. 3
      selfdrive/car/toyota/carcontroller.py
  15. 3
      selfdrive/car/volkswagen/carcontroller.py

@ -17,7 +17,7 @@ MAX_TURN_INTEGRATOR = 0.1 # meters
class CarController(CarControllerBase): class CarController(CarControllerBase):
def __init__(self, dbc_name, CP, VM): def __init__(self, dbc_name, CP, VM):
self.frame = 0 super().__init__(dbc_name, CP, VM)
self.packer = CANPacker(dbc_name) self.packer = CANPacker(dbc_name)
# PIDs # PIDs

@ -7,9 +7,8 @@ from openpilot.selfdrive.car.interfaces import CarControllerBase
class CarController(CarControllerBase): class CarController(CarControllerBase):
def __init__(self, dbc_name, CP, VM): def __init__(self, dbc_name, CP, VM):
self.CP = CP super().__init__(dbc_name, CP, VM)
self.apply_steer_last = 0 self.apply_steer_last = 0
self.frame = 0
self.hud_count = 0 self.hud_count = 0
self.last_lkas_falling_edge = 0 self.last_lkas_falling_edge = 0

@ -39,7 +39,6 @@ def _address_to_track(address):
class RadarInterface(RadarInterfaceBase): class RadarInterface(RadarInterfaceBase):
def __init__(self, CP): def __init__(self, CP):
super().__init__(CP) super().__init__(CP)
self.CP = CP
self.rcp = _create_radar_can_parser(CP.carFingerprint) self.rcp = _create_radar_can_parser(CP.carFingerprint)
self.updated_messages = set() self.updated_messages = set()
self.trigger_msg = LAST_MSG self.trigger_msg = LAST_MSG

@ -25,11 +25,10 @@ def apply_ford_curvature_limits(apply_curvature, apply_curvature_last, current_c
class CarController(CarControllerBase): class CarController(CarControllerBase):
def __init__(self, dbc_name, CP, VM): def __init__(self, dbc_name, CP, VM):
self.CP = CP super().__init__(dbc_name, CP, VM)
self.VM = VM self.VM = VM
self.packer = CANPacker(dbc_name) self.packer = CANPacker(dbc_name)
self.CAN = fordcan.CanBus(CP) self.CAN = fordcan.CanBus(CP)
self.frame = 0
self.apply_curvature_last = 0 self.apply_curvature_last = 0
self.main_on_last = False self.main_on_last = False

@ -19,12 +19,11 @@ MIN_STEER_MSG_INTERVAL_MS = 15
class CarController(CarControllerBase): class CarController(CarControllerBase):
def __init__(self, dbc_name, CP, VM): def __init__(self, dbc_name, CP, VM):
self.CP = CP super().__init__(dbc_name, CP, VM)
self.start_time = 0. self.start_time = 0.
self.apply_steer_last = 0 self.apply_steer_last = 0
self.apply_gas = 0 self.apply_gas = 0
self.apply_brake = 0 self.apply_brake = 0
self.frame = 0
self.last_steer_frame = 0 self.last_steer_frame = 0
self.last_button_frame = 0 self.last_button_frame = 0
self.cancel_counter = 0 self.cancel_counter = 0

@ -105,11 +105,10 @@ def rate_limit_steer(new_steer, last_steer):
class CarController(CarControllerBase): class CarController(CarControllerBase):
def __init__(self, dbc_name, CP, VM): def __init__(self, dbc_name, CP, VM):
self.CP = CP super().__init__(dbc_name, CP, VM)
self.packer = CANPacker(dbc_name) self.packer = CANPacker(dbc_name)
self.params = CarControllerParams(CP) self.params = CarControllerParams(CP)
self.CAN = hondacan.CanBus(CP) self.CAN = hondacan.CanBus(CP)
self.frame = 0
self.braking = False self.braking = False
self.brake_steady = 0. self.brake_steady = 0.

@ -44,12 +44,11 @@ def process_hud_alert(enabled, fingerprint, hud_control):
class CarController(CarControllerBase): class CarController(CarControllerBase):
def __init__(self, dbc_name, CP, VM): def __init__(self, dbc_name, CP, VM):
self.CP = CP super().__init__(dbc_name, CP, VM)
self.CAN = CanBus(CP) self.CAN = CanBus(CP)
self.params = CarControllerParams(CP) self.params = CarControllerParams(CP)
self.packer = CANPacker(dbc_name) self.packer = CANPacker(dbc_name)
self.angle_limit_counter = 0 self.angle_limit_counter = 0
self.frame = 0
self.accel_last = 0 self.accel_last = 0
self.apply_steer_last = 0 self.apply_steer_last = 0

@ -344,6 +344,7 @@ class CarInterfaceBase(ABC):
class RadarInterfaceBase(ABC): class RadarInterfaceBase(ABC):
def __init__(self, CP): def __init__(self, CP):
self.CP = CP
self.rcp = None self.rcp = None
self.pts = {} self.pts = {}
self.delay = 0 self.delay = 0
@ -466,7 +467,8 @@ SendCan = tuple[int, int, bytes, int]
class CarControllerBase(ABC): class CarControllerBase(ABC):
def __init__(self, dbc_name: str, CP, VM): def __init__(self, dbc_name: str, CP, VM):
pass self.CP = CP
self.frame = 0
@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]]:

@ -10,11 +10,10 @@ VisualAlert = car.CarControl.HUDControl.VisualAlert
class CarController(CarControllerBase): class CarController(CarControllerBase):
def __init__(self, dbc_name, CP, VM): def __init__(self, dbc_name, CP, VM):
self.CP = CP super().__init__(dbc_name, CP, VM)
self.apply_steer_last = 0 self.apply_steer_last = 0
self.packer = CANPacker(dbc_name) self.packer = CANPacker(dbc_name)
self.brake_counter = 0 self.brake_counter = 0
self.frame = 0
def update(self, CC, CS, now_nanos): def update(self, CC, CS, now_nanos):
can_sends = [] can_sends = []

@ -10,9 +10,8 @@ VisualAlert = car.CarControl.HUDControl.VisualAlert
class CarController(CarControllerBase): class CarController(CarControllerBase):
def __init__(self, dbc_name, CP, VM): def __init__(self, dbc_name, CP, VM):
self.CP = CP super().__init__(dbc_name, CP, VM)
self.car_fingerprint = CP.carFingerprint self.car_fingerprint = CP.carFingerprint
self.frame = 0
self.lkas_max_torque = 0 self.lkas_max_torque = 0
self.apply_angle_last = 0 self.apply_angle_last = 0

@ -13,9 +13,8 @@ MAX_STEER_RATE_FRAMES = 7 # tx control frames needed before torque can be cut
class CarController(CarControllerBase): class CarController(CarControllerBase):
def __init__(self, dbc_name, CP, VM): def __init__(self, dbc_name, CP, VM):
self.CP = CP super().__init__(dbc_name, CP, VM)
self.apply_steer_last = 0 self.apply_steer_last = 0
self.frame = 0
self.cruise_button_prev = 0 self.cruise_button_prev = 0
self.steer_rate_counter = 0 self.steer_rate_counter = 0

@ -8,8 +8,7 @@ from openpilot.selfdrive.car.tesla.values import DBC, CANBUS, CarControllerParam
class CarController(CarControllerBase): class CarController(CarControllerBase):
def __init__(self, dbc_name, CP, VM): def __init__(self, dbc_name, CP, VM):
self.CP = CP super().__init__(dbc_name, CP, VM)
self.frame = 0
self.apply_angle_last = 0 self.apply_angle_last = 0
self.packer = CANPacker(dbc_name) self.packer = CANPacker(dbc_name)
self.pt_packer = CANPacker(DBC[CP.carFingerprint]['pt']) self.pt_packer = CANPacker(DBC[CP.carFingerprint]['pt'])

@ -8,7 +8,6 @@ from openpilot.selfdrive.car.interfaces import RadarInterfaceBase
class RadarInterface(RadarInterfaceBase): class RadarInterface(RadarInterfaceBase):
def __init__(self, CP): def __init__(self, CP):
super().__init__(CP) super().__init__(CP)
self.CP = CP
if CP.carFingerprint == CAR.TESLA_MODELS_RAVEN: if CP.carFingerprint == CAR.TESLA_MODELS_RAVEN:
messages = [('RadarStatus', 16)] messages = [('RadarStatus', 16)]

@ -27,9 +27,8 @@ MAX_LTA_DRIVER_TORQUE_ALLOWANCE = 150 # slightly above steering pressed allows
class CarController(CarControllerBase): class CarController(CarControllerBase):
def __init__(self, dbc_name, CP, VM): def __init__(self, dbc_name, CP, VM):
self.CP = CP super().__init__(dbc_name, CP, VM)
self.params = CarControllerParams(self.CP) self.params = CarControllerParams(self.CP)
self.frame = 0
self.last_steer = 0 self.last_steer = 0
self.last_angle = 0 self.last_angle = 0
self.alert_active = False self.alert_active = False

@ -13,7 +13,7 @@ LongCtrlState = car.CarControl.Actuators.LongControlState
class CarController(CarControllerBase): class CarController(CarControllerBase):
def __init__(self, dbc_name, CP, VM): def __init__(self, dbc_name, CP, VM):
self.CP = CP super().__init__(dbc_name, CP, VM)
self.CCP = CarControllerParams(CP) self.CCP = CarControllerParams(CP)
self.CCS = pqcan if CP.flags & VolkswagenFlags.PQ else mqbcan self.CCS = pqcan if CP.flags & VolkswagenFlags.PQ else mqbcan
self.packer_pt = CANPacker(dbc_name) self.packer_pt = CANPacker(dbc_name)
@ -21,7 +21,6 @@ class CarController(CarControllerBase):
self.apply_steer_last = 0 self.apply_steer_last = 0
self.gra_acc_counter_last = None self.gra_acc_counter_last = None
self.frame = 0
self.eps_timer_soft_disable_alert = False self.eps_timer_soft_disable_alert = False
self.hca_frame_timer_running = 0 self.hca_frame_timer_running = 0
self.hca_frame_same_torque = 0 self.hca_frame_same_torque = 0

Loading…
Cancel
Save