diff --git a/CHANGELOGS.md b/CHANGELOGS.md index a67ddb033e..80db19e46c 100644 --- a/CHANGELOGS.md +++ b/CHANGELOGS.md @@ -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) ======================== diff --git a/common/params.cc b/common/params.cc index 321c91fa8e..5165d43de0 100644 --- a/common/params.cc +++ b/common/params.cc @@ -291,6 +291,7 @@ std::unordered_map keys = { {"TorqueDeadzoneDeg", PERSISTENT}, {"TorqueFriction", PERSISTENT}, {"TorqueMaxLatAccel", PERSISTENT}, + {"ToyotaTSS2Long", PERSISTENT}, {"TrueVEgoUi", PERSISTENT}, {"TurnSpeedControl", PERSISTENT}, {"TurnVisionControl", PERSISTENT}, diff --git a/selfdrive/car/toyota/interface.py b/selfdrive/car/toyota/interface.py index a418fab98d..c2d39da171 100644 --- a/selfdrive/car/toyota/interface.py +++ b/selfdrive/car/toyota/interface.py @@ -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.]