mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-21 08:14:00 +08:00
CarController: call to super's init (#33148)
* this should be common * super! * bump * and frame is common * bump old-commit-hash: 1b6ac2d876fe3170968944722df67ee815d8cb1b
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]]:
|
||||
|
||||
@@ -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 = []
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'])
|
||||
|
||||
@@ -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)]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user