mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-19 00:02:08 +08:00
selfdrive/car: ban selfdrive/controls (#33211)
ban controls (VM isn't used anymore) old-commit-hash: 6c837332ea9ae854caf4f7747d3ef84101cd93c6
This commit is contained in:
@@ -9,6 +9,7 @@ source_modules =
|
||||
openpilot.selfdrive.car
|
||||
forbidden_modules =
|
||||
openpilot.common.params
|
||||
openpilot.selfdrive.controls
|
||||
openpilot.system
|
||||
openpilot.body
|
||||
openpilot.docs
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'])
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user