From ee461ff303f8b3179b4762da0d2e2ee9c439b27c Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Wed, 29 Jul 2015 07:19:54 +0200 Subject: [PATCH 1/6] LP-67 handle full PIDs terms with a single knob for each axis (roll/pitch). The new setting will work this way: - Input (knob) value is used straight as roll or pitch P term; - P term is mutliplied by two configurable factors and used as D and I terms; - (Optionally) Yaw P term is calculated from a mean of roll and pitch P terms multiplied by a configurable factor. - yaw P term is multiplied by other two configurable factors and used as yaw D and I terms. --- flight/modules/TxPID/txpid.c | 15 +++++++++++++++ shared/uavobjectdefinition/txpidsettings.xml | 10 ++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/flight/modules/TxPID/txpid.c b/flight/modules/TxPID/txpid.c index b7c3baaae..aa01f6925 100644 --- a/flight/modules/TxPID/txpid.c +++ b/flight/modules/TxPID/txpid.c @@ -253,6 +253,16 @@ static void updatePIDs(UAVObjEvent *ev) case TXPIDSETTINGS_PIDS_ROLLRATEKP: needsUpdateBank |= update(&bank.RollRatePID.Kp, value); break; + case TXPIDSETTINGS_PIDS_ROLLRATEPID: + needsUpdateBank |= update(&bank.RollRatePID.Kp, value); + needsUpdateBank |= update(&bank.RollRatePID.Ki, value * inst.PitchRollRateFactors.I); + needsUpdateBank |= update(&bank.RollRatePID.Kd, value * inst.PitchRollRateFactors.D); + break; + case TXPIDSETTINGS_PIDS_PITCHRATEPID: + needsUpdateBank |= update(&bank.PitchRatePID.Kp, value); + needsUpdateBank |= update(&bank.PitchRatePID.Ki, value * inst.PitchRollRateFactors.I); + needsUpdateBank |= update(&bank.PitchRatePID.Kd, value * inst.PitchRollRateFactors.D); + break; case TXPIDSETTINGS_PIDS_ROLLRATEKI: needsUpdateBank |= update(&bank.RollRatePID.Ki, value); break; @@ -437,6 +447,11 @@ static void updatePIDs(UAVObjEvent *ev) } #endif if (needsUpdateBank) { + if(inst.RatePIDRecalculateYaw == TXPIDSETTINGS_RATEPIDRECALCULATEYAW_ENABLED){ + update(&bank.YawRatePID.Kp, (bank.RollRatePID.Kp + bank.PitchRatePID.Kp) * .5f * inst.YawRateFactors.P); + update(&bank.YawRatePID.Ki, bank.YawRatePID.Kp * inst.YawRateFactors.I); + update(&bank.YawRatePID.Kd, bank.YawRatePID.Kp * inst.YawRateFactors.D); + } switch (inst.BankNumber) { case 0: StabilizationSettingsBank1Set((StabilizationSettingsBank1Data *)&bank); diff --git a/shared/uavobjectdefinition/txpidsettings.xml b/shared/uavobjectdefinition/txpidsettings.xml index 554598f6b..2464619d6 100644 --- a/shared/uavobjectdefinition/txpidsettings.xml +++ b/shared/uavobjectdefinition/txpidsettings.xml @@ -7,10 +7,11 @@ elementnames="Instance1,Instance2,Instance3" options="Throttle,Accessory0,Accessory1,Accessory2,Accessory3,Accessory4,Accessory5" defaultvalue="Throttle,Accessory0,Accessory1"/> - - + + + + + + From d7eff39f4ccc3ab74e446a9dd53cc63443d7f860 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sat, 1 Aug 2015 11:58:50 +0200 Subject: [PATCH 2/6] LP-67 - Initial UI --- ground/gcs/src/plugins/config/txpid.ui | 314 ++++++++++++++++++++++++- 1 file changed, 311 insertions(+), 3 deletions(-) diff --git a/ground/gcs/src/plugins/config/txpid.ui b/ground/gcs/src/plugins/config/txpid.ui index b7a0887a6..15ecc3d7f 100644 --- a/ground/gcs/src/plugins/config/txpid.ui +++ b/ground/gcs/src/plugins/config/txpid.ui @@ -118,9 +118,9 @@ 0 - 0 - 753 - 475 + -74 + 754 + 480 @@ -686,6 +686,314 @@ font:bold; + + + + Full PID Factors + + + + + + + Qt::Vertical + + + QSizePolicy::Preferred + + + + 20 + 20 + + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +margin:1px; +font:bold; + + + Roll/Pitch I Factor + + + Qt::AlignCenter + + + + + + + Qt::StrongFocus + + + D factor for full PID mode + + + 10.000000000000000 + + + 0.010000000000000 + + + + objname:TxPIDSettings + fieldname:PitchRollRateFactors + scale:1 + element:I + + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +margin:1px; +font:bold; + + + Roll/Pitch D Factor + + + Qt::AlignCenter + + + + + + + Qt::StrongFocus + + + I factor for full PID mode + + + 10.000000000000000 + + + 0.010000000000000 + + + + objname:TxPIDSettings + fieldname:PitchRollRateFactors + scale:1 + element:D + + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +margin:1px; +font:bold; + + + Yaw P Factor + + + Qt::AlignCenter + + + + + + + Qt::StrongFocus + + + Yaw P factor for full PID mode + + + 10.000000000000000 + + + 0.010000000000000 + + + + objname:TxPIDSettings + fieldname:YawRateFactors + scale:1 + element:P + + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +margin:1px; +font:bold; + + + Yaw I Factor + + + Qt::AlignCenter + + + + + + + Qt::StrongFocus + + + I factor for full PID mode + + + 10.000000000000000 + + + 0.010000000000000 + + + + objname:TxPIDSettings + fieldname:YawRateFactors + scale:1 + element:I + + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +margin:1px; +font:bold; + + + Yaw D Factor + + + Qt::AlignCenter + + + + + + + Qt::StrongFocus + + + Yaw D factor for full PID mode + + + 10.000000000000000 + + + 0.010000000000000 + + + + objname:TxPIDSettings + fieldname:YawRateFactors + scale:1 + element:D + + + + + + + + + + 0 + 27 + + + + AutoCalc Yaw + + + + objname:TxPIDSettings + fieldname:RatePIDRecalculateYaw + + + + From 74c69e033c032647463f60a3254331327cec8e65 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Sun, 9 Aug 2015 19:01:23 +0200 Subject: [PATCH 3/6] LP-67 - Fix checkbox yaw recalc checkbox, allow yaw recalc flag changes to trigger a yaw recalc --- flight/modules/TxPID/txpid.c | 17 +++++++++-------- shared/uavobjectdefinition/txpidsettings.xml | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/flight/modules/TxPID/txpid.c b/flight/modules/TxPID/txpid.c index aa01f6925..1f2e862af 100644 --- a/flight/modules/TxPID/txpid.c +++ b/flight/modules/TxPID/txpid.c @@ -404,13 +404,13 @@ static void updatePIDs(UAVObjEvent *ev) needsUpdateBank |= update(&bank.AcroInsanityFactor.Pitch, value); break; case TXPIDSETTINGS_PIDS_ACCELTAU: - needsUpdateAtt |= update(&att.AccelTau, value); + needsUpdateAtt |= update(&att.AccelTau, value); break; case TXPIDSETTINGS_PIDS_ACCELKP: - needsUpdateAtt |= update(&att.AccelKp, value); + needsUpdateAtt |= update(&att.AccelKp, value); break; case TXPIDSETTINGS_PIDS_ACCELKI: - needsUpdateAtt |= update(&att.AccelKi, value); + needsUpdateAtt |= update(&att.AccelKi, value); break; #ifdef REVOLUTION @@ -446,12 +446,13 @@ static void updatePIDs(UAVObjEvent *ev) AltitudeHoldSettingsSet(&altitude); } #endif + if (inst.RatePIDRecalculateYaw != TXPIDSETTINGS_RATEPIDRECALCULATEYAW_FALSE) { + float newKp = (bank.RollRatePID.Kp + bank.PitchRatePID.Kp) * .5f * inst.YawRateFactors.P; + needsUpdateBank |= update(&bank.YawRatePID.Kp, newKp); + needsUpdateBank |= update(&bank.YawRatePID.Ki, newKp * inst.YawRateFactors.I); + needsUpdateBank |= update(&bank.YawRatePID.Kd, newKp * inst.YawRateFactors.D); + } if (needsUpdateBank) { - if(inst.RatePIDRecalculateYaw == TXPIDSETTINGS_RATEPIDRECALCULATEYAW_ENABLED){ - update(&bank.YawRatePID.Kp, (bank.RollRatePID.Kp + bank.PitchRatePID.Kp) * .5f * inst.YawRateFactors.P); - update(&bank.YawRatePID.Ki, bank.YawRatePID.Kp * inst.YawRateFactors.I); - update(&bank.YawRatePID.Kd, bank.YawRatePID.Kp * inst.YawRateFactors.D); - } switch (inst.BankNumber) { case 0: StabilizationSettingsBank1Set((StabilizationSettingsBank1Data *)&bank); diff --git a/shared/uavobjectdefinition/txpidsettings.xml b/shared/uavobjectdefinition/txpidsettings.xml index 2464619d6..43adc6574 100644 --- a/shared/uavobjectdefinition/txpidsettings.xml +++ b/shared/uavobjectdefinition/txpidsettings.xml @@ -30,7 +30,7 @@ - + From b5f8bb75f74362865708acd91c5e31108cc35948 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Wed, 12 Aug 2015 14:18:51 +0200 Subject: [PATCH 4/6] LP-67 - UI cleanup, enable boxes only if appropriate. --- .../src/plugins/config/configtxpidwidget.cpp | 41 +- .../src/plugins/config/configtxpidwidget.h | 2 +- ground/gcs/src/plugins/config/txpid.ui | 1483 ++++++++++------- 3 files changed, 916 insertions(+), 610 deletions(-) diff --git a/ground/gcs/src/plugins/config/configtxpidwidget.cpp b/ground/gcs/src/plugins/config/configtxpidwidget.cpp index d66deb77d..ea1ce68b0 100644 --- a/ground/gcs/src/plugins/config/configtxpidwidget.cpp +++ b/ground/gcs/src/plugins/config/configtxpidwidget.cpp @@ -89,8 +89,10 @@ ConfigTxPIDWidget::ConfigTxPIDWidget(QWidget *parent) : ConfigTaskWidget(parent) addWidgetBinding("TxPIDSettings", "UpdateMode", m_txpid->UpdateMode); - addWidget(m_txpid->TxPIDEnable); + connect(this, SIGNAL(widgetContentsChanged(QWidget *)), this, SLOT(processLinkedWidgets(QWidget *))); + addWidget(m_txpid->TxPIDEnable); + addWidget(m_txpid->enableAutoCalcYaw); enableControls(false); populateWidgets(); refreshWidgetsValues(); @@ -161,6 +163,18 @@ static bool isExpoOption(int pidOption) } } +static bool isFullPIDOption(int pidOption) +{ + switch (pidOption) { + case TxPIDSettings::PIDS_ROLLRATEPID: + case TxPIDSettings::PIDS_PITCHRATEPID: + return true; + + default: + return false; + } +} + static bool isAcroPlusFactorOption(int pidOption) { switch (pidOption) { @@ -182,9 +196,11 @@ static float defaultValueForPidOption(const StabilizationSettingsBankX *bank, in return 0.0f; case TxPIDSettings::PIDS_ROLLRATEKP: + case TxPIDSettings::PIDS_ROLLRATEPID: return bank->getRollRatePID_Kp(); case TxPIDSettings::PIDS_PITCHRATEKP: + case TxPIDSettings::PIDS_PITCHRATEPID: return bank->getPitchRatePID_Kp(); case TxPIDSettings::PIDS_ROLLPITCHRATEKP: @@ -300,11 +316,14 @@ static float defaultValueForPidOption(const StabilizationSettingsBankX *bank, in case TxPIDSettings::PIDS_YAWEXPO: return bank->getStickExpo_Yaw(); + case TxPIDSettings::PIDS_ACROROLLFACTOR: case TxPIDSettings::PIDS_ACROROLLPITCHFACTOR: return bank->getAcroInsanityFactor_Roll(); + case TxPIDSettings::PIDS_ACROPITCHFACTOR: return bank->getAcroInsanityFactor_Pitch(); + case -1: // The PID Option field was uninitialized. return 0.0f; @@ -445,3 +464,23 @@ void ConfigTxPIDWidget::saveSettings() UAVObject *obj = HwSettings::GetInstance(getObjectManager()); saveObjectToSD(obj); } + +void ConfigTxPIDWidget::processLinkedWidgets(QWidget *widget) +{ + Q_UNUSED(widget); + bool fullPidEnabled = + isFullPIDOption(m_txpid->PID1->currentIndex()) || + isFullPIDOption(m_txpid->PID2->currentIndex()) || + isFullPIDOption(m_txpid->PID3->currentIndex()); + bool calcYawEnabled = fullPidEnabled && m_txpid->enableAutoCalcYaw->isChecked(); + + m_txpid->fullPID_Y_P_FactorSlider->setEnabled(calcYawEnabled); + m_txpid->fullPID_Y_P_FactorSpinBox->setEnabled(calcYawEnabled); + m_txpid->fullPID_Y_I_FactorSpinBox->setEnabled(calcYawEnabled); + m_txpid->fullPID_Y_D_FactorSpinBox->setEnabled(calcYawEnabled); + m_txpid->enableAutoCalcYaw->setEnabled(fullPidEnabled); + m_txpid->fullPID_RP_I_FactorSlider->setEnabled(fullPidEnabled); + m_txpid->fullPID_RP_I_FactorSpinBox->setEnabled(fullPidEnabled); + m_txpid->fullPID_RP_D_FactorSpinBox->setEnabled(fullPidEnabled); + m_txpid->groupBox_FullPids->setEnabled(fullPidEnabled); +} diff --git a/ground/gcs/src/plugins/config/configtxpidwidget.h b/ground/gcs/src/plugins/config/configtxpidwidget.h index afb148119..2073fd438 100644 --- a/ground/gcs/src/plugins/config/configtxpidwidget.h +++ b/ground/gcs/src/plugins/config/configtxpidwidget.h @@ -38,8 +38,8 @@ public: ~ConfigTxPIDWidget(); private: Ui_TxPIDWidget *m_txpid; - private slots: + void processLinkedWidgets(QWidget *widget); void updateSpinBoxProperties(int selectedPidOption); float getDefaultValueForPidOption(int pidOption); void refreshValues(); diff --git a/ground/gcs/src/plugins/config/txpid.ui b/ground/gcs/src/plugins/config/txpid.ui index 15ecc3d7f..fc8947b62 100644 --- a/ground/gcs/src/plugins/config/txpid.ui +++ b/ground/gcs/src/plugins/config/txpid.ui @@ -118,9 +118,9 @@ 0 - -74 + -337 754 - 480 + 771 @@ -196,6 +196,175 @@ Up to 3 separate PID options (or option pairs) can be selected and updated.Module Settings + + + + Qt::StrongFocus + + + Minimum PID value mapped to Accessory channel = 0 or +Throttle channel lesser or equal to Throttle Min value. + + + 6 + + + 0.000100000000000 + + + + + + + Qt::StrongFocus + + + Select PID option or option pair to update. +Set to Disabled if not used. + + + + + + + Qt::StrongFocus + + + Throttle channel lower bound mapped to PID Min value + + + 1.000000000000000 + + + 0.010000000000000 + + + + + + + Qt::StrongFocus + + + Select PID option or option pair to update. +Set to Disabled if not used. + + + + + + + Qt::Vertical + + + QSizePolicy::Preferred + + + + 20 + 20 + + + + + + + + Qt::StrongFocus + + + Select input used as a control source for this instance. +It can be one of Accessory channels or Throttle channel. + +If Accessory channel is chosen then its range [0..1] will be mapped +to PID range [Min..Max] defined for this instance. + +If Throttle channel is chosen then Throttle range [Min..Max] will +be mapped to PID range [Min..Max] defined for this instance. If +Throttle is out of bounds then PID Min and Max values will be used +accordingly. + +Note that it is possible to set PID Min > Max. In that case increasing +control input value will decrease the PID option value. This can be +used, for instance, to decrease PID value when increasing Throttle. + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +margin:1px; +font:bold; + + + Control Source + + + Qt::AlignCenter + + + + + + + Qt::StrongFocus + + + Minimum PID value mapped to Accessory channel = 0 or +Throttle channel lesser or equal to Throttle Min value. + + + 6 + + + 0.000100000000000 + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +margin:1px; +font:bold; + + + Min + + + Qt::AlignCenter + + + @@ -225,8 +394,65 @@ font:bold; - - + + + + Update Mode + + + + + + + Qt::StrongFocus + + + Maximum PID value mapped to Accessory channel = 1 or +Throttle channel greater or equal to Throttle Max value. + + + 6 + + + 0.000100000000000 + + + + + + + PID Bank + + + + + + + Qt::StrongFocus + + + Throttle channel upper bound mapped to PID Max value + + + 1.000000000000000 + + + 0.010000000000000 + + + + + + + + + + Instance 3 + + + + + 0 @@ -247,7 +473,167 @@ margin:1px; font:bold; - Control Source + Max + + + Qt::AlignCenter + + + + + + + Instance 2 + + + + + + + Throttle Range + + + + + + + Qt::StrongFocus + + + Minimum PID value mapped to Accessory channel = 0 or +Throttle channel lesser or equal to Throttle Min value. + + + 6 + + + 0.000100000000000 + + + + + + + Qt::StrongFocus + + + Select input used as a control source for this instance. +It can be one of Accessory channels or Throttle channel. + +If Accessory channel is chosen then its range [0..1] will be mapped +to PID range [Min..Max] defined for this instance. + +If Throttle channel is chosen then Throttle range [Min..Max] will +be mapped to PID range [Min..Max] defined for this instance. If +Throttle is out of bounds then PID Min and Max values will be used +accordingly. + +Note that it is possible to set PID Min > Max. In that case increasing +control input value will decrease the PID option value. This can be +used, for instance, to decrease PID value when increasing Throttle. + + + + + + + Instance 1 + + + + + + + Qt::StrongFocus + + + Select PID option or option pair to update. +Set to Disabled if not used. + + + + + + + Qt::StrongFocus + + + Select input used as a control source for this instance. +It can be one of Accessory channels or Throttle channel. + +If Accessory channel is chosen then its range [0..1] will be mapped +to PID range [Min..Max] defined for this instance. + +If Throttle channel is chosen then Throttle range [Min..Max] will +be mapped to PID range [Min..Max] defined for this instance. If +Throttle is out of bounds then PID Min and Max values will be used +accordingly. + +Note that it is possible to set PID Min > Max. In that case increasing +control input value will decrease the PID option value. This can be +used, for instance, to decrease PID value when increasing Throttle. + + + + + + + Qt::StrongFocus + + + Maximum PID value mapped to Accessory channel = 1 or +Throttle channel greater or equal to Throttle Max value. + + + 6 + + + 0.000100000000000 + + + + + + + Qt::StrongFocus + + + PID values update mode which can be set to: +- Never: this disables PID updates (but module still will be run if enabled), +- When Armed: PID updated only when system is armed, +- Always: PID updated always regardless of arm state. + +Since the GCS updates GUI PID values in real time on change, could be +tricky to change other PID values from the GUI if the module is enabled +and constantly updates stabilization settings object. As a workaround, +this option can be used to temporarily disable updates or enable them +only when system is armed without disabling the module. + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +margin:1px; +font:bold; + + + Max Qt::AlignCenter @@ -283,93 +669,6 @@ font:bold; - - - - - 0 - 0 - - - - - 0 - 16 - - - - background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -margin:1px; -font:bold; - - - Max - - - Qt::AlignCenter - - - - - - - Instance 1 - - - - - - - Qt::StrongFocus - - - Select PID option or option pair to update. -Set to Disabled if not used. - - - - - - - Qt::StrongFocus - - - Select input used as a control source for this instance. -It can be one of Accessory channels or Throttle channel. - -If Accessory channel is chosen then its range [0..1] will be mapped -to PID range [Min..Max] defined for this instance. - -If Throttle channel is chosen then Throttle range [Min..Max] will -be mapped to PID range [Min..Max] defined for this instance. If -Throttle is out of bounds then PID Min and Max values will be used -accordingly. - -Note that it is possible to set PID Min > Max. In that case increasing -control input value will decrease the PID option value. This can be -used, for instance, to decrease PID value when increasing Throttle. - - - - - - - Qt::StrongFocus - - - Minimum PID value mapped to Accessory channel = 0 or -Throttle channel lesser or equal to Throttle Min value. - - - 6 - - - 0.000100000000000 - - - @@ -387,330 +686,32 @@ Throttle channel greater or equal to Throttle Max value. - - - - Instance 2 - - - - - - - Qt::StrongFocus - - - Select PID option or option pair to update. -Set to Disabled if not used. - - - - - - - Qt::StrongFocus - - - Select input used as a control source for this instance. -It can be one of Accessory channels or Throttle channel. - -If Accessory channel is chosen then its range [0..1] will be mapped -to PID range [Min..Max] defined for this instance. - -If Throttle channel is chosen then Throttle range [Min..Max] will -be mapped to PID range [Min..Max] defined for this instance. If -Throttle is out of bounds then PID Min and Max values will be used -accordingly. - -Note that it is possible to set PID Min > Max. In that case increasing -control input value will decrease the PID option value. This can be -used, for instance, to decrease PID value when increasing Throttle. - - - - - - - Qt::StrongFocus - - - Minimum PID value mapped to Accessory channel = 0 or -Throttle channel lesser or equal to Throttle Min value. - - - 6 - - - 0.000100000000000 - - - - - - - Qt::StrongFocus - - - Maximum PID value mapped to Accessory channel = 1 or -Throttle channel greater or equal to Throttle Max value. - - - 6 - - - 0.000100000000000 - - - - - - - Instance 3 - - - - - - - Qt::StrongFocus - - - Select PID option or option pair to update. -Set to Disabled if not used. - - - - - - - Qt::StrongFocus - - - Select input used as a control source for this instance. -It can be one of Accessory channels or Throttle channel. - -If Accessory channel is chosen then its range [0..1] will be mapped -to PID range [Min..Max] defined for this instance. - -If Throttle channel is chosen then Throttle range [Min..Max] will -be mapped to PID range [Min..Max] defined for this instance. If -Throttle is out of bounds then PID Min and Max values will be used -accordingly. - -Note that it is possible to set PID Min > Max. In that case increasing -control input value will decrease the PID option value. This can be -used, for instance, to decrease PID value when increasing Throttle. - - - - - - - Qt::StrongFocus - - - Minimum PID value mapped to Accessory channel = 0 or -Throttle channel lesser or equal to Throttle Min value. - - - 6 - - - 0.000100000000000 - - - - - - - Qt::StrongFocus - - - Maximum PID value mapped to Accessory channel = 1 or -Throttle channel greater or equal to Throttle Max value. - - - 6 - - - 0.000100000000000 - - - - - - - Update Mode - - - - - - - Qt::StrongFocus - - - PID values update mode which can be set to: -- Never: this disables PID updates (but module still will be run if enabled), -- When Armed: PID updated only when system is armed, -- Always: PID updated always regardless of arm state. - -Since the GCS updates GUI PID values in real time on change, could be -tricky to change other PID values from the GUI if the module is enabled -and constantly updates stabilization settings object. As a workaround, -this option can be used to temporarily disable updates or enable them -only when system is armed without disabling the module. - - - - - - - Throttle Range - - - - - - - Qt::StrongFocus - - - Throttle channel lower bound mapped to PID Min value - - - 1.000000000000000 - - - 0.010000000000000 - - - - - - - Qt::StrongFocus - - - Throttle channel upper bound mapped to PID Max value - - - 1.000000000000000 - - - 0.010000000000000 - - - - - - - - 0 - 0 - - - - - 0 - 16 - - - - background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -margin:1px; -font:bold; - - - Min - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 0 - 16 - - - - background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -margin:1px; -font:bold; - - - Max - - - Qt::AlignCenter - - - - - - - Qt::Vertical - - - QSizePolicy::Preferred - - - - 20 - 20 - - - - - - - - PID Bank - - - + + + + + + + true + + + + 0 + 0 + + + + + 0 + 0 + + + + FullPID Settings + + - - - - - - Full PID Factors - - - - - - - Qt::Vertical - - - QSizePolicy::Preferred - - - - 20 - 20 - - - - - - + 0 @@ -719,10 +720,16 @@ font:bold; - 0 + 120 16 + + + 120 + 16777215 + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); color: rgb(255, 255, 255); @@ -730,80 +737,169 @@ border-radius: 5; margin:1px; font:bold; + + Photographer + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 120 + 16 + + + + + 120 + 16777215 + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +margin:1px; +font:bold; + + + FPV Racer + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 80 + 0 + + Roll/Pitch I Factor - Qt::AlignCenter + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - Qt::StrongFocus + + + + + 0 + 25 + - D factor for full PID mode + Roll/Pitch I factor for full PID mode + + + 25 - 10.000000000000000 + 40 - 0.010000000000000 + 1 + + + 5 + + + 30 + + + 30 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 5 objname:TxPIDSettings fieldname:PitchRollRateFactors - scale:1 + scale:0.1 element:I - - + + - + 0 0 - 0 - 16 + 80 + 0 - - background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -margin:1px; -font:bold; - Roll/Pitch D Factor - Qt::AlignCenter + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - Qt::StrongFocus + + + + + 100 + 22 + - - I factor for full PID mode + + + 60 + 22 + + + + 4 + + + 0.000000000000000 - 10.000000000000000 + 0.090000000000000 - 0.010000000000000 + 0.000500000000000 + + + 0.013500000000000 @@ -815,168 +911,8 @@ font:bold; - - - - - 0 - 0 - - - - - 0 - 16 - - - - background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -margin:1px; -font:bold; - - - Yaw P Factor - - - Qt::AlignCenter - - - - - - - Qt::StrongFocus - - - Yaw P factor for full PID mode - - - 10.000000000000000 - - - 0.010000000000000 - - - - objname:TxPIDSettings - fieldname:YawRateFactors - scale:1 - element:P - - - - - - - - - 0 - 0 - - - - - 0 - 16 - - - - background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -margin:1px; -font:bold; - - - Yaw I Factor - - - Qt::AlignCenter - - - - - - - Qt::StrongFocus - - - I factor for full PID mode - - - 10.000000000000000 - - - 0.010000000000000 - - - - objname:TxPIDSettings - fieldname:YawRateFactors - scale:1 - element:I - - - - - - - - - 0 - 0 - - - - - 0 - 16 - - - - background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); -color: rgb(255, 255, 255); -border-radius: 5; -margin:1px; -font:bold; - - - Yaw D Factor - - - Qt::AlignCenter - - - - - - - Qt::StrongFocus - - - Yaw D factor for full PID mode - - - 10.000000000000000 - - - 0.010000000000000 - - - - objname:TxPIDSettings - fieldname:YawRateFactors - scale:1 - element:D - - - - - - - + + 0 @@ -994,6 +930,337 @@ font:bold; + + + + + 0 + 0 + + + + + 80 + 0 + + + + Yaw P Factor + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 25 + + + + Roll/Pitch I factor for full PID mode + + + 10 + + + 25 + + + 1 + + + 5 + + + 25 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 5 + + + + objname:TxPIDSettings + fieldname:YawRateFactors + scale:0.1 + element:P + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + Yaw I Factor + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 100 + 22 + + + + + 60 + 22 + + + + 0.000000000000000 + + + 10.000000000000000 + + + 0.100000000000000 + + + 1.900000000000000 + + + + objname:TxPIDSettings + fieldname:YawRateFactors + scale:1 + element:I + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + Yaw D Factor + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 100 + 22 + + + + + 60 + 22 + + + + 4 + + + 0.000000000000000 + + + 0.100000000000000 + + + 0.000500000000000 + + + 0.008500000000000 + + + + objname:TxPIDSettings + fieldname:YawRateFactors + scale:1 + element:D + + + + + + + + + 0 + 0 + + + + + 120 + 16 + + + + + 120 + 16777215 + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +margin:1px; +font:bold; + + + Soft + + + Qt::AlignCenter + + + + + + + + 60 + 22 + + + + + 60 + 22 + + + + 1 + + + 0.000000000000000 + + + 10.000000000000000 + + + 0.100000000000000 + + + 2.500000000000000 + + + + objname:TxPIDSettings + fieldname:YawRateFactors + scale:1 + element:P + + + + + + + + + 60 + 22 + + + + + 60 + 22 + + + + 1 + + + 0.000000000000000 + + + 10.000000000000000 + + + 4.000000000000000 + + + + objname:TxPIDSettings + fieldname:PitchRollRateFactors + scale:1 + element:I + + + + + + + + + 0 + 0 + + + + + 120 + 16 + + + + + 120 + 16777215 + + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; +margin:1px; +font:bold; + + + Aggressive + + + Qt::AlignCenter + + + From 2f93596c9c3ae4da13c80312f6c70c90424a2fe9 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Wed, 12 Aug 2015 14:34:39 +0200 Subject: [PATCH 5/6] LP-67 - Add "Default" buttons --- ground/gcs/src/plugins/config/txpid.ui | 92 +++++++++++++++++++++++++- 1 file changed, 90 insertions(+), 2 deletions(-) diff --git a/ground/gcs/src/plugins/config/txpid.ui b/ground/gcs/src/plugins/config/txpid.ui index fc8947b62..1e94019bf 100644 --- a/ground/gcs/src/plugins/config/txpid.ui +++ b/ground/gcs/src/plugins/config/txpid.ui @@ -118,9 +118,9 @@ 0 - -337 + -391 754 - 771 + 783 @@ -780,6 +780,46 @@ font:bold; + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Reset Roll/Pitch factors to default values + + + false + + + + + + Default + + + + button:default + buttongroup:10 + + + + @@ -846,6 +886,7 @@ font:bold; fieldname:PitchRollRateFactors scale:0.1 element:I + buttongroup:10 @@ -907,6 +948,7 @@ font:bold; fieldname:PitchRollRateFactors scale:1 element:D + buttongroup:10 @@ -926,6 +968,7 @@ font:bold; objname:TxPIDSettings fieldname:RatePIDRecalculateYaw + buttongroup:11 @@ -993,6 +1036,7 @@ font:bold; fieldname:YawRateFactors scale:0.1 element:P + buttongroup:11 @@ -1051,6 +1095,7 @@ font:bold; fieldname:YawRateFactors scale:1 element:I + buttongroup:11 @@ -1112,6 +1157,7 @@ font:bold; fieldname:YawRateFactors scale:1 element:D + buttongroup:11 @@ -1151,6 +1197,46 @@ font:bold; + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Reset Yaw factors to default values + + + false + + + + + + Default + + + + button:default + buttongroup:11 + + + + @@ -1186,6 +1272,7 @@ font:bold; fieldname:YawRateFactors scale:1 element:P + buttongroup:11 @@ -1222,6 +1309,7 @@ font:bold; fieldname:PitchRollRateFactors scale:1 element:I + buttongroup:10 From 044f1604cd9038c9cbe95c42b05d458089320278 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Fri, 21 Aug 2015 13:00:51 +0200 Subject: [PATCH 6/6] LP-67 - Fix tooltips --- ground/gcs/src/plugins/config/txpid.ui | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/ground/gcs/src/plugins/config/txpid.ui b/ground/gcs/src/plugins/config/txpid.ui index 1e94019bf..b4d247788 100644 --- a/ground/gcs/src/plugins/config/txpid.ui +++ b/ground/gcs/src/plugins/config/txpid.ui @@ -598,12 +598,12 @@ Throttle channel greater or equal to Throttle Max value. Qt::StrongFocus - PID values update mode which can be set to: + PID values update mode, which can be set to: - Never: this disables PID updates (but module still will be run if enabled), - When Armed: PID updated only when system is armed, -- Always: PID updated always regardless of arm state. +- Always: PID updated always, regardless of arm state. -Since the GCS updates GUI PID values in real time on change, could be +Since the GCS updates GUI PID values in real time on change, it could be tricky to change other PID values from the GUI if the module is enabled and constantly updates stabilization settings object. As a workaround, this option can be used to temporarily disable updates or enable them @@ -927,6 +927,9 @@ font:bold; 22 + + Roll/Pitch D factor for full PID mode + 4 @@ -961,6 +964,9 @@ font:bold; 27 + + Calculate Yaw PIDs based on Roll/Pitch PIDs + AutoCalc Yaw @@ -1004,7 +1010,7 @@ font:bold; - Roll/Pitch I factor for full PID mode + Yaw P factor for full PID mode 10 @@ -1077,6 +1083,9 @@ font:bold; 22 + + Yaw I factor for full PID mode + 0.000000000000000 @@ -1136,6 +1145,9 @@ font:bold; 22 + + Yaw D factor for full PID mode + 4 @@ -1251,6 +1263,9 @@ font:bold; 22 + + Yaw P factor for full PID mode + 1 @@ -1291,6 +1306,9 @@ font:bold; 22 + + Roll/Pitch I factor for full PID mode + 1