LP-311 Remove basic/advanced stabilization tab auto-switch (autotune/txpid lock issues)
[librepilot.git] / ground / gcs / src / plugins / config / calibration / levelcalibrationmodel.h
blobe79a1bb35065616e01610b53a11b1df608733d74
1 /**
2 ******************************************************************************
4 * @file levelcalibrationmodel.h
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
6 * @addtogroup board level calibration
7 * @{
8 * @addtogroup ConfigPlugin Config Plugin
9 * @{
10 * @brief Telemetry 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
28 #ifndef LEVELCALIBRATIONMODEL_H
29 #define LEVELCALIBRATIONMODEL_H
31 #include "wizardmodel.h"
32 #include "calibration/calibrationutils.h"
33 #include <attitudestate.h>
34 #include <attitudesettings.h>
36 #include <QObject>
37 #include <QMutex>
38 #include <QList>
40 namespace OpenPilot {
41 class LevelCalibrationModel : public QObject {
42 Q_OBJECT
44 public:
45 explicit LevelCalibrationModel(QObject *parent = 0);
47 bool dirty()
49 return m_dirty;
52 signals:
53 void started();
54 void stopped();
55 void savePositionEnabledChanged(bool state);
56 void progressChanged(int value);
57 void displayVisualHelp(QString elementID);
58 void displayInstructions(QString text, WizardModel::MessageType type = WizardModel::Info);
60 public slots:
61 void start();
62 void savePosition();
63 void save();
65 private slots:
66 void getSample(UAVObject *obj);
68 private:
69 typedef struct {
70 UAVObject::Metadata attitudeStateMdata;
71 } Memento;
73 QMutex sensorsUpdateLock;
74 int position;
76 bool collectingData;
77 bool m_dirty;
79 Memento memento;
81 QList<double> rot_accum_roll;
82 QList<double> rot_accum_pitch;
83 double rot_data_roll;
84 double rot_data_pitch;
86 // convenience pointers
87 AttitudeState *attitudeState;
88 AttitudeSettings *attitudeSettings;
90 UAVObjectManager *getObjectManager();
94 #endif // LEVELCALIBRATIONMODEL_H