LP-311 Remove basic/advanced stabilization tab auto-switch (autotune/txpid lock issues)
[librepilot.git] / ground / gcs / src / plugins / config / configstabilizationwidget.h
blob529a81a0b16b05a88ff6bc88638c79cf77b1d2eb
1 /**
2 ******************************************************************************
4 * @file configstabilizationwidget.h
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * @addtogroup GCSPlugins GCS Plugins
7 * @{
8 * @addtogroup ConfigPlugin Config Plugin
9 * @{
10 * @brief Stabilization configuration panel
11 *****************************************************************************/
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 * for more details.
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #ifndef CONFIGSTABILIZATIONWIDGET_H
28 #define CONFIGSTABILIZATIONWIDGET_H
30 #include "../uavobjectwidgetutils/configtaskwidget.h"
31 #include "extensionsystem/pluginmanager.h"
32 #include "uavobjectmanager.h"
33 #include "uavobject.h"
35 #include "stabilizationsettings.h"
37 #include "qwt/src/qwt_plot_curve.h"
38 #include "qwt/src/qwt_plot_grid.h"
40 #include <QTimer>
41 #include <QSignalMapper>
43 class Ui_StabilizationWidget;
45 class QWidget;
46 class QTabBar;
48 class ConfigStabilizationWidget : public ConfigTaskWidget {
49 Q_OBJECT
51 public:
52 ConfigStabilizationWidget(QWidget *parent = 0);
53 ~ConfigStabilizationWidget();
54 bool shouldObjectBeSaved(UAVObject *object);
56 private:
57 Ui_StabilizationWidget *ui;
58 QTimer *realtimeUpdates;
59 QList<QTabBar *> m_stabTabBars;
60 QString m_stabilizationObjectsString;
62 // Milliseconds between automatic 'Instant Updates'
63 static const int AUTOMATIC_UPDATE_RATE = 500;
65 static const int EXPO_CURVE_POINTS_COUNT = 100;
66 constexpr static const double EXPO_CURVE_CONSTANT = 1.00695;
68 int boardModel;
69 int m_stabSettingsBankCount;
70 int m_currentStabSettingsBank;
72 QwtPlotCurve m_expoPlotCurveRoll;
73 QwtPlotCurve m_expoPlotCurvePitch;
74 QwtPlotCurve m_expoPlotCurveYaw;
75 QwtPlotGrid m_plotGrid;
76 QSignalMapper m_stabSettingsCopyFromSignalMapper;
77 QSignalMapper m_stabSettingsCopyToSignalMapper;
78 QSignalMapper m_stabSettingsSwapSignalMapper;
80 UAVObject *getStabBankObject(int bank);
82 void updateThrottleCurveFromObject();
83 void updateObjectFromThrottleCurve();
84 void setupExpoPlot();
85 void setupStabBanksGUI();
86 void resetStabBank(int bank);
87 void restoreStabBank(int bank);
89 protected:
90 QString mapObjectName(const QString objectName);
92 protected slots:
93 void refreshWidgetsValues(UAVObject *o = NULL);
94 void updateObjectsFromWidgets();
96 private slots:
97 void realtimeUpdatesSlot(bool value);
98 void linkCheckBoxes(bool value);
99 void processLinkedWidgets(QWidget *);
100 void onBoardConnected();
101 void stabBankChanged(int index);
102 void resetThrottleCurveToDefault();
103 void throttleCurveUpdated();
104 void replotExpo(int value, QwtPlotCurve &curve);
105 void replotExpoRoll(int value);
106 void replotExpoPitch(int value);
107 void replotExpoYaw(int value);
109 void restoreAllStabBanks();
110 void resetAllStabBanks();
111 void restoreCurrentAction();
112 void resetCurrentStabBank();
113 void copyCurrentStabBank();
115 void copyFromBankToBank(int fromBank, int toBank);
116 void copyFromBankToCurrent(int bank);
117 void copyToBankFromCurrent(int bank);
118 void swapBankAndCurrent(int bank);
120 #endif // ConfigStabilizationWidget_H