From cd12d8bd00c88772912123b0eaa35b8b697f7006 Mon Sep 17 00:00:00 2001 From: FrogAi <91348155+FrogAi@users.noreply.github.com> Date: Tue, 27 Feb 2024 16:34:47 -0700 Subject: [PATCH] Force auto tune --- common/params.cc | 1 + selfdrive/controls/controlsd.py | 3 ++- selfdrive/frogpilot/ui/control_settings.cc | 1 + selfdrive/frogpilot/ui/control_settings.h | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/common/params.cc b/common/params.cc index 7be23cc..1c972be 100644 --- a/common/params.cc +++ b/common/params.cc @@ -260,6 +260,7 @@ std::unordered_map keys = { {"ExperimentalModeViaLKAS", PERSISTENT}, {"ExperimentalModeViaScreen", PERSISTENT}, {"FireTheBabysitter", PERSISTENT}, + {"ForceAutoTune", PERSISTENT}, {"FrogPilotTogglesUpdated", PERSISTENT}, {"FrogsGoMoo", PERSISTENT}, {"GoatScream", PERSISTENT}, diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 7e569d8..ccaee67 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -677,7 +677,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) @@ -1028,6 +1028,7 @@ class Controls: self.frogpilot_variables.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.params.get_bool("LongitudinalTune") self.frogpilot_variables.sport_plus = longitudinal_tune and self.params.get_int("AccelerationProfile") == 3 diff --git a/selfdrive/frogpilot/ui/control_settings.cc b/selfdrive/frogpilot/ui/control_settings.cc index 4489502..14e73fe 100644 --- a/selfdrive/frogpilot/ui/control_settings.cc +++ b/selfdrive/frogpilot/ui/control_settings.cc @@ -25,6 +25,7 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil {"NoUploads", "Disable Uploads", "Turn off all data uploads to comma's servers.\n\nWARNING: This action will prevent your drives from appearing on comma connect which may impact debugging and support!", ""}, {"LateralTune", "Lateral Tuning", "Modify openpilot's steering behavior.", "../frogpilot/assets/toggle_icons/icon_lateral_tune.png"}, + {"ForceAutoTune", "Force Auto Tune", "Forces comma's auto lateral tuning for unsupported vehicles.", ""}, {"LongitudinalTune", "Longitudinal Tuning", "Modify openpilot's acceleration and braking behavior.", "../frogpilot/assets/toggle_icons/icon_longitudinal_tune.png"}, {"AccelerationProfile", "Acceleration Profile", "Change the acceleration rate to be either sporty or eco-friendly.", ""}, diff --git a/selfdrive/frogpilot/ui/control_settings.h b/selfdrive/frogpilot/ui/control_settings.h index 300dbeb..b3c0307 100644 --- a/selfdrive/frogpilot/ui/control_settings.h +++ b/selfdrive/frogpilot/ui/control_settings.h @@ -39,7 +39,7 @@ private: std::set experimentalModeActivationKeys = {"ExperimentalModeViaDistance", "ExperimentalModeViaLKAS", "ExperimentalModeViaScreen"}; std::set fireTheBabysitterKeys = {"NoLogging", "MuteOverheated", "NoUploads"}; std::set laneChangeKeys = {}; - std::set lateralTuneKeys = {}; + std::set lateralTuneKeys = {"ForceAutoTune"}; std::set longitudinalTuneKeys = {"AccelerationProfile", "DecelerationProfile", "AggressiveAcceleration"}; std::set mtscKeys = {}; std::set qolKeys = {"DisableOnroadUploads"};