From 59fb84f0d55c09dba63a0b8db24a6493761bb3db Mon Sep 17 00:00:00 2001 From: DevTekVE Date: Fri, 3 Apr 2026 15:33:57 +0200 Subject: [PATCH] Remove HKG angle control tuning components and dependencies - Deleted HKG-specific angle tuning settings and related UI elements. - Removed tuning parameter handling and smoothing logic from carcontroller. - Simplifies codebase and eliminates unused parameters. --- common/params_keys.h | 7 -- opendbc_repo | 2 +- .../settings/lateral/angle_tuning_settings.cc | 87 ------------------- .../settings/lateral/angle_tuning_settings.h | 39 --------- 4 files changed, 1 insertion(+), 134 deletions(-) delete mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/lateral/angle_tuning_settings.cc delete mode 100644 selfdrive/ui/sunnypilot/qt/offroad/settings/lateral/angle_tuning_settings.h diff --git a/common/params_keys.h b/common/params_keys.h index 64a9d0fd8a..35a7bc3bc4 100644 --- a/common/params_keys.h +++ b/common/params_keys.h @@ -276,11 +276,4 @@ inline static std::unordered_map keys = { {"TorqueParamsOverrideEnabled", {PERSISTENT | BACKUP, BOOL, "0"}}, {"TorqueParamsOverrideFriction", {PERSISTENT | BACKUP, FLOAT, "0.1"}}, {"TorqueParamsOverrideLatAccelFactor", {PERSISTENT | BACKUP, FLOAT, "2.5"}}, - - // Tuning keys - {"EnableHkgTuningAngleSmoothingFactor", {PERSISTENT | BACKUP, BOOL, "1"}}, - {"HkgTuningAngleMinTorqueReductionGain", {PERSISTENT | BACKUP, INT, "10"}}, - {"HkgTuningAngleMaxTorqueReductionGain", {PERSISTENT | BACKUP, INT, "100"}}, - {"HkgTuningAngleActiveTorqueReductionGain", {PERSISTENT | BACKUP, INT, "100"}}, - {"HkgTuningOverridingCycles", {PERSISTENT | BACKUP, INT, "17"}}, }; diff --git a/opendbc_repo b/opendbc_repo index 1b3e74be96..ce7b2fd125 160000 --- a/opendbc_repo +++ b/opendbc_repo @@ -1 +1 @@ -Subproject commit 1b3e74be961b9d6f2076ef89963750ac2f7f35c8 +Subproject commit ce7b2fd12529da846b3405d94297d08d648be82d diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/lateral/angle_tuning_settings.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/lateral/angle_tuning_settings.cc deleted file mode 100644 index 55b39717ba..0000000000 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/lateral/angle_tuning_settings.cc +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. - * - * This file is part of sunnypilot and is licensed under the MIT License. - * See the LICENSE.md file in the root directory for more details. - */ - -#include "selfdrive/ui/sunnypilot/qt/offroad/settings/lateral/angle_tuning_settings.h" - -#include "selfdrive/ui/sunnypilot/qt/widgets/scrollview.h" - -AngleTunningSettings::AngleTunningSettings(QWidget *parent) : QWidget(parent) { - QVBoxLayout *main_layout = new QVBoxLayout(this); - main_layout->setContentsMargins(50, 20, 50, 20); - main_layout->setSpacing(20); - - // Back button - PanelBackButton *back = new PanelBackButton(); - connect(back, &QPushButton::clicked, [=]() { emit backPress(); }); - main_layout->addWidget(back, 0, Qt::AlignLeft); - - auto *list = new ListWidgetSP(this, false); - - main_layout->addWidget(new QWidget()); - - enableHkgAngleSmoothingFactor = new ExpandableToggleRow("EnableHkgTuningAngleSmoothingFactor", tr("HKG Angle Smoothing Factor"), tr("Applies EMA (Exponential Moving Average) to the desired angle steering and avoid overcorrections."), "../assets/offroad/icon_blank.png"); - list->addItem(enableHkgAngleSmoothingFactor); - - auto first_row = new QHBoxLayout(); - hkgTuningOverridingCycles = new OptionControlSP("HkgTuningOverridingCycles", tr("Override Ramp-Down Cycles"), tr("Number of cycles to ramp down the current amount of torque on the steering wheel.
A smaller value means a faster override by the user (less effort)"), "../assets/offroad/icon_blank.png", {10, 30}, 1); - connect(hkgTuningOverridingCycles, &OptionControlSP::updateLabels, hkgTuningOverridingCycles, [=]() { - this->updateToggles(offroad); - }); - first_row->addWidget(hkgTuningOverridingCycles); - - hkgAngleMinTorque = new OptionControlSP("HkgTuningAngleMinTorqueReductionGain", tr("Override Steering Effort"), tr("Sets the steering effort percentage used when the driver is overriding lateral control.
Higher values increase resistance and make the wheel feel stiffer."), "../assets/offroad/icon_blank.png", {5, 60}, 1); - connect(hkgAngleMinTorque, &OptionControlSP::updateLabels, hkgAngleMinTorque, [=]() { - this->updateToggles(offroad); - }); - first_row->addWidget(hkgAngleMinTorque); - list->addItem(first_row); - - auto second_row = new QHBoxLayout(); - hkgAngleActiveTorque = new OptionControlSP("HkgTuningAngleActiveTorqueReductionGain", tr("Min Active Torque"), tr("Torque applied when lateral control is active but the vehicle is not turning.
Used to maintain lane centering on straight paths when no user input is detected."), "../assets/offroad/icon_blank.png", {10, 100}, 1); - connect(hkgAngleActiveTorque, &OptionControlSP::updateLabels, hkgAngleActiveTorque, [=]() { - this->updateToggles(offroad); - }); - second_row->addWidget(hkgAngleActiveTorque); - - hkgAngleMaxTorque = new OptionControlSP("HkgTuningAngleMaxTorqueReductionGain", tr("Max Torque Allowance"), tr("Sets the maximum torque reduction percentage the controller can apply during normal lateral control.
"), "../assets/offroad/icon_blank.png", {10, 100}, 1); - connect(hkgAngleMaxTorque, &OptionControlSP::updateLabels, hkgAngleMaxTorque, [=]() { - this->updateToggles(offroad); - }); - second_row->addWidget(hkgAngleMaxTorque); - list->addItem(second_row); - - QObject::connect(uiState(), &UIState::offroadTransition, this, &AngleTunningSettings::updateToggles); - - main_layout->addWidget(new ScrollViewSP(list, this)); - - auto *warning = new QLabel(tr("Reboot required for settings to apply; Tap on each setting to see more details.")); - warning->setStyleSheet("font-size: 30px; font-weight: 500; font-family: 'Noto Color Emoji'; color: orange;"); - main_layout->addWidget(warning, 0, Qt::AlignCenter); -} - -void AngleTunningSettings::showEvent(QShowEvent *event) { - updateToggles(offroad); -} - -void AngleTunningSettings::updateToggles(bool _offroad) { - auto HkgAngleSmoothingFactorValue = params.getBool("EnableHkgTuningAngleSmoothingFactor"); - enableHkgAngleSmoothingFactor->toggleFlipped(HkgAngleSmoothingFactorValue); - - auto HkgAngleMinTorqueValue = QString::fromStdString(params.get("HkgTuningAngleMinTorqueReductionGain")).toInt(); - hkgAngleMinTorque->setLabel(QString::number(HkgAngleMinTorqueValue)+"%"); - - auto HkgAngleActiveTorqueValue = QString::fromStdString(params.get("HkgTuningAngleActiveTorqueReductionGain")).toInt(); - hkgAngleActiveTorque->setLabel(QString::number(HkgAngleActiveTorqueValue)+"%"); - - auto HkgAngleMaxTorqueValue = QString::fromStdString(params.get("HkgTuningAngleMaxTorqueReductionGain")).toInt(); - hkgAngleMaxTorque->setLabel(QString::number(HkgAngleMaxTorqueValue)+"%"); - - auto HkgTuningOverridingCyclesValue = QString::fromStdString(params.get("HkgTuningOverridingCycles")).toInt(); - hkgTuningOverridingCycles->setLabel(QString::number(HkgTuningOverridingCyclesValue)); - - offroad = _offroad; -} diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/lateral/angle_tuning_settings.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/lateral/angle_tuning_settings.h deleted file mode 100644 index 7309f600ef..0000000000 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/lateral/angle_tuning_settings.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. - * - * This file is part of sunnypilot and is licensed under the MIT License. - * See the LICENSE.md file in the root directory for more details. - */ - -#pragma once - -#include "selfdrive/ui/qt/util.h" -#include "selfdrive/ui/sunnypilot/ui.h" -#include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h" -#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" -#include "selfdrive/ui/sunnypilot/qt/widgets/expandable_row.h" - -class AngleTunningSettings : public QWidget { - Q_OBJECT - -public: - explicit AngleTunningSettings(QWidget *parent = nullptr); - - void showEvent(QShowEvent *event) override; - -signals: - void backPress(); - -public slots: - void updateToggles(bool _offroad); - -private: - Params params; - bool offroad; - - ExpandableToggleRow* enableHkgAngleSmoothingFactor; - OptionControlSP* hkgAngleMinTorque; - OptionControlSP* hkgAngleActiveTorque; - OptionControlSP* hkgAngleMaxTorque; - OptionControlSP* hkgTuningOverridingCycles; -};