Add fingerprints for non-ACC cars

Co-Authored-By: Eric Brown <13560103+nworb-cire@users.noreply.github.com>
This commit is contained in:
FrogAi
2024-01-12 22:39:30 -07:00
parent 4325b86248
commit 955950381f
6 changed files with 219 additions and 26 deletions

View File

@@ -7,7 +7,7 @@ from openpilot.common.conversions import Conversions as CV
from openpilot.common.params import Params
from openpilot.selfdrive.car import create_button_events, get_safety_config
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.gm.values import CAR, CruiseButtons, CarControllerParams, EV_CAR, CAMERA_ACC_CAR, CanBus, GMFlags, CC_ONLY_CAR
from openpilot.selfdrive.car.interfaces import CarInterfaceBase, TorqueFromLateralAccelCallbackType, FRICTION_THRESHOLD
from openpilot.selfdrive.controls.lib.drive_helpers import get_friction
@@ -20,9 +20,11 @@ NetworkLocation = car.CarParams.NetworkLocation
BUTTONS_DICT = {CruiseButtons.RES_ACCEL: ButtonType.accelCruise, CruiseButtons.DECEL_SET: ButtonType.decelCruise,
CruiseButtons.MAIN: ButtonType.altButton3, CruiseButtons.CANCEL: ButtonType.cancel}
ACCELERATOR_POS_MSG = 0xbe
NON_LINEAR_TORQUE_PARAMS = {
CAR.BOLT_EUV: [2.6531724862969748, 1.0, 0.1919764879840985, 0.009054123646805178],
CAR.BOLT_CC: [2.6531724862969748, 1.0, 0.1919764879840985, 0.009054123646805178],
CAR.ACADIA: [4.78003305, 1.0, 0.3122, 0.05591772],
CAR.SILVERADO: [3.29974374, 1.0, 0.25571356, 0.0465122]
}
@@ -44,7 +46,7 @@ class CarInterface(CarInterfaceBase):
return 0.10006696 * sigmoid * (v_ego + 3.12485927)
def get_steer_feedforward_function(self):
if self.CP.carFingerprint == CAR.VOLT:
if self.CP.carFingerprint in (CAR.VOLT, CAR.VOLT_CC):
return self.get_steer_feedforward_volt
else:
return CarInterfaceBase.get_steer_feedforward_default
@@ -143,7 +145,7 @@ class CarInterface(CarInterfaceBase):
ret.radarTimeStep = 0.0667 # GM radar runs at 15Hz instead of standard 20Hz
ret.longitudinalActuatorDelayUpperBound = 0.5 # large delay to initially start braking
if candidate == CAR.VOLT:
if candidate in (CAR.VOLT, CAR.VOLT_CC):
ret.mass = 1607.
ret.wheelbase = 2.69
ret.steerRatio = 17.7 # Stock 15.7, LiveParameters
@@ -222,7 +224,7 @@ class CarInterface(CarInterfaceBase):
ret.steerActuatorDelay = 0.2
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
elif candidate == CAR.BOLT_EUV:
elif candidate in (CAR.BOLT_EUV, CAR.BOLT_CC):
ret.mass = 1669.
ret.wheelbase = 2.63779
ret.steerRatio = 16.8
@@ -244,14 +246,14 @@ class CarInterface(CarInterfaceBase):
ret.minEnableSpeed = -1.
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
elif candidate == CAR.EQUINOX:
elif candidate in (CAR.EQUINOX, CAR.EQUINOX_CC):
ret.mass = 3500. * CV.LB_TO_KG
ret.wheelbase = 2.72
ret.steerRatio = 14.4
ret.centerToFront = ret.wheelbase * 0.4
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
elif candidate == CAR.TRAILBLAZER:
elif candidate in (CAR.TRAILBLAZER, CAR.TRAILBLAZER_CC):
ret.mass = 1345.
ret.wheelbase = 2.64
ret.steerRatio = 16.8
@@ -260,6 +262,37 @@ class CarInterface(CarInterfaceBase):
ret.steerActuatorDelay = 0.2
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
elif candidate in (CAR.SUBURBAN, CAR.SUBURBAN_CC):
ret.mass = 2731.
ret.wheelbase = 3.302
ret.steerRatio = 17.3 # COPIED FROM SILVERADO
ret.centerToFront = ret.wheelbase * 0.49
ret.steerActuatorDelay = 0.075
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
elif candidate == CAR.YUKON_CC:
ret.minSteerSpeed = -1 * CV.MPH_TO_MS
ret.mass = 5602. * CV.LB_TO_KG # (3849+3708)/2
ret.wheelbase = 2.95 # 116 inches in meters
ret.steerRatio = 16.3 # guess for tourx
ret.steerRatioRear = 0. # unknown online
ret.centerToFront = 2.59 # ret.wheelbase * 0.4 # wild guess
ret.steerActuatorDelay = 0.2
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
elif candidate == CAR.CT6_CC:
ret.wheelbase = 3.11
ret.mass = 5198. * CV.LB_TO_KG
ret.centerToFront = ret.wheelbase * 0.4
ret.steerRatio = 17.7
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
if candidate in CC_ONLY_CAR:
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_NO_ACC
if ACCELERATOR_POS_MSG not in fingerprint[CanBus.POWERTRAIN]:
ret.flags |= GMFlags.NO_ACCELERATOR_POS_MSG.value
return ret
# returns a car.CarState