mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-19 04:52:12 +01:00
Merged in LP-56_split_acroplus_factors (pull request #2)
LP-56 split acroplus factors
This commit is contained in:
commit
582ed4297c
@ -10,6 +10,7 @@
|
||||
*
|
||||
* @file innerloop.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* @brief Attitude stabilization module.
|
||||
*
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
@ -301,10 +302,15 @@ static void stabilizationInnerloopTask()
|
||||
-StabilizationBankMaximumRateToArray(stabSettings.stabBank.MaximumRate)[t],
|
||||
StabilizationBankMaximumRateToArray(stabSettings.stabBank.MaximumRate)[t]
|
||||
);
|
||||
const float acroFactors[] = {
|
||||
stabSettings.stabBank.AcroInsanityFactor.Roll,
|
||||
stabSettings.stabBank.AcroInsanityFactor.Pitch,
|
||||
stabSettings.stabBank.AcroInsanityFactor.Yaw
|
||||
};
|
||||
pid_scaler ascaler = create_pid_scaler(t);
|
||||
ascaler.i *= boundf(1.0f - (1.5f * fabsf(stickinput[t])), 0.0f, 1.0f); // this prevents Integral from getting too high while controlled manually
|
||||
float arate = pid_apply_setpoint(&stabSettings.innerPids[t], &ascaler, rate[t], gyro_filtered[t], dT);
|
||||
float factor = fabsf(stickinput[t]) * stabSettings.stabBank.AcroInsanityFactor;
|
||||
float factor = fabsf(stickinput[t]) * acroFactors[t];
|
||||
actuatorDesiredAxis[t] = factor * stickinput[t] + (1.0f - factor) * arate;
|
||||
}
|
||||
break;
|
||||
|
@ -9,6 +9,7 @@
|
||||
*
|
||||
* @file txpid.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011.
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* @brief Optional module to tune PID settings using R/C transmitter.
|
||||
*
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
@ -382,8 +383,15 @@ static void updatePIDs(UAVObjEvent *ev)
|
||||
case TXPIDSETTINGS_PIDS_GYROTAU:
|
||||
needsUpdateStab |= update(&stab.GyroTau, value);
|
||||
break;
|
||||
case TXPIDSETTINGS_PIDS_ACROPLUSFACTOR:
|
||||
needsUpdateBank |= update(&bank.AcroInsanityFactor, value);
|
||||
case TXPIDSETTINGS_PIDS_ACROROLLFACTOR:
|
||||
needsUpdateBank |= update(&bank.AcroInsanityFactor.Roll, value);
|
||||
break;
|
||||
case TXPIDSETTINGS_PIDS_ACROPITCHFACTOR:
|
||||
needsUpdateBank |= update(&bank.AcroInsanityFactor.Pitch, value);
|
||||
break;
|
||||
case TXPIDSETTINGS_PIDS_ACROROLLPITCHFACTOR:
|
||||
needsUpdateBank |= update(&bank.AcroInsanityFactor.Roll, value);
|
||||
needsUpdateBank |= update(&bank.AcroInsanityFactor.Pitch, value);
|
||||
break;
|
||||
case TXPIDSETTINGS_PIDS_ACCELTAU:
|
||||
needsUpdateAtt |= update(&att.AccelTau, value);
|
||||
|
@ -2,6 +2,7 @@
|
||||
******************************************************************************
|
||||
*
|
||||
* @file configstabilizationwidget.cpp
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* @author E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
@ -91,6 +92,9 @@ ConfigStabilizationWidget::ConfigStabilizationWidget(QWidget *parent) : ConfigTa
|
||||
connect(ui->checkBox_3, SIGNAL(toggled(bool)), this, SLOT(linkCheckBoxes(bool)));
|
||||
addWidget(ui->checkBox_3);
|
||||
|
||||
connect(ui->checkBoxLinkAcroFactors, SIGNAL(toggled(bool)), this, SLOT(linkCheckBoxes(bool)));
|
||||
addWidget(ui->checkBoxLinkAcroFactors);
|
||||
|
||||
addWidget(ui->pushButton_2);
|
||||
addWidget(ui->pushButton_3);
|
||||
addWidget(ui->pushButton_4);
|
||||
@ -568,6 +572,8 @@ void ConfigStabilizationWidget::linkCheckBoxes(bool value)
|
||||
ui->basicResponsivenessCheckBox->setChecked(!value);
|
||||
ui->basicResponsivenessControls->setEnabled(!value);
|
||||
ui->advancedResponsivenessControls->setEnabled(value);
|
||||
} else if(sender() == ui->checkBoxLinkAcroFactors) {
|
||||
processLinkedWidgets(ui->AcroFactorRollSlider);
|
||||
}
|
||||
}
|
||||
|
||||
@ -608,6 +614,13 @@ void ConfigStabilizationWidget::processLinkedWidgets(QWidget *widget)
|
||||
ui->ratePitchKi_4->setValue(ui->RateResponsivenessSlider->value());
|
||||
}
|
||||
}
|
||||
if (ui->checkBoxLinkAcroFactors->isChecked()) {
|
||||
if (widget == ui->AcroFactorRollSlider) {
|
||||
ui->AcroFactorPitchSlider->setValue(ui->AcroFactorRollSlider->value());
|
||||
} else if (widget == ui->AcroFactorPitchSlider) {
|
||||
ui->AcroFactorRollSlider->setValue(ui->AcroFactorPitchSlider->value());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigStabilizationWidget::onBoardConnected()
|
||||
|
@ -3,6 +3,7 @@
|
||||
*
|
||||
* @file configtxpidswidget.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
||||
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup ConfigPlugin Config Plugin
|
||||
@ -162,7 +163,15 @@ static bool isExpoOption(int pidOption)
|
||||
|
||||
static bool isAcroPlusFactorOption(int pidOption)
|
||||
{
|
||||
return pidOption == TxPIDSettings::PIDS_ACROPLUSFACTOR;
|
||||
switch (pidOption) {
|
||||
case TxPIDSettings::PIDS_ACROPITCHFACTOR:
|
||||
case TxPIDSettings::PIDS_ACROROLLFACTOR:
|
||||
case TxPIDSettings::PIDS_ACROROLLPITCHFACTOR:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
template <class StabilizationSettingsBankX>
|
||||
@ -291,7 +300,11 @@ 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;
|
||||
|
||||
|
@ -195,6 +195,29 @@ margin-top: -1px;
|
||||
<string>Acro+</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_26">
|
||||
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="checkBoxLinkAcroFactors">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Link roll &amp; pitch sliders to move together</p></body></html></string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Link Roll and Pitch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="pushButton_21">
|
||||
<property name="sizePolicy">
|
||||
@ -241,7 +264,7 @@ margin-top: -1px;
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSlider" name="AttitudeResponsivenessSlider_2">
|
||||
<widget class="QSlider" name="AcroFactorRollSlider">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@ -278,12 +301,13 @@ margin-top: -1px;
|
||||
<string>fieldname:AcroInsanityFactor</string>
|
||||
<string>scale:0.01</string>
|
||||
<string>buttongroup:77</string>
|
||||
<string>element:Roll</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QSpinBox" name="spinBox_3">
|
||||
<widget class="QSpinBox" name="AcroFactorRollSpinBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
@ -311,12 +335,13 @@ margin-top: -1px;
|
||||
<string>fieldname:AcroInsanityFactor</string>
|
||||
<string>scale:0.01</string>
|
||||
<string>buttongroup:77</string>
|
||||
<string>element:Roll</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<widget class="QLabel" name="AcroFactorRollLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
@ -330,7 +355,106 @@ margin-top: -1px;
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Factor</string>
|
||||
<string>Roll Factor</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSlider" name="AcroFactorPitchSlider">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>The Acro + slider can be adjusted to change the amount of manual control blending.</p></body></html></string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>50</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:StabilizationSettingsBankX</string>
|
||||
<string>fieldname:AcroInsanityFactor</string>
|
||||
<string>scale:0.01</string>
|
||||
<string>buttongroup:77</string>
|
||||
<string>element:Pitch</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QSpinBox" name="AcroFactorPitchSpinBox">
|
||||
<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="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>50</number>
|
||||
</property>
|
||||
<property name="objrelation" stdset="0">
|
||||
<stringlist>
|
||||
<string>objname:StabilizationSettingsBankX</string>
|
||||
<string>fieldname:AcroInsanityFactor</string>
|
||||
<string>scale:0.01</string>
|
||||
<string>buttongroup:77</string>
|
||||
<string>element:Pitch</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="AcroFactorPitchLabel_13">
|
||||
<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>Pitch Factor</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
@ -27298,8 +27422,10 @@ Useful if you have accidentally changed some settings.</string>
|
||||
<tabstop>RateYawResponsivenessSlider</tabstop>
|
||||
<tabstop>spinBox_5</tabstop>
|
||||
<tabstop>pushButton_21</tabstop>
|
||||
<tabstop>AttitudeResponsivenessSlider_2</tabstop>
|
||||
<tabstop>spinBox_3</tabstop>
|
||||
<tabstop>AcroFactorRollSlider</tabstop>
|
||||
<tabstop>AcroFactorRollSpinBox</tabstop>
|
||||
<tabstop>AcroFactorPitchSlider</tabstop>
|
||||
<tabstop>AcroFactorPitchSpinBox</tabstop>
|
||||
<tabstop>pushButton_12</tabstop>
|
||||
<tabstop>RateYawResponsivenessSlider_2</tabstop>
|
||||
<tabstop>expoSpinnerRoll</tabstop>
|
||||
|
@ -16,7 +16,7 @@
|
||||
<field name="PitchPI" units="" type="float" elementnames="Kp,Ki,ILimit" defaultvalue="2.5,0,50" limits="%BE:0:10; %BE:0:10; "/>
|
||||
<field name="YawPI" units="" type="float" elementnames="Kp,Ki,ILimit"/>
|
||||
|
||||
<field name="AcroInsanityFactor" units="percent" type="float" elements="1" defaultvalue="0.4" limits="%BE:0.0:1.0"/>
|
||||
<field name="AcroInsanityFactor" units="percent" type="float" elementnames="Roll,Pitch,Yaw" defaultvalue="0.4" limits="%BE:0.0:1.0"/>
|
||||
|
||||
<field name="EnablePiroComp" units="" type="enum" elements="1" options="FALSE,TRUE" defaultvalue="TRUE"/>
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
<field name="PitchPI" units="" type="float" elementnames="Kp,Ki,ILimit" defaultvalue="2.5,0,50" limits="%BE:0:10; %BE:0:10; "/>
|
||||
<field name="YawPI" units="" type="float" elementnames="Kp,Ki,ILimit" defaultvalue="2.5,0,50" limits="%BE:0:10; %BE:0:10; "/>
|
||||
|
||||
<field name="AcroInsanityFactor" units="percent" type="float" elements="1" defaultvalue="0.4" limits="%BE:0.0:1.0"/>
|
||||
<field name="AcroInsanityFactor" units="percent" type="float" elementnames="Roll,Pitch,Yaw" defaultvalue="0.4" limits="%BE:0.0:1.0"/>
|
||||
|
||||
<field name="EnablePiroComp" units="" type="enum" elements="1" options="FALSE,TRUE" defaultvalue="TRUE"/>
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
<field name="PitchPI" units="" type="float" elementnames="Kp,Ki,ILimit" defaultvalue="2.5,0,50" limits="%BE:0:10; %BE:0:10; "/>
|
||||
<field name="YawPI" units="" type="float" elementnames="Kp,Ki,ILimit" defaultvalue="2.5,0,50" limits="%BE:0:10; %BE:0:10; "/>
|
||||
|
||||
<field name="AcroInsanityFactor" units="percent" type="float" elements="1" defaultvalue="0.4" limits="%BE:0.0:1.0"/>
|
||||
<field name="AcroInsanityFactor" units="percent" type="float" elementnames="Roll,Pitch,Yaw" defaultvalue="0.4" limits="%BE:0.0:1.0"/>
|
||||
|
||||
<field name="EnablePiroComp" units="" type="enum" elements="1" options="FALSE,TRUE" defaultvalue="TRUE"/>
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
<field name="PitchPI" units="" type="float" elementnames="Kp,Ki,ILimit" defaultvalue="2.5,0,50" limits="%BE:0:10; %BE:0:10; "/>
|
||||
<field name="YawPI" units="" type="float" elementnames="Kp,Ki,ILimit" defaultvalue="2.5,0,50" limits="%BE:0:10; %BE:0:10; "/>
|
||||
|
||||
<field name="AcroInsanityFactor" units="percent" type="float" elements="1" defaultvalue="0.4" limits="%BE:0.0:1.0"/>
|
||||
<field name="AcroInsanityFactor" units="percent" type="float" elementnames="Roll,Pitch,Yaw" defaultvalue="0.4" limits="%BE:0.0:1.0"/>
|
||||
|
||||
<field name="EnablePiroComp" units="" type="enum" elements="1" options="FALSE,TRUE" defaultvalue="TRUE"/>
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
Roll+Pitch Attitude.Kp, Roll+Pitch Attitude.Ki, Roll+Pitch Attitude.ILimit, Roll+Pitch Attitude.Resp,
|
||||
Yaw Attitude.Kp, Yaw Attitude.Ki, Yaw Attitude.ILimit, Yaw Attitude.Resp,
|
||||
Roll.Expo, Pitch.Expo, Roll+Pitch.Expo, Yaw.Expo,
|
||||
GyroTau,AcroPlusFactor,Altitude Pos.Kp,Altitude Velocity.Kp,Altitude Velocity.Ki,Altitude Velocity.Kd,Altitude Velocity.Beta,
|
||||
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"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user