2014-04-11 01:45:36 +02:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* @file levelcalibrationmodel.h
|
|
|
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
|
|
|
|
* @addtogroup board level calibration
|
|
|
|
* @{
|
|
|
|
* @addtogroup ConfigPlugin Config Plugin
|
|
|
|
* @{
|
|
|
|
* @brief Telemetry configuration panel
|
|
|
|
*****************************************************************************/
|
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LEVELCALIBRATIONMODEL_H
|
|
|
|
#define LEVELCALIBRATIONMODEL_H
|
|
|
|
|
2014-05-15 22:10:16 +02:00
|
|
|
#include "wizardmodel.h"
|
2014-04-11 01:45:36 +02:00
|
|
|
#include "calibration/calibrationutils.h"
|
2014-05-30 18:07:23 +02:00
|
|
|
#include <attitudestate.h>
|
|
|
|
#include <attitudesettings.h>
|
2014-05-15 22:10:16 +02:00
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QMutex>
|
|
|
|
#include <QList>
|
|
|
|
|
2014-04-11 01:45:36 +02:00
|
|
|
namespace OpenPilot {
|
2014-04-27 12:58:59 +02:00
|
|
|
class LevelCalibrationModel : public QObject {
|
2014-04-11 01:45:36 +02:00
|
|
|
Q_OBJECT
|
2014-05-15 22:10:16 +02:00
|
|
|
|
2014-04-11 01:45:36 +02:00
|
|
|
public:
|
|
|
|
explicit LevelCalibrationModel(QObject *parent = 0);
|
|
|
|
|
2014-05-30 18:07:23 +02:00
|
|
|
bool dirty()
|
|
|
|
{
|
|
|
|
return m_dirty;
|
|
|
|
}
|
|
|
|
|
2014-04-11 01:45:36 +02:00
|
|
|
signals:
|
2014-05-25 18:46:51 +02:00
|
|
|
void started();
|
|
|
|
void stopped();
|
2014-04-11 01:45:36 +02:00
|
|
|
void savePositionEnabledChanged(bool state);
|
|
|
|
void progressChanged(int value);
|
2014-05-30 18:07:23 +02:00
|
|
|
void displayVisualHelp(QString elementID);
|
|
|
|
void displayInstructions(QString text, WizardModel::MessageType type = WizardModel::Info);
|
2014-05-15 22:10:16 +02:00
|
|
|
|
2014-04-11 01:45:36 +02:00
|
|
|
public slots:
|
|
|
|
void start();
|
|
|
|
void savePosition();
|
2014-05-30 18:07:23 +02:00
|
|
|
void save();
|
2014-05-15 22:10:16 +02:00
|
|
|
|
2014-04-11 01:45:36 +02:00
|
|
|
private slots:
|
|
|
|
void getSample(UAVObject *obj);
|
2014-05-15 22:10:16 +02:00
|
|
|
|
2014-04-11 01:45:36 +02:00
|
|
|
private:
|
2014-05-30 18:07:23 +02:00
|
|
|
typedef struct {
|
|
|
|
UAVObject::Metadata attitudeStateMdata;
|
|
|
|
} Memento;
|
|
|
|
|
2014-04-11 01:45:36 +02:00
|
|
|
QMutex sensorsUpdateLock;
|
|
|
|
int position;
|
2014-05-30 18:07:23 +02:00
|
|
|
|
2014-04-11 01:45:36 +02:00
|
|
|
bool collectingData;
|
2014-05-30 18:07:23 +02:00
|
|
|
bool m_dirty;
|
|
|
|
|
|
|
|
Memento memento;
|
2014-04-11 01:45:36 +02:00
|
|
|
|
|
|
|
QList<double> rot_accum_roll;
|
|
|
|
QList<double> rot_accum_pitch;
|
|
|
|
double rot_data_roll;
|
|
|
|
double rot_data_pitch;
|
2014-05-30 18:07:23 +02:00
|
|
|
|
|
|
|
// convenience pointers
|
|
|
|
AttitudeState *attitudeState;
|
|
|
|
AttitudeSettings *attitudeSettings;
|
|
|
|
|
2014-04-11 01:45:36 +02:00
|
|
|
UAVObjectManager *getObjectManager();
|
|
|
|
};
|
|
|
|
}
|
2014-05-15 22:10:16 +02:00
|
|
|
|
2014-04-11 01:45:36 +02:00
|
|
|
#endif // LEVELCALIBRATIONMODEL_H
|