diff --git a/common/params_keys.h b/common/params_keys.h index 354233ec4b..a739c7c967 100644 --- a/common/params_keys.h +++ b/common/params_keys.h @@ -203,6 +203,7 @@ inline static std::unordered_map keys = { {"EnableHkgTuningAngleSmoothingFactor", PERSISTENT | BACKUP}, {"HkgTuningAngleMinTorqueReductionGain", PERSISTENT | BACKUP}, {"HkgTuningAngleMaxTorqueReductionGain", PERSISTENT | BACKUP}, + {"HkgTuningAngleIdleTorqueReductionGain", PERSISTENT | BACKUP}, {"HkgTuningOverridingCycles", PERSISTENT | BACKUP}, {"HkgAngleLiveTuning", CLEAR_ON_MANAGER_START} diff --git a/opendbc_repo b/opendbc_repo index 11c26d332e..d1b834a572 160000 --- a/opendbc_repo +++ b/opendbc_repo @@ -1 +1 @@ -Subproject commit 11c26d332ef1b5a8b492769e918076f0d419a67a +Subproject commit d1b834a57209671390bac1275cfd28723627cb15 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 index 618d07d4b0..fc8c1ed9d7 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/lateral/angle_tuning_settings.cc +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/lateral/angle_tuning_settings.cc @@ -22,14 +22,9 @@ AngleTunningSettings::AngleTunningSettings(QWidget *parent) : QWidget(parent) { auto *list = new ListWidgetSP(this, false); main_layout->addWidget(new QWidget()); - auto *warning = new QLabel(tr("Reboot required for settings to apply")); - warning->setStyleSheet("font-size: 60px; font-weight: 500; font-family: 'Noto Color Emoji'; color: orange;"); - main_layout->addWidget(warning, 0, Qt::AlignCenter); - list->addItem(horizontal_line()); enableHkgAngleSmoothingFactor = new ExpandableToggleRow("EnableHkgTuningAngleSmoothingFactor", tr("HKG Angle Smoothing Factor"), tr("Applies EMA (Exponential Moving Average) to the desired angle steering."), "../assets/offroad/icon_blank.png"); list->addItem(enableHkgAngleSmoothingFactor); - list->addItem(horizontal_line()); auto first_row = new QHBoxLayout(); hkgTuningOverridingCycles = new OptionControlSP("HkgTuningOverridingCycles", tr("HKG Tuning Overriding 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); @@ -37,17 +32,22 @@ AngleTunningSettings::AngleTunningSettings(QWidget *parent) : QWidget(parent) { this->updateToggles(offroad); }); first_row->addWidget(hkgTuningOverridingCycles); - list->addItem(first_row); - list->addItem(horizontal_line()); - auto second_row = new QHBoxLayout(); - hkgAngleMinTorque = new OptionControlSP("HkgTuningAngleMinTorqueReductionGain", tr("HKG Angle Min ACTIVE Torque"), tr("Minimum torque to apply to the steering wheel when controls are active (and not being overridden by the user).
Must be smaller than max."), "../assets/offroad/icon_blank.png", {0, 100}, 5); + hkgAngleMinTorque = new OptionControlSP("HkgTuningAngleMinTorqueReductionGain", tr("HKG Angle Min Active Torque"), tr("Minimum torque applied when lateral control is active and the driver is overriding.
Higher values make the wheel feel stiffer. Must be less than Max Torque."), "../assets/offroad/icon_blank.png", {0, 100}, 1); connect(hkgAngleMinTorque, &OptionControlSP::updateLabels, hkgAngleMinTorque, [=]() { this->updateToggles(offroad); }); - second_row->addWidget(hkgAngleMinTorque); + first_row->addWidget(hkgAngleMinTorque); + list->addItem(first_row); - hkgAngleMaxTorque = new OptionControlSP("HkgTuningAngleMaxTorqueReductionGain", tr("HKG Angle Max Torque"), tr("Maximum torque to apply to the steering wheel.
Must be bigger than min."), "../assets/offroad/icon_blank.png", {10, 100}, 5); + auto second_row = new QHBoxLayout(); + hkgAngleIdleTorque = new OptionControlSP("HkgTuningAngleIdleTorqueReductionGain", tr("HKG Angle Idle 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", {0, 100}, 1); + connect(hkgAngleIdleTorque, &OptionControlSP::updateLabels, hkgAngleIdleTorque, [=]() { + this->updateToggles(offroad); + }); + second_row->addWidget(hkgAngleIdleTorque); + + hkgAngleMaxTorque = new OptionControlSP("HkgTuningAngleMaxTorqueReductionGain", tr("HKG Angle Max Torque"), tr("Maximum steering torque allowed under normal lateral control.
Prevents excessive EPS stress or noise. Must be greater than Min Torque."), "../assets/offroad/icon_blank.png", {10, 100}, 1); connect(hkgAngleMaxTorque, &OptionControlSP::updateLabels, hkgAngleMaxTorque, [=]() { this->updateToggles(offroad); }); @@ -57,6 +57,10 @@ AngleTunningSettings::AngleTunningSettings(QWidget *parent) : QWidget(parent) { 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: 40px; font-weight: 500; font-family: 'Noto Color Emoji'; color: orange;"); + main_layout->addWidget(warning, 0, Qt::AlignCenter); } void AngleTunningSettings::showEvent(QShowEvent *event) { @@ -70,6 +74,9 @@ void AngleTunningSettings::updateToggles(bool _offroad) { auto HkgAngleMinTorqueValue = QString::fromStdString(params.get("HkgTuningAngleMinTorqueReductionGain")).toInt(); hkgAngleMinTorque->setLabel(QString::number(HkgAngleMinTorqueValue)+"%"); + auto HkgAngleIdleTorqueValue = QString::fromStdString(params.get("HkgTuningAngleIdleTorqueReductionGain")).toInt(); + hkgAngleIdleTorque->setLabel(QString::number(HkgAngleIdleTorqueValue)+"%"); + auto HkgAngleMaxTorqueValue = QString::fromStdString(params.get("HkgTuningAngleMaxTorqueReductionGain")).toInt(); hkgAngleMaxTorque->setLabel(QString::number(HkgAngleMaxTorqueValue)+"%"); 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 index 3571678b35..9807f4f47a 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/lateral/angle_tuning_settings.h +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/lateral/angle_tuning_settings.h @@ -33,6 +33,7 @@ private: ExpandableToggleRow* enableHkgAngleSmoothingFactor; OptionControlSP* hkgAngleMinTorque; + OptionControlSP* hkgAngleIdleTorque; OptionControlSP* hkgAngleMaxTorque; OptionControlSP* hkgTuningOverridingCycles; ParamControlSP* hkgAngleLiveTuning; diff --git a/system/manager/manager.py b/system/manager/manager.py index 874fae7090..bccc1f20a4 100755 --- a/system/manager/manager.py +++ b/system/manager/manager.py @@ -69,7 +69,8 @@ def manager_init() -> None: ("NeuralNetworkLateralControl", "0"), ("QuietMode", "0"), ("EnableHkgTuningAngleSmoothingFactor", "1"), - ("HkgTuningAngleMinTorqueReductionGain", "60"), + ("HkgTuningAngleMinTorqueReductionGain", "10"), + ("HkgTuningAngleIdleTorqueReductionGain", "60"), ("HkgTuningAngleMaxTorqueReductionGain", "100"), ("HkgTuningOverridingCycles", "17"), ("HkgAngleLiveTuning", "0"),