|
|
|
@ -8,6 +8,7 @@ from panda import Panda |
|
|
|
|
from openpilot.common.basedir import BASEDIR |
|
|
|
|
from openpilot.selfdrive.car import create_button_events, get_safety_config, get_friction |
|
|
|
|
from openpilot.selfdrive.car.conversions import Conversions as CV |
|
|
|
|
from openpilot.selfdrive.car.data_structures import CarParams |
|
|
|
|
from openpilot.selfdrive.car.gm.radar_interface import RADAR_HEADER_MSG |
|
|
|
|
from openpilot.selfdrive.car.gm.values import CAR, CruiseButtons, CarControllerParams, EV_CAR, CAMERA_ACC_CAR, CanBus |
|
|
|
|
from openpilot.selfdrive.car.interfaces import CarInterfaceBase, TorqueFromLateralAccelCallbackType, FRICTION_THRESHOLD, LatControlInputs, NanoFFModel |
|
|
|
@ -88,7 +89,7 @@ class CarInterface(CarInterfaceBase): |
|
|
|
|
return self.torque_from_lateral_accel_linear |
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): |
|
|
|
|
def _get_params(ret: CarParams, candidate, fingerprint, car_fw, experimental_long, docs): |
|
|
|
|
ret.carName = "gm" |
|
|
|
|
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.gm)] |
|
|
|
|
ret.autoResumeSng = False |
|
|
|
@ -140,9 +141,9 @@ class CarInterface(CarInterfaceBase): |
|
|
|
|
(ret.networkLocation == NetworkLocation.gateway and ret.radarUnavailable) |
|
|
|
|
|
|
|
|
|
# Start with a baseline tuning for all GM vehicles. Override tuning as needed in each model section below. |
|
|
|
|
ret.lateralTuning.kiBP, ret.lateralTuning.kpBP = [[0.], [0.]] |
|
|
|
|
ret.lateralTuning.kpV, ret.lateralTuning.kiV = [[0.2], [0.00]] |
|
|
|
|
ret.lateralTuning.kf = 0.00004 # full torque for 20 deg at 80mph means 0.00007818594 |
|
|
|
|
ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[0.], [0.]] |
|
|
|
|
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2], [0.00]] |
|
|
|
|
ret.lateralTuning.pid.kf = 0.00004 # full torque for 20 deg at 80mph means 0.00007818594 |
|
|
|
|
ret.steerActuatorDelay = 0.1 # Default delay, not measured yet |
|
|
|
|
|
|
|
|
|
ret.steerLimitTimer = 0.4 |
|
|
|
@ -150,39 +151,39 @@ class CarInterface(CarInterfaceBase): |
|
|
|
|
ret.longitudinalActuatorDelay = 0.5 # large delay to initially start braking |
|
|
|
|
|
|
|
|
|
if candidate == CAR.CHEVROLET_VOLT: |
|
|
|
|
ret.lateralTuning.kpBP = [0., 40.] |
|
|
|
|
ret.lateralTuning.kpV = [0., 0.17] |
|
|
|
|
ret.lateralTuning.kiBP = [0.] |
|
|
|
|
ret.lateralTuning.kiV = [0.] |
|
|
|
|
ret.lateralTuning.kf = 1. # get_steer_feedforward_volt() |
|
|
|
|
ret.lateralTuning.pid.kpBP = [0., 40.] |
|
|
|
|
ret.lateralTuning.pid.kpV = [0., 0.17] |
|
|
|
|
ret.lateralTuning.pid.kiBP = [0.] |
|
|
|
|
ret.lateralTuning.pid.kiV = [0.] |
|
|
|
|
ret.lateralTuning.pid.kf = 1. # get_steer_feedforward_volt() |
|
|
|
|
ret.steerActuatorDelay = 0.2 |
|
|
|
|
|
|
|
|
|
elif candidate == CAR.GMC_ACADIA: |
|
|
|
|
ret.minEnableSpeed = -1. # engage speed is decided by pcm |
|
|
|
|
ret.steerActuatorDelay = 0.2 |
|
|
|
|
CarInterfaceBase.configure_torque_tune(candidate, ret) |
|
|
|
|
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) |
|
|
|
|
|
|
|
|
|
elif candidate == CAR.BUICK_LACROSSE: |
|
|
|
|
CarInterfaceBase.configure_torque_tune(candidate, ret) |
|
|
|
|
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) |
|
|
|
|
|
|
|
|
|
elif candidate == CAR.CADILLAC_ESCALADE: |
|
|
|
|
ret.minEnableSpeed = -1. # engage speed is decided by pcm |
|
|
|
|
CarInterfaceBase.configure_torque_tune(candidate, ret) |
|
|
|
|
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) |
|
|
|
|
|
|
|
|
|
elif candidate in (CAR.CADILLAC_ESCALADE_ESV, CAR.CADILLAC_ESCALADE_ESV_2019): |
|
|
|
|
ret.minEnableSpeed = -1. # engage speed is decided by pcm |
|
|
|
|
|
|
|
|
|
if candidate == CAR.CADILLAC_ESCALADE_ESV: |
|
|
|
|
ret.lateralTuning.kiBP, ret.lateralTuning.kpBP = [[10., 41.0], [10., 41.0]] |
|
|
|
|
ret.lateralTuning.kpV, ret.lateralTuning.kiV = [[0.13, 0.24], [0.01, 0.02]] |
|
|
|
|
ret.lateralTuning.kf = 0.000045 |
|
|
|
|
ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[10., 41.0], [10., 41.0]] |
|
|
|
|
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.13, 0.24], [0.01, 0.02]] |
|
|
|
|
ret.lateralTuning.pid.kf = 0.000045 |
|
|
|
|
else: |
|
|
|
|
ret.steerActuatorDelay = 0.2 |
|
|
|
|
CarInterfaceBase.configure_torque_tune(candidate, ret) |
|
|
|
|
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) |
|
|
|
|
|
|
|
|
|
elif candidate == CAR.CHEVROLET_BOLT_EUV: |
|
|
|
|
ret.steerActuatorDelay = 0.2 |
|
|
|
|
CarInterfaceBase.configure_torque_tune(candidate, ret) |
|
|
|
|
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) |
|
|
|
|
|
|
|
|
|
elif candidate == CAR.CHEVROLET_SILVERADO: |
|
|
|
|
# On the Bolt, the ECM and camera independently check that you are either above 5 kph or at a stop |
|
|
|
@ -190,14 +191,14 @@ class CarInterface(CarInterfaceBase): |
|
|
|
|
# TODO: check if this is split by EV/ICE with more platforms in the future |
|
|
|
|
if ret.openpilotLongitudinalControl: |
|
|
|
|
ret.minEnableSpeed = -1. |
|
|
|
|
CarInterfaceBase.configure_torque_tune(candidate, ret) |
|
|
|
|
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) |
|
|
|
|
|
|
|
|
|
elif candidate == CAR.CHEVROLET_EQUINOX: |
|
|
|
|
CarInterfaceBase.configure_torque_tune(candidate, ret) |
|
|
|
|
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) |
|
|
|
|
|
|
|
|
|
elif candidate == CAR.CHEVROLET_TRAILBLAZER: |
|
|
|
|
ret.steerActuatorDelay = 0.2 |
|
|
|
|
CarInterfaceBase.configure_torque_tune(candidate, ret) |
|
|
|
|
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) |
|
|
|
|
|
|
|
|
|
return ret |
|
|
|
|
|
|
|
|
|