mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-15 07:29:15 +01:00
OP-1525 Adding expo curves for all axis.
This commit is contained in:
parent
63de0cd6ac
commit
b0374005af
@ -150,7 +150,9 @@ ConfigStabilizationWidget::ConfigStabilizationWidget(QWidget *parent) : ConfigTa
|
||||
|
||||
connect(this, SIGNAL(autoPilotConnected()), this, SLOT(onBoardConnected()));
|
||||
|
||||
connect(ui->expoSpinner, SIGNAL(valueChanged(int)), this, SLOT(replotExpo(int)));
|
||||
connect(ui->expoSpinnerRoll, SIGNAL(valueChanged(int)), this, SLOT(replotExpoRoll(int)));
|
||||
connect(ui->expoSpinnerPitch, SIGNAL(valueChanged(int)), this, SLOT(replotExpoPitch(int)));
|
||||
connect(ui->expoSpinnerYaw, SIGNAL(valueChanged(int)), this, SLOT(replotExpoYaw(int)));
|
||||
|
||||
disableMouseWheelEvents();
|
||||
updateEnableControls();
|
||||
@ -233,16 +235,26 @@ void ConfigStabilizationWidget::setupExpoPlot()
|
||||
ui->expoPlot->setAxisScale(QwtPlot::yLeft, 0.0, 1.0, 0.25);
|
||||
ui->expoPlot->canvas()->setFrameShape(QFrame::NoFrame);
|
||||
|
||||
m_expoPlotCurve.setRenderHint(QwtPlotCurve::RenderAntialiased);
|
||||
m_expoPlotCurve.attach(ui->expoPlot);
|
||||
|
||||
m_plotGrid.setMajPen(QColor(Qt::gray));
|
||||
m_plotGrid.setMinPen(QColor(Qt::lightGray));
|
||||
m_plotGrid.enableXMin(false);
|
||||
m_plotGrid.enableYMin(false);
|
||||
m_plotGrid.attach(ui->expoPlot);
|
||||
|
||||
replotExpo(ui->expoSpinner->value());
|
||||
m_expoPlotCurveRoll.setRenderHint(QwtPlotCurve::RenderAntialiased);
|
||||
m_expoPlotCurveRoll.setPen(QPen(QColor(Qt::red).setAlpha(200), 3));
|
||||
m_expoPlotCurveRoll.attach(ui->expoPlot);
|
||||
replotExpoRoll(ui->expoSpinnerRoll->value());
|
||||
|
||||
m_expoPlotCurvePitch.setRenderHint(QwtPlotCurve::RenderAntialiased);
|
||||
m_expoPlotCurvePitch.setPen(QPen(QColor(Qt::green).setAlpha(200), 3));
|
||||
m_expoPlotCurvePitch.attach(ui->expoPlot);
|
||||
replotExpoPitch(ui->expoSpinnerPitch->value());
|
||||
|
||||
m_expoPlotCurveYaw.setRenderHint(QwtPlotCurve::RenderAntialiased);
|
||||
m_expoPlotCurveYaw.setPen(QPen(QColor(Qt::blue).setAlpha(200), 3));
|
||||
m_expoPlotCurveYaw.attach(ui->expoPlot);
|
||||
replotExpoYaw(ui->expoSpinnerYaw->value());
|
||||
}
|
||||
|
||||
void ConfigStabilizationWidget::resetThrottleCurveToDefault()
|
||||
@ -277,7 +289,7 @@ void ConfigStabilizationWidget::throttleCurveUpdated()
|
||||
setDirty(true);
|
||||
}
|
||||
|
||||
void ConfigStabilizationWidget::replotExpo(int value)
|
||||
void ConfigStabilizationWidget::replotExpo(int value, QwtPlotCurve &curve)
|
||||
{
|
||||
double x[EXPO_CURVE_POINTS] = { 0 };
|
||||
double y[EXPO_CURVE_POINTS] = { 0 };
|
||||
@ -287,16 +299,27 @@ void ConfigStabilizationWidget::replotExpo(int value)
|
||||
for (int i = 0; i < EXPO_CURVE_POINTS; i++) {
|
||||
x[i] = i * step;
|
||||
y[i] = pow(x[i], factor);
|
||||
qDebug() << "x=" << x[i] << ",y=" << y[i];
|
||||
}
|
||||
m_expoPlotCurve.setSamples(x, y, EXPO_CURVE_POINTS);
|
||||
int hue = 255 - ((value + 100) / 200.0 * 255);
|
||||
qDebug() << "hue" << hue;
|
||||
m_expoPlotCurve.setPen(QPen(QColor::fromHsl(hue, 200, 128), 3));
|
||||
m_expoPlotCurve.show();
|
||||
curve.setSamples(x, y, EXPO_CURVE_POINTS);
|
||||
curve.show();
|
||||
ui->expoPlot->replot();
|
||||
}
|
||||
|
||||
void ConfigStabilizationWidget::replotExpoRoll(int value)
|
||||
{
|
||||
replotExpo(value, m_expoPlotCurveRoll);
|
||||
}
|
||||
|
||||
void ConfigStabilizationWidget::replotExpoPitch(int value)
|
||||
{
|
||||
replotExpo(value, m_expoPlotCurvePitch);
|
||||
}
|
||||
|
||||
void ConfigStabilizationWidget::replotExpoYaw(int value)
|
||||
{
|
||||
replotExpo(value, m_expoPlotCurveYaw);
|
||||
}
|
||||
|
||||
void ConfigStabilizationWidget::realtimeUpdatesSlot(bool value)
|
||||
{
|
||||
ui->realTimeUpdates_6->setChecked(value);
|
||||
|
@ -61,7 +61,9 @@ private:
|
||||
int m_pidBankCount;
|
||||
int m_currentPIDBank;
|
||||
|
||||
QwtPlotCurve m_expoPlotCurve;
|
||||
QwtPlotCurve m_expoPlotCurveRoll;
|
||||
QwtPlotCurve m_expoPlotCurvePitch;
|
||||
QwtPlotCurve m_expoPlotCurveYaw;
|
||||
QwtPlotGrid m_plotGrid;
|
||||
|
||||
void updateThrottleCurveFromObject();
|
||||
@ -82,6 +84,9 @@ private slots:
|
||||
void pidBankChanged(int index);
|
||||
void resetThrottleCurveToDefault();
|
||||
void throttleCurveUpdated();
|
||||
void replotExpo(int value);
|
||||
void replotExpo(int value, QwtPlotCurve &curve);
|
||||
void replotExpoRoll(int value);
|
||||
void replotExpoPitch(int value);
|
||||
void replotExpoYaw(int value);
|
||||
};
|
||||
#endif // ConfigStabilizationWidget_H
|
||||
|
@ -136,8 +136,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1018</width>
|
||||
<height>779</height>
|
||||
<width>1016</width>
|
||||
<height>788</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
@ -212,7 +212,7 @@ margin-top: -1px;
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_7" rowstretch="0,0,0,0">
|
||||
<layout class="QGridLayout" name="gridLayout_7" rowstretch="0,0,0">
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
@ -2389,29 +2389,6 @@ border-radius: 5;</string>
|
||||
<string>Expo</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0" alignment="Qt::AlignRight">
|
||||
<widget class="QPushButton" name="pushButton_12">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reset all values to GCS defaults</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Default</string>
|
||||
</property>
|
||||
<property name="objrelation" stdset="0">
|
||||
<stringlist>
|
||||
<string>objname:StabilizationSettings</string>
|
||||
<string>button:default</string>
|
||||
<string>buttongroup:66</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QFrame" name="basicResponsivenessControls_2">
|
||||
<property name="sizePolicy">
|
||||
@ -2433,8 +2410,8 @@ border-radius: 5;</string>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="3">
|
||||
<widget class="QSpinBox" name="expoSpinner">
|
||||
<item row="1" column="5">
|
||||
<widget class="QSpinBox" name="expoSpinnerRoll">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
@ -2463,11 +2440,100 @@ border-radius: 5;</string>
|
||||
<string>haslimits:yes</string>
|
||||
<string>scale:1</string>
|
||||
<string>buttongroup:66</string>
|
||||
<string>element:Roll</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="4">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>120</red>
|
||||
<green>120</green>
|
||||
<blue>120</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Roll</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="5">
|
||||
<widget class="QSpinBox" name="expoSpinnerPitch">
|
||||
<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>-100</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="objrelation" stdset="0">
|
||||
<stringlist>
|
||||
<string>objname:StabilizationSettingsBankX</string>
|
||||
<string>fieldname:StickExpo</string>
|
||||
<string>haslimits:yes</string>
|
||||
<string>scale:1</string>
|
||||
<string>buttongroup:66</string>
|
||||
<string>element:Pitch</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="6">
|
||||
<widget class="QwtPlot" name="expoPlot" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
@ -2477,7 +2543,148 @@ border-radius: 5;</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>170</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>170</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>120</red>
|
||||
<green>120</green>
|
||||
<blue>120</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Pitch</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="5">
|
||||
<widget class="QSpinBox" name="expoSpinnerYaw">
|
||||
<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>-100</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="objrelation" stdset="0">
|
||||
<stringlist>
|
||||
<string>objname:StabilizationSettingsBankX</string>
|
||||
<string>fieldname:StickExpo</string>
|
||||
<string>haslimits:yes</string>
|
||||
<string>scale:1</string>
|
||||
<string>buttongroup:66</string>
|
||||
<string>element:Yaw</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>120</red>
|
||||
<green>120</green>
|
||||
<blue>120</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Yaw</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="4">
|
||||
<widget class="QSlider" name="RateYawResponsivenessSlider_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@ -2513,6 +2720,89 @@ border-radius: 5;</string>
|
||||
<string>haslimits:yes</string>
|
||||
<string>scale:1</string>
|
||||
<string>buttongroup:66</string>
|
||||
<string>element:Roll</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="4">
|
||||
<widget class="QSlider" name="RateYawResponsivenessSlider_4">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>The Rate mode Yaw slider can be adjusted to value ranges whose responsiveness is represented by the Moderate / Snappy / Insane bar</p></body></html></string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-100</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::TicksBelow</enum>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="objrelation" stdset="0">
|
||||
<stringlist>
|
||||
<string>objname:StabilizationSettingsBankX</string>
|
||||
<string>fieldname:StickExpo</string>
|
||||
<string>haslimits:yes</string>
|
||||
<string>scale:1</string>
|
||||
<string>buttongroup:66</string>
|
||||
<string>element:Yaw</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="4">
|
||||
<widget class="QSlider" name="RateYawResponsivenessSlider_3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>The Rate mode Yaw slider can be adjusted to value ranges whose responsiveness is represented by the Moderate / Snappy / Insane bar</p></body></html></string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-100</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::TicksBelow</enum>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="objrelation" stdset="0">
|
||||
<stringlist>
|
||||
<string>objname:StabilizationSettingsBankX</string>
|
||||
<string>fieldname:StickExpo</string>
|
||||
<string>haslimits:yes</string>
|
||||
<string>scale:1</string>
|
||||
<string>buttongroup:66</string>
|
||||
<string>element:Pitch</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
@ -2520,6 +2810,29 @@ border-radius: 5;</string>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" alignment="Qt::AlignRight">
|
||||
<widget class="QPushButton" name="pushButton_12">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reset all values to GCS defaults</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Default</string>
|
||||
</property>
|
||||
<property name="objrelation" stdset="0">
|
||||
<stringlist>
|
||||
<string>objname:StabilizationSettings</string>
|
||||
<string>button:default</string>
|
||||
<string>buttongroup:66</string>
|
||||
</stringlist>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -7887,8 +8200,8 @@ border-radius: 5;</string>
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1018</width>
|
||||
<height>779</height>
|
||||
<width>1016</width>
|
||||
<height>788</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_29">
|
||||
@ -17879,8 +18192,8 @@ border-radius: 5;</string>
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1018</width>
|
||||
<height>779</height>
|
||||
<width>1016</width>
|
||||
<height>788</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8" stretch="0,0,0,0,0,0">
|
||||
@ -23725,8 +24038,8 @@ font:bold;</string>
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1018</width>
|
||||
<height>779</height>
|
||||
<width>1016</width>
|
||||
<height>788</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_18">
|
||||
@ -26822,7 +27135,7 @@ Useful if you have accidentally changed some settings.</string>
|
||||
<tabstop>horizontalSlider_79</tabstop>
|
||||
<tabstop>spinBox_8</tabstop>
|
||||
<tabstop>spinBox_12</tabstop>
|
||||
<tabstop>expoSpinner</tabstop>
|
||||
<tabstop>expoSpinnerRoll</tabstop>
|
||||
<tabstop>RateYawResponsivenessSlider_2</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user