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-01-12 22:39:30 -07:00
parent 882713b26e
commit fe8322fd5d
5 changed files with 40 additions and 5 deletions

View File

@@ -91,6 +91,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:
@@ -142,7 +144,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]
@@ -177,6 +179,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