From 6c837332ea9ae854caf4f7747d3ef84101cd93c6 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 6 Aug 2024 18:36:38 -0500 Subject: [PATCH] selfdrive/car: ban selfdrive/controls (#33211) ban controls (VM isn't used anymore) --- .importlinter | 1 + selfdrive/car/body/carcontroller.py | 4 ++-- selfdrive/car/chrysler/carcontroller.py | 4 ++-- selfdrive/car/ford/carcontroller.py | 5 ++--- selfdrive/car/gm/carcontroller.py | 4 ++-- selfdrive/car/honda/carcontroller.py | 4 ++-- selfdrive/car/hyundai/carcontroller.py | 4 ++-- selfdrive/car/interfaces.py | 6 ++---- selfdrive/car/mazda/carcontroller.py | 4 ++-- selfdrive/car/nissan/carcontroller.py | 4 ++-- selfdrive/car/subaru/carcontroller.py | 4 ++-- selfdrive/car/tesla/carcontroller.py | 4 ++-- selfdrive/car/toyota/carcontroller.py | 4 ++-- selfdrive/car/volkswagen/carcontroller.py | 4 ++-- 14 files changed, 27 insertions(+), 29 deletions(-) diff --git a/.importlinter b/.importlinter index 3cd74f2b9b..ef40c074f1 100644 --- a/.importlinter +++ b/.importlinter @@ -9,6 +9,7 @@ source_modules = openpilot.selfdrive.car forbidden_modules = openpilot.common.params + openpilot.selfdrive.controls openpilot.system openpilot.body openpilot.docs diff --git a/selfdrive/car/body/carcontroller.py b/selfdrive/car/body/carcontroller.py index 0771d7a471..eebf6798a2 100644 --- a/selfdrive/car/body/carcontroller.py +++ b/selfdrive/car/body/carcontroller.py @@ -16,8 +16,8 @@ MAX_TURN_INTEGRATOR = 0.1 # meters class CarController(CarControllerBase): - def __init__(self, dbc_name, CP, VM): - super().__init__(dbc_name, CP, VM) + def __init__(self, dbc_name, CP): + super().__init__(dbc_name, CP) self.packer = CANPacker(dbc_name) # PIDs diff --git a/selfdrive/car/chrysler/carcontroller.py b/selfdrive/car/chrysler/carcontroller.py index c0c03e0e05..c194488de9 100644 --- a/selfdrive/car/chrysler/carcontroller.py +++ b/selfdrive/car/chrysler/carcontroller.py @@ -6,8 +6,8 @@ from openpilot.selfdrive.car.interfaces import CarControllerBase class CarController(CarControllerBase): - def __init__(self, dbc_name, CP, VM): - super().__init__(dbc_name, CP, VM) + def __init__(self, dbc_name, CP): + super().__init__(dbc_name, CP) self.apply_steer_last = 0 self.hud_count = 0 diff --git a/selfdrive/car/ford/carcontroller.py b/selfdrive/car/ford/carcontroller.py index b63b741ee7..9628dc651d 100644 --- a/selfdrive/car/ford/carcontroller.py +++ b/selfdrive/car/ford/carcontroller.py @@ -23,9 +23,8 @@ def apply_ford_curvature_limits(apply_curvature, apply_curvature_last, current_c class CarController(CarControllerBase): - def __init__(self, dbc_name, CP, VM): - super().__init__(dbc_name, CP, VM) - self.VM = VM + def __init__(self, dbc_name, CP): + super().__init__(dbc_name, CP) self.packer = CANPacker(dbc_name) self.CAN = fordcan.CanBus(CP) diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py index cac4f13ed5..cffaf4791d 100644 --- a/selfdrive/car/gm/carcontroller.py +++ b/selfdrive/car/gm/carcontroller.py @@ -18,8 +18,8 @@ MIN_STEER_MSG_INTERVAL_MS = 15 class CarController(CarControllerBase): - def __init__(self, dbc_name, CP, VM): - super().__init__(dbc_name, CP, VM) + def __init__(self, dbc_name, CP): + super().__init__(dbc_name, CP) self.start_time = 0. self.apply_steer_last = 0 self.apply_gas = 0 diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 5748812648..86815ae9f5 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -104,8 +104,8 @@ def rate_limit_steer(new_steer, last_steer): class CarController(CarControllerBase): - def __init__(self, dbc_name, CP, VM): - super().__init__(dbc_name, CP, VM) + def __init__(self, dbc_name, CP): + super().__init__(dbc_name, CP) self.packer = CANPacker(dbc_name) self.params = CarControllerParams(CP) self.CAN = hondacan.CanBus(CP) diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index 84b565f0cd..e6bc83283e 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -43,8 +43,8 @@ def process_hud_alert(enabled, fingerprint, hud_control): class CarController(CarControllerBase): - def __init__(self, dbc_name, CP, VM): - super().__init__(dbc_name, CP, VM) + def __init__(self, dbc_name, CP): + super().__init__(dbc_name, CP) self.CAN = CanBus(CP) self.params = CarControllerParams(CP) self.packer = CANPacker(dbc_name) diff --git a/selfdrive/car/interfaces.py b/selfdrive/car/interfaces.py index f8d71ad341..fcdc3d77fe 100644 --- a/selfdrive/car/interfaces.py +++ b/selfdrive/car/interfaces.py @@ -16,7 +16,6 @@ from openpilot.common.numpy_fast import clip 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.values import PLATFORMS from openpilot.selfdrive.controls.lib.events import Events -from openpilot.selfdrive.controls.lib.vehicle_model import VehicleModel from openpilot.selfdrive.pandad import can_capnp_to_list ButtonType = car.CarState.ButtonEvent.Type @@ -91,7 +90,6 @@ def get_torque_params(): class CarInterfaceBase(ABC): def __init__(self, CP, CarController, CarState): self.CP = CP - self.VM = VehicleModel(CP) self.frame = 0 self.steering_unpressed = 0 @@ -109,7 +107,7 @@ class CarInterfaceBase(ABC): self.can_parsers = [self.cp, self.cp_cam, self.cp_adas, self.cp_body, self.cp_loopback] dbc_name = "" if self.cp is None else self.cp.dbc_name - self.CC: CarControllerBase = CarController(dbc_name, CP, self.VM) + self.CC: CarControllerBase = CarController(dbc_name, CP) def apply(self, c: car.CarControl, now_nanos: int) -> tuple[car.CarControl.Actuators, list[SendCan]]: return self.CC.update(c, self.CS, now_nanos) @@ -466,7 +464,7 @@ class CarStateBase(ABC): class CarControllerBase(ABC): - def __init__(self, dbc_name: str, CP, VM): + def __init__(self, dbc_name: str, CP): self.CP = CP self.frame = 0 diff --git a/selfdrive/car/mazda/carcontroller.py b/selfdrive/car/mazda/carcontroller.py index 23441a3a78..910e2303d8 100644 --- a/selfdrive/car/mazda/carcontroller.py +++ b/selfdrive/car/mazda/carcontroller.py @@ -9,8 +9,8 @@ VisualAlert = car.CarControl.HUDControl.VisualAlert class CarController(CarControllerBase): - def __init__(self, dbc_name, CP, VM): - super().__init__(dbc_name, CP, VM) + def __init__(self, dbc_name, CP): + super().__init__(dbc_name, CP) self.apply_steer_last = 0 self.packer = CANPacker(dbc_name) self.brake_counter = 0 diff --git a/selfdrive/car/nissan/carcontroller.py b/selfdrive/car/nissan/carcontroller.py index 473282edfc..35a70ff106 100644 --- a/selfdrive/car/nissan/carcontroller.py +++ b/selfdrive/car/nissan/carcontroller.py @@ -9,8 +9,8 @@ VisualAlert = car.CarControl.HUDControl.VisualAlert class CarController(CarControllerBase): - def __init__(self, dbc_name, CP, VM): - super().__init__(dbc_name, CP, VM) + def __init__(self, dbc_name, CP): + super().__init__(dbc_name, CP) self.car_fingerprint = CP.carFingerprint self.lkas_max_torque = 0 diff --git a/selfdrive/car/subaru/carcontroller.py b/selfdrive/car/subaru/carcontroller.py index 6ce006df8b..acabc2ca5a 100644 --- a/selfdrive/car/subaru/carcontroller.py +++ b/selfdrive/car/subaru/carcontroller.py @@ -12,8 +12,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): - super().__init__(dbc_name, CP, VM) + def __init__(self, dbc_name, CP): + super().__init__(dbc_name, CP) self.apply_steer_last = 0 self.cruise_button_prev = 0 diff --git a/selfdrive/car/tesla/carcontroller.py b/selfdrive/car/tesla/carcontroller.py index 8ee2a2165e..32d83dfb68 100644 --- a/selfdrive/car/tesla/carcontroller.py +++ b/selfdrive/car/tesla/carcontroller.py @@ -7,8 +7,8 @@ from openpilot.selfdrive.car.tesla.values import DBC, CANBUS, CarControllerParam class CarController(CarControllerBase): - def __init__(self, dbc_name, CP, VM): - super().__init__(dbc_name, CP, VM) + def __init__(self, dbc_name, CP): + super().__init__(dbc_name, CP) self.apply_angle_last = 0 self.packer = CANPacker(dbc_name) self.pt_packer = CANPacker(DBC[CP.carFingerprint]['pt']) diff --git a/selfdrive/car/toyota/carcontroller.py b/selfdrive/car/toyota/carcontroller.py index f844b7dc44..f33f8673ea 100644 --- a/selfdrive/car/toyota/carcontroller.py +++ b/selfdrive/car/toyota/carcontroller.py @@ -26,8 +26,8 @@ MAX_LTA_DRIVER_TORQUE_ALLOWANCE = 150 # slightly above steering pressed allows class CarController(CarControllerBase): - def __init__(self, dbc_name, CP, VM): - super().__init__(dbc_name, CP, VM) + def __init__(self, dbc_name, CP): + super().__init__(dbc_name, CP) self.params = CarControllerParams(self.CP) self.last_steer = 0 self.last_angle = 0 diff --git a/selfdrive/car/volkswagen/carcontroller.py b/selfdrive/car/volkswagen/carcontroller.py index 228900b6e9..dda8de6cab 100644 --- a/selfdrive/car/volkswagen/carcontroller.py +++ b/selfdrive/car/volkswagen/carcontroller.py @@ -12,8 +12,8 @@ LongCtrlState = car.CarControl.Actuators.LongControlState class CarController(CarControllerBase): - def __init__(self, dbc_name, CP, VM): - super().__init__(dbc_name, CP, VM) + def __init__(self, dbc_name, CP): + super().__init__(dbc_name, CP) self.CCP = CarControllerParams(CP) self.CCS = pqcan if CP.flags & VolkswagenFlags.PQ else mqbcan self.packer_pt = CANPacker(dbc_name)