Use EV gas lookup tables

Co-Authored-By: Tim Wilson <7284371+twilsonco@users.noreply.github.com>
Co-Authored-By: Eric Brown <13560103+nworb-cire@users.noreply.github.com>
This commit is contained in:
FrogAi
2024-02-27 16:34:47 -07:00
parent 40a36dfcde
commit 28a898f874
7 changed files with 45 additions and 7 deletions

View File

@@ -102,6 +102,8 @@ class CarInterface(CarInterfaceBase):
ret.enableGasInterceptor = True
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_GAS_INTERCEPTOR
useEVTables = params.get_bool("EVTable")
if candidate in EV_CAR:
ret.transmissionType = TransmissionType.direct
else:
@@ -154,7 +156,7 @@ class CarInterface(CarInterfaceBase):
ret.pcmCruise = False # stock non-adaptive cruise control is kept off
# supports stop and go, but initial engage must (conservatively) be above 18mph
ret.minEnableSpeed = 18 * CV.MPH_TO_MS
ret.minSteerSpeed = 7 * CV.MPH_TO_MS
ret.minSteerSpeed = (6.7 if useEVTables else 7) * CV.MPH_TO_MS
# Tuning
ret.longitudinalTuning.kpV = [2.4, 1.5]
@@ -189,6 +191,18 @@ class CarInterface(CarInterfaceBase):
ret.lateralTuning.pid.kf = 1. # get_steer_feedforward_volt()
ret.steerActuatorDelay = 0.2
# softer long tune for ev table
if useEVTables:
ret.longitudinalTuning.kpBP = [5., 15., 35.]
ret.longitudinalTuning.kpV = [0.65, .9, 0.8]
ret.longitudinalTuning.kiBP = [5., 15.]
ret.longitudinalTuning.kiV = [0.04, 0.1]
ret.steerActuatorDelay = 0.18
ret.stoppingDecelRate = 0.02 # brake_travel/s while trying to stop
ret.stopAccel = -0.5
ret.startAccel = 0.8
ret.vEgoStopping = 0.1
elif candidate == CAR.MALIBU:
ret.mass = 1496.
ret.wheelbase = 2.83