1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-16 08:29:15 +01:00

Merged in alessiomorale/librepilot/amorale/LP-67_full_pid_txtpid (pull request #30)

LP-67 - Allows two txpid controls to manage full pids, using P,I,D factors
This commit is contained in:
Alessio Morale 2015-08-21 13:33:45 +02:00
commit f6547bfb0a
5 changed files with 1063 additions and 321 deletions

View File

@ -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;
@ -394,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
@ -436,6 +446,12 @@ 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) {
switch (inst.BankNumber) {
case 0:

View File

@ -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);
}

View File

@ -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();

View File

@ -118,9 +118,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>753</width>
<height>475</height>
<y>-391</y>
<width>754</width>
<height>783</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
@ -196,6 +196,175 @@ Up to 3 separate PID options (or option pairs) can be selected and updated.</str
<string>Module Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="3">
<widget class="QDoubleSpinBox" name="MinPID1">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Minimum PID value mapped to Accessory channel = 0 or
Throttle channel lesser or equal to Throttle Min value.</string>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="singleStep">
<double>0.000100000000000</double>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="PID2">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Select PID option or option pair to update.
Set to Disabled if not used.</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QDoubleSpinBox" name="ThrottleMin">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Throttle channel lower bound mapped to PID Min value</string>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="PID3">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Select PID option or option pair to update.
Set to Disabled if not used.</string>
</property>
</widget>
</item>
<item row="5" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="2">
<widget class="QComboBox" name="Input3">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>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 &gt; 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.</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_50">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>16</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">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;</string>
</property>
<property name="text">
<string>Control Source</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QDoubleSpinBox" name="MinPID2">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Minimum PID value mapped to Accessory channel = 0 or
Throttle channel lesser or equal to Throttle Min value.</string>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="singleStep">
<double>0.000100000000000</double>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>16</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">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;</string>
</property>
<property name="text">
<string>Min</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_51">
<property name="sizePolicy">
@ -225,8 +394,65 @@ font:bold;</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_50">
<item row="8" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Update Mode</string>
</property>
</widget>
</item>
<item row="4" column="4">
<widget class="QDoubleSpinBox" name="MaxPID3">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Maximum PID value mapped to Accessory channel = 1 or
Throttle channel greater or equal to Throttle Max value.</string>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="singleStep">
<double>0.000100000000000</double>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>PID Bank</string>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QDoubleSpinBox" name="ThrottleMax">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Throttle channel upper bound mapped to PID Max value</string>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="pidBank"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_52">
<property name="text">
<string>Instance 3</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -247,7 +473,167 @@ margin:1px;
font:bold;</string>
</property>
<property name="text">
<string>Control Source</string>
<string>Max</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_48">
<property name="text">
<string>Instance 2</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Throttle Range</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QDoubleSpinBox" name="MinPID3">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Minimum PID value mapped to Accessory channel = 0 or
Throttle channel lesser or equal to Throttle Min value.</string>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="singleStep">
<double>0.000100000000000</double>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QComboBox" name="Input1">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>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 &gt; 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.</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_47">
<property name="text">
<string>Instance 1</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="PID1">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Select PID option or option pair to update.
Set to Disabled if not used.</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QComboBox" name="Input2">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>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 &gt; 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.</string>
</property>
</widget>
</item>
<item row="3" column="4">
<widget class="QDoubleSpinBox" name="MaxPID2">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Maximum PID value mapped to Accessory channel = 1 or
Throttle channel greater or equal to Throttle Max value.</string>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="singleStep">
<double>0.000100000000000</double>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QComboBox" name="UpdateMode">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>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, 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
only when system is armed without disabling the module.</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>16</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">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;</string>
</property>
<property name="text">
<string>Max</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
@ -283,93 +669,6 @@ font:bold;</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>16</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">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;</string>
</property>
<property name="text">
<string>Max</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_47">
<property name="text">
<string>Instance 1</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="PID1">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Select PID option or option pair to update.
Set to Disabled if not used.</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QComboBox" name="Input1">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>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 &gt; 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.</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QDoubleSpinBox" name="MinPID1">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Minimum PID value mapped to Accessory channel = 0 or
Throttle channel lesser or equal to Throttle Min value.</string>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="singleStep">
<double>0.000100000000000</double>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QDoubleSpinBox" name="MaxPID1">
<property name="focusPolicy">
@ -387,223 +686,496 @@ Throttle channel greater or equal to Throttle Max value.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_FullPids">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>FullPID Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<widget class="QLabel" name="label_53">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>16</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">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;</string>
</property>
<property name="text">
<string>Photographer</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_54">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>16</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">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;</string>
</property>
<property name="text">
<string>FPV Racer</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="fullPID_RP_Factor_Reset">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Reset Roll/Pitch factors to default values</string>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Default</string>
</property>
<property name="objrelation" stdset="0">
<stringlist>
<string>button:default</string>
<string>buttongroup:10</string>
</stringlist>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="fullPID_RP_I_FactorLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Roll/Pitch I Factor</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QSlider" name="fullPID_RP_I_FactorSlider">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>Roll/Pitch I factor for full PID mode</string>
</property>
<property name="minimum">
<number>25</number>
</property>
<property name="maximum">
<number>40</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="pageStep">
<number>5</number>
</property>
<property name="value">
<number>30</number>
</property>
<property name="sliderPosition">
<number>30</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>5</number>
</property>
<property name="objrelation" stdset="0">
<stringlist>
<string>objname:TxPIDSettings</string>
<string>fieldname:PitchRollRateFactors</string>
<string>scale:0.1</string>
<string>element:I</string>
<string>buttongroup:10</string>
</stringlist>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="fullPID_RP_I_FactorLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Roll/Pitch D Factor</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="fullPID_RP_D_FactorSpinBox">
<property name="minimumSize">
<size>
<width>100</width>
<height>22</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>22</height>
</size>
</property>
<property name="toolTip">
<string>Roll/Pitch D factor for full PID mode</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>0.090000000000000</double>
</property>
<property name="singleStep">
<double>0.000500000000000</double>
</property>
<property name="value">
<double>0.013500000000000</double>
</property>
<property name="objrelation" stdset="0">
<stringlist>
<string>objname:TxPIDSettings</string>
<string>fieldname:PitchRollRateFactors</string>
<string>scale:1</string>
<string>element:D</string>
<string>buttongroup:10</string>
</stringlist>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_48">
<widget class="QCheckBox" name="enableAutoCalcYaw">
<property name="minimumSize">
<size>
<width>0</width>
<height>27</height>
</size>
</property>
<property name="toolTip">
<string>Calculate Yaw PIDs based on Roll/Pitch PIDs</string>
</property>
<property name="text">
<string>Instance 2</string>
<string>AutoCalc Yaw</string>
</property>
<property name="objrelation" stdset="0">
<stringlist>
<string>objname:TxPIDSettings</string>
<string>fieldname:RatePIDRecalculateYaw</string>
<string>buttongroup:11</string>
</stringlist>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="PID2">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
<item row="5" column="0">
<widget class="QLabel" name="fullPID_Y_P_FactorLabel_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Select PID option or option pair to update.
Set to Disabled if not used.</string>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QComboBox" name="Input2">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>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 &gt; 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.</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QDoubleSpinBox" name="MinPID2">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Minimum PID value mapped to Accessory channel = 0 or
Throttle channel lesser or equal to Throttle Min value.</string>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="singleStep">
<double>0.000100000000000</double>
</property>
</widget>
</item>
<item row="3" column="4">
<widget class="QDoubleSpinBox" name="MaxPID2">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Maximum PID value mapped to Accessory channel = 1 or
Throttle channel greater or equal to Throttle Max value.</string>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="singleStep">
<double>0.000100000000000</double>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_52">
<property name="text">
<string>Instance 3</string>
<string>Yaw P Factor</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="PID3">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
<item row="5" column="1" colspan="3">
<widget class="QSlider" name="fullPID_Y_P_FactorSlider">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>Select PID option or option pair to update.
Set to Disabled if not used.</string>
<string>Yaw P factor for full PID mode</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QComboBox" name="Input3">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>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 &gt; 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.</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QDoubleSpinBox" name="MinPID3">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Minimum PID value mapped to Accessory channel = 0 or
Throttle channel lesser or equal to Throttle Min value.</string>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="singleStep">
<double>0.000100000000000</double>
</property>
</widget>
</item>
<item row="4" column="4">
<widget class="QDoubleSpinBox" name="MaxPID3">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Maximum PID value mapped to Accessory channel = 1 or
Throttle channel greater or equal to Throttle Max value.</string>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="singleStep">
<double>0.000100000000000</double>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Update Mode</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QComboBox" name="UpdateMode">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>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.</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Throttle Range</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QDoubleSpinBox" name="ThrottleMin">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Throttle channel lower bound mapped to PID Min value</string>
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<double>1.000000000000000</double>
<number>25</number>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
<number>1</number>
</property>
<property name="pageStep">
<number>5</number>
</property>
<property name="value">
<number>25</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>5</number>
</property>
<property name="objrelation" stdset="0">
<stringlist>
<string>objname:TxPIDSettings</string>
<string>fieldname:YawRateFactors</string>
<string>scale:0.1</string>
<string>element:P</string>
<string>buttongroup:11</string>
</stringlist>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QDoubleSpinBox" name="ThrottleMax">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
<item row="6" column="0">
<widget class="QLabel" name="fullPID_Y_I_FactorLabel_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Throttle channel upper bound mapped to PID Max value</string>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximum">
<double>1.000000000000000</double>
<property name="text">
<string>Yaw I Factor</string>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="label_4">
<widget class="QDoubleSpinBox" name="fullPID_Y_I_FactorSpinBox">
<property name="minimumSize">
<size>
<width>100</width>
<height>22</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>22</height>
</size>
</property>
<property name="toolTip">
<string>Yaw I factor for full PID mode</string>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>1.900000000000000</double>
</property>
<property name="objrelation" stdset="0">
<stringlist>
<string>objname:TxPIDSettings</string>
<string>fieldname:YawRateFactors</string>
<string>scale:1</string>
<string>element:I</string>
<string>buttongroup:11</string>
</stringlist>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="fullPID_Y_D_FactorLabel_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Yaw D Factor</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QDoubleSpinBox" name="fullPID_Y_D_FactorSpinBox">
<property name="minimumSize">
<size>
<width>100</width>
<height>22</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>22</height>
</size>
</property>
<property name="toolTip">
<string>Yaw D factor for full PID mode</string>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>0.100000000000000</double>
</property>
<property name="singleStep">
<double>0.000500000000000</double>
</property>
<property name="value">
<double>0.008500000000000</double>
</property>
<property name="objrelation" stdset="0">
<stringlist>
<string>objname:TxPIDSettings</string>
<string>fieldname:YawRateFactors</string>
<string>scale:1</string>
<string>element:D</string>
<string>buttongroup:11</string>
</stringlist>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="label_55">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -612,10 +1184,16 @@ only when system is armed without disabling the module.</string>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<width>120</width>
<height>16</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">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);
@ -624,15 +1202,138 @@ margin:1px;
font:bold;</string>
</property>
<property name="text">
<string>Min</string>
<string>Soft</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QLabel" name="label_5">
<item row="4" column="4">
<widget class="QPushButton" name="fullPID_Y_Factor_Reset">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Reset Yaw factors to default values</string>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Default</string>
</property>
<property name="objrelation" stdset="0">
<stringlist>
<string>button:default</string>
<string>buttongroup:11</string>
</stringlist>
</property>
</widget>
</item>
<item row="5" column="4">
<widget class="QDoubleSpinBox" name="fullPID_Y_P_FactorSpinBox">
<property name="minimumSize">
<size>
<width>60</width>
<height>22</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>22</height>
</size>
</property>
<property name="toolTip">
<string>Yaw P factor for full PID mode</string>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>2.500000000000000</double>
</property>
<property name="objrelation" stdset="0">
<stringlist>
<string>objname:TxPIDSettings</string>
<string>fieldname:YawRateFactors</string>
<string>scale:1</string>
<string>element:P</string>
<string>buttongroup:11</string>
</stringlist>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QDoubleSpinBox" name="fullPID_RP_I_FactorSpinBox">
<property name="minimumSize">
<size>
<width>60</width>
<height>22</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>22</height>
</size>
</property>
<property name="toolTip">
<string>Roll/Pitch I factor for full PID mode</string>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="value">
<double>4.000000000000000</double>
</property>
<property name="objrelation" stdset="0">
<stringlist>
<string>objname:TxPIDSettings</string>
<string>fieldname:PitchRollRateFactors</string>
<string>scale:1</string>
<string>element:I</string>
<string>buttongroup:10</string>
</stringlist>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QLabel" name="label_56">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -641,10 +1342,16 @@ font:bold;</string>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<width>120</width>
<height>16</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">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);
@ -653,39 +1360,13 @@ margin:1px;
font:bold;</string>
</property>
<property name="text">
<string>Max</string>
<string>Aggressive</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="5" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>PID Bank</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="pidBank"/>
</item>
</layout>
</widget>
</item>

View File

@ -7,10 +7,11 @@
elementnames="Instance1,Instance2,Instance3"
options="Throttle,Accessory0,Accessory1,Accessory2,Accessory3,Accessory4,Accessory5"
defaultvalue="Throttle,Accessory0,Accessory1"/>
<field name="ThrottleRange" units="%" type="float" elements="2" elementnames="Min,Max" defaultvalue="0.20,0.80"/>
<field name="PIDs" units="option" type="enum"
<field name="ThrottleRange" units="%" type="float" elements="2" elementnames="Min,Max" defaultvalue="0.20,0.80"/>
<field name="PIDs" units="option" type="enum"
elementnames="Instance1,Instance2,Instance3"
options="Disabled,
PitchRatePID,RollRatePID,
Roll Rate.Kp, Roll Rate.Ki, Roll Rate.Kd, Roll Rate.ILimit, Roll Rate.Resp,
Pitch Rate.Kp, Pitch Rate.Ki, Pitch Rate.Kd, Pitch Rate.ILimit, Pitch Rate.Resp,
Roll+Pitch Rate.Kp, Roll+Pitch Rate.Ki, Roll+Pitch Rate.Kd, Roll+Pitch Rate.ILimit, Roll+Pitch Rate.Resp,
@ -23,9 +24,14 @@
GyroTau,Acro+ Roll Factor,Acro+ Pitch Factor,Acro+ Roll+Pitch Factor,Altitude Pos.Kp,Altitude Velocity.Kp,Altitude Velocity.Ki,Altitude Velocity.Kd,Altitude Velocity.Beta,
AccelTau, AccelKp, AccelKi"
defaultvalue="Disabled"/>
<field name="MinPID" units="" type="float" elementnames="Instance1,Instance2,Instance3" defaultvalue="0"/>
<field name="MaxPID" units="" type="float" elementnames="Instance1,Instance2,Instance3" defaultvalue="0"/>
<field name="PitchRollRateFactors" units="" type="float" elementnames="I,D" defaultvalue="3,0.0135"/>
<field name="YawRateFactors" units="" type="float" elementnames="P,I,D" defaultvalue="1.5,1.9,0.0085"/>
<field name="RatePIDRecalculateYaw" units="" type="enum" elements="1" options="FALSE,TRUE" defaultvalue="TRUE"/>
<access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
<telemetryflight acked="true" updatemode="onchange" period="0"/>