TSS2 Tune

Added toggle to customize the driving dynamics of TTS2 vehicles.

Credit goes to DragonPilot!

https: //github.com/dragonpilot-community/dragonpilot
Co-Authored-By: eFini <16603033+efinilan@users.noreply.github.com>
Co-Authored-By: Kumar <36933347+rav4kumar@users.noreply.github.com>
This commit is contained in:
FrogAi
2024-01-12 22:39:30 -07:00
parent c9298a885f
commit 882713b26e
3 changed files with 16 additions and 2 deletions

View File

@@ -341,6 +341,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"StandardJerk", PERSISTENT},
{"StoppingDistance", PERSISTENT},
{"TetheringEnabled", PERSISTENT},
{"TSS2Tune", PERSISTENT},
{"UnlimitedLength", PERSISTENT},
{"Updated", PERSISTENT},
{"UpdateSchedule", PERSISTENT},

View File

@@ -263,7 +263,19 @@ class CarInterface(CarInterfaceBase):
tune = ret.longitudinalTuning
tune.deadzoneBP = [0., 9.]
tune.deadzoneV = [.0, .15]
if candidate in TSS2_CAR or ret.enableGasInterceptor:
if (candidate in TSS2_CAR or ret.enableGasInterceptor) and Params().get_bool("TSS2Tune"):
# TSS2 tune - Credit goes to the DragonPilot team!
tune.kpBP = [0., 5., 20.]
tune.kpV = [1.3, 1.0, 0.7]
# In MPH = [ 0., 2, 5, 11, 27, 45, 52, 67, 90]
tune.kiBP = [ 0., 1., 2., 5., 12., 20., 23., 30., 40.]
tune.kiV = [.33, .33, .313, .245, .215, .17, .10, .01, .001]
if candidate in TSS2_CAR:
ret.vEgoStopping = 0.1 # car is near 0.1 to 0.2 when car starts requesting stopping accel
ret.vEgoStarting = 0.1 # needs to be > or == vEgoStopping
ret.stopAccel = -0.40 # Toyota requests -0.4 when stopped
ret.stoppingDecelRate = 0.5 # reach stopping target smoothly
elif candidate in TSS2_CAR or ret.enableGasInterceptor:
tune.kpBP = [0., 5., 20.]
tune.kpV = [1.3, 1.0, 0.7]
tune.kiBP = [0., 5., 12., 20., 27.]

View File

@@ -105,6 +105,7 @@ FrogPilotVehiclesPanel::FrogPilotVehiclesPanel(SettingsWindow *parent) : FrogPil
{"LockDoors", "Lock Doors In Drive", "Automatically lock the doors when in drive and unlock when in park.", ""},
{"SNGHack", "Stop and Go Hack", "Enable the 'Stop and Go' hack for vehicles without stock stop and go functionality.", ""},
{"TSS2Tune", "TSS2 Tune", "Tuning profile based on the tuning profile from DragonPilot for TSS2 vehicles.", ""}
};
for (auto &[param, title, desc, icon] : vehicleToggles) {
@@ -122,7 +123,7 @@ FrogPilotVehiclesPanel::FrogPilotVehiclesPanel(SettingsWindow *parent) : FrogPil
gmKeys = {"GasRegenCmd", "LongPitch"};
toyotaKeys = {};
std::set<std::string> rebootKeys = {"LowerVolt"};
std::set<std::string> rebootKeys = {"LowerVolt", "TSS2Tune"};
for (const std::string &key : rebootKeys) {
QObject::connect(toggles[key], &ToggleControl::toggleFlipped, [this]() {
if (FrogPilotConfirmationDialog::toggle("Reboot required to take effect.", "Reboot Now", this)) {