Force auto tune

This commit is contained in:
FrogAi
2024-03-26 23:02:03 -07:00
parent 2ad8eb5133
commit 071e3bfc96
4 changed files with 12 additions and 3 deletions
+1
View File
@@ -264,6 +264,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"ExperimentalModeViaDistance", PERSISTENT},
{"ExperimentalModeViaLKAS", PERSISTENT},
{"ExperimentalModeViaTap", PERSISTENT},
{"ForceAutoTune", PERSISTENT},
{"FrogPilotTogglesUpdated", PERSISTENT},
{"FrogsGoMoo", PERSISTENT},
{"GoatScream", PERSISTENT},
+2 -1
View File
@@ -565,7 +565,7 @@ class Controls:
# Update Torque Params
if self.CP.lateralTuning.which() == 'torque':
torque_params = self.sm['liveTorqueParameters']
if self.sm.all_checks(['liveTorqueParameters']) and torque_params.useParams:
if self.sm.all_checks(['liveTorqueParameters']) and (torque_params.useParams or self.force_auto_tune):
self.LaC.update_live_torque_params(torque_params.latAccelFactorFiltered, torque_params.latAccelOffsetFiltered,
torque_params.frictionCoefficientFiltered)
@@ -940,6 +940,7 @@ class Controls:
self.experimental_mode_via_lkas = experimental_mode_activation and self.params.get_bool("ExperimentalModeViaLKAS")
lateral_tune = self.params.get_bool("LateralTune")
self.force_auto_tune = lateral_tune and self.params.get_float("ForceAutoTune")
longitudinal_tune = self.CP.openpilotLongitudinalControl and self.params.get_bool("LongitudinalTune")
self.frogpilot_variables.sport_plus = longitudinal_tune and self.params.get_int("AccelerationProfile") == 3
@@ -34,6 +34,7 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil
{"ExperimentalModeViaDistance", tr("Long Pressing the Distance Button"), tr("Enable/disable 'Experimental Mode' by holding down the 'distance' button on your steering wheel for 0.5 seconds."), ""},
{"LateralTune", tr("Lateral Tuning"), tr("Modify openpilot's steering behavior."), "../frogpilot/assets/toggle_icons/icon_lateral_tune.png"},
{"ForceAutoTune", tr("Force Auto Tune"), tr("Forces comma's auto lateral tuning for unsupported vehicles."), ""},
{"LongitudinalTune", tr("Longitudinal Tuning"), tr("Modify openpilot's acceleration and braking behavior."), "../frogpilot/assets/toggle_icons/icon_longitudinal_tune.png"},
{"AccelerationProfile", tr("Acceleration Profile"), tr("Change the acceleration rate to be either sporty or eco-friendly."), ""},
@@ -182,7 +183,13 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil
QObject::connect(lateralTuneToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
openParentToggle();
for (auto &[key, toggle] : toggles) {
toggle->setVisible(lateralTuneKeys.find(key.c_str()) != lateralTuneKeys.end());
std::set<QString> modifiedLateralTuneKeys = lateralTuneKeys;
if (hasAutoTune || params.getBool("NNFF")) {
modifiedLateralTuneKeys.erase("ForceAutoTune");
}
toggle->setVisible(modifiedLateralTuneKeys.find(key.c_str()) != modifiedLateralTuneKeys.end());
}
});
toggle = lateralTuneToggle;
@@ -36,7 +36,7 @@ private:
std::set<QString> deviceManagementKeys = {"DeviceShutdown", "IncreaseThermalLimits", "LowVoltageShutdown", "NoLogging", "NoUploads", "OfflineMode"};
std::set<QString> experimentalModeActivationKeys = {"ExperimentalModeViaDistance", "ExperimentalModeViaLKAS", "ExperimentalModeViaTap"};
std::set<QString> laneChangeKeys = {};
std::set<QString> lateralTuneKeys = {};
std::set<QString> lateralTuneKeys = {"ForceAutoTune"};
std::set<QString> longitudinalTuneKeys = {"AccelerationProfile", "AggressiveAcceleration", "DecelerationProfile"};
std::set<QString> mtscKeys = {};
std::set<QString> qolKeys = {"DisableOnroadUploads"};