|
|
|
@ -10,7 +10,7 @@ from common.conversions import Conversions as CV |
|
|
|
|
from common.kalman.simple_kalman import KF1D |
|
|
|
|
from common.numpy_fast import interp |
|
|
|
|
from common.realtime import DT_CTRL |
|
|
|
|
from selfdrive.car import apply_hysteresis, gen_empty_fingerprint |
|
|
|
|
from selfdrive.car import apply_hysteresis, gen_empty_fingerprint, scale_rot_inertia |
|
|
|
|
from selfdrive.controls.lib.drive_helpers import V_CRUISE_MAX, apply_slack |
|
|
|
|
from selfdrive.controls.lib.events import Events |
|
|
|
|
from selfdrive.controls.lib.vehicle_model import VehicleModel |
|
|
|
@ -87,10 +87,28 @@ class CarInterfaceBase(ABC): |
|
|
|
|
def get_pid_accel_limits(CP, current_speed, cruise_speed): |
|
|
|
|
return ACCEL_MIN, ACCEL_MAX |
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
def get_params(cls, candidate: str, fingerprint: Optional[Dict[int, Dict[int, int]]] = None, car_fw: Optional[List[car.CarParams.CarFw]] = None, experimental_long: bool = False): |
|
|
|
|
if fingerprint is None: |
|
|
|
|
fingerprint = gen_empty_fingerprint() |
|
|
|
|
|
|
|
|
|
if car_fw is None: |
|
|
|
|
car_fw = list() |
|
|
|
|
|
|
|
|
|
ret = CarInterfaceBase.get_std_params(candidate) |
|
|
|
|
ret = cls._get_params(ret, candidate, fingerprint, car_fw, experimental_long) |
|
|
|
|
|
|
|
|
|
# Set common params using fields set by the car interface |
|
|
|
|
# TODO: get actual value, for now starting with reasonable value for |
|
|
|
|
# civic and scaling by mass and wheelbase |
|
|
|
|
ret.rotationalInertia = scale_rot_inertia(ret.mass, ret.wheelbase) |
|
|
|
|
|
|
|
|
|
return ret |
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
@abstractmethod |
|
|
|
|
def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, experimental_long=False): |
|
|
|
|
pass |
|
|
|
|
def _get_params(ret: car.CarParams, candidate: str, fingerprint: Dict[int, Dict[int, int]], car_fw: List[car.CarParams.CarFw], experimental_long: bool): |
|
|
|
|
raise NotImplementedError |
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
def init(CP, logcan, sendcan): |
|
|
|
@ -121,7 +139,7 @@ class CarInterfaceBase(ABC): |
|
|
|
|
|
|
|
|
|
# returns a set of default params to avoid repetition in car specific params |
|
|
|
|
@staticmethod |
|
|
|
|
def get_std_params(candidate, fingerprint): |
|
|
|
|
def get_std_params(candidate): |
|
|
|
|
ret = car.CarParams.new_message() |
|
|
|
|
ret.carFingerprint = candidate |
|
|
|
|
|
|
|
|
|