Toyota longitudinal: TSS2 custom tuning behind toggle (#186)

* Toyota longitudinal: TSS2 custom tuning behind toggle

* cleanup

* add param

* Update CHANGELOGS.md

* Update CHANGELOGS.md
This commit is contained in:
Jason Wen
2023-06-26 12:28:20 -04:00
committed by GitHub
parent f7f90fd847
commit 2b506e49f0
3 changed files with 12 additions and 6 deletions
+3 -1
View File
@@ -5,8 +5,10 @@ sunnypilot - 0.9.3.1 (2023-XX-XX)
* NEW❗: HKG CAN: Smoother Stopping Performance (Beta) toggle
* Smoother stopping behind a stopped car or desired stopping event.
* This is only applicable to HKG CAN platforms using openpilot longitudinal control
* NEW❗: Toyota: TSS2 longitudinal: Custom Tuning
* Smoother longitudinal performance for Toyota/Lexus TSS2/LSS2 cars thanks to dragonpilot-community!
* DISABLED: Screen Recorder
* UI sometimes crashes on startup along with screen recorder, will reimplement in future updates
* UI sometimes crashes on startup along with screen recorder, will reimplement in future updates
sunnypilot - 0.9.2.3 (2023-06-18)
========================
+1
View File
@@ -291,6 +291,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"TorqueDeadzoneDeg", PERSISTENT},
{"TorqueFriction", PERSISTENT},
{"TorqueMaxLatAccel", PERSISTENT},
{"ToyotaTSS2Long", PERSISTENT},
{"TrueVEgoUi", PERSISTENT},
{"TurnSpeedControl", PERSISTENT},
{"TurnVisionControl", PERSISTENT},
+8 -5
View File
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
from cereal import car
from common.conversions import Conversions as CV
from common.params import Params
from panda import Panda
from selfdrive.car.toyota.values import Ecu, CAR, DBC, ToyotaFlags, CarControllerParams, TSS2_CAR, RADAR_ACC_CAR, NO_DSU_CAR, \
MIN_ACC_SPEED, EPS_SCALE, EV_HYBRID_CAR, UNSUPPORTED_DSU_CAR, NO_STOP_TIMER_CAR, ANGLE_CONTROL_CAR
@@ -228,18 +229,20 @@ class CarInterface(CarInterfaceBase):
# to a negative value, so it won't matter.
ret.minEnableSpeed = -1. if (stop_and_go or ret.enableGasInterceptor) else MIN_ACC_SPEED
sp_tss2_long_tune = Params().get_bool("ToyotaTSS2Long")
tune = ret.longitudinalTuning
tune.deadzoneBP = [0., 9.]
tune.deadzoneV = [.0, .15]
if candidate in TSS2_CAR or ret.enableGasInterceptor:
tune.kpBP = [0., 5., 20., 30.]
tune.kpV = [1.3, 1.0, 0.7, 0.1]
tune.kiBP = [0., 8.3, 11.9, 13.8, 19.7, 30., 33., 40.]
tune.kiV = [.02, .03, .14, .18, .18, .06, .01, .001]
tune.kpBP = [0., 5., 20., 30.] if sp_tss2_long_tune else [0., 5., 20.]
tune.kpV = [1.3, 1.0, 0.7, 0.1] if sp_tss2_long_tune else [1.3, 1.0, 0.7]
tune.kiBP = [0., 8.3, 11.9, 13.8, 19.7, 30., 33., 40.] if sp_tss2_long_tune else [0., 5., 12., 20., 27.]
tune.kiV = [.02, .03, .14, .18, .18, .06, .01, .001] if sp_tss2_long_tune else [.35, .23, .20, .17, .1]
if candidate in TSS2_CAR:
ret.vEgoStopping = 0.25
ret.vEgoStarting = 0.25
ret.stoppingDecelRate = 0.009 # reach stopping target smoothly
ret.stoppingDecelRate = 0.009 if sp_tss2_long_tune else 0.3 # reach stopping target smoothly
else:
tune.kpBP = [0., 5., 35.]
tune.kiBP = [0., 35.]