2010-08-24 01:18:26 +02:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* @file configahrstwidget.h
|
|
|
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
|
|
|
* @addtogroup GCSPlugins GCS Plugins
|
|
|
|
* @{
|
|
|
|
* @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 CONFIGAHRSWIDGET_H
|
|
|
|
#define CONFIGAHRSWIDGET_H
|
|
|
|
|
|
|
|
#include "ui_ahrs.h"
|
|
|
|
#include "configtaskwidget.h"
|
|
|
|
#include "extensionsystem/pluginmanager.h"
|
|
|
|
#include "uavobjects/uavobjectmanager.h"
|
|
|
|
#include "uavobjects/uavobject.h"
|
|
|
|
#include <QtGui/QWidget>
|
2010-08-25 01:33:25 +02:00
|
|
|
#include <QtSvg/QSvgRenderer>
|
|
|
|
#include <QtSvg/QGraphicsSvgItem>
|
2010-08-24 01:18:26 +02:00
|
|
|
#include <QList>
|
2010-08-26 16:23:40 +02:00
|
|
|
#include <QTimer>
|
2010-08-24 01:18:26 +02:00
|
|
|
|
|
|
|
class ConfigAHRSWidget: public ConfigTaskWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
ConfigAHRSWidget(QWidget *parent = 0);
|
|
|
|
~ConfigAHRSWidget();
|
|
|
|
|
|
|
|
private:
|
2010-08-26 16:23:40 +02:00
|
|
|
void drawVariancesGraph();
|
2010-08-30 00:00:54 +02:00
|
|
|
void displayPlane(QString elementID);
|
2010-08-24 01:18:26 +02:00
|
|
|
Ui_AHRSWidget *m_ahrs;
|
2010-08-30 00:00:54 +02:00
|
|
|
QGraphicsSvgItem *paperplane;
|
2010-08-25 01:33:25 +02:00
|
|
|
QGraphicsSvgItem *ahrsbargraph;
|
|
|
|
QGraphicsSvgItem *accel_x;
|
|
|
|
QGraphicsSvgItem *accel_y;
|
|
|
|
QGraphicsSvgItem *accel_z;
|
2010-08-26 00:54:32 +02:00
|
|
|
QGraphicsSvgItem *gyro_x;
|
|
|
|
QGraphicsSvgItem *gyro_y;
|
|
|
|
QGraphicsSvgItem *gyro_z;
|
|
|
|
QGraphicsSvgItem *mag_x;
|
|
|
|
QGraphicsSvgItem *mag_y;
|
|
|
|
QGraphicsSvgItem *mag_z;
|
|
|
|
double maxBarHeight;
|
|
|
|
int phaseCounter;
|
2010-08-26 16:23:40 +02:00
|
|
|
int progressBarIndex;
|
|
|
|
QTimer progressBarTimer;
|
2010-08-26 19:56:19 +02:00
|
|
|
const static double maxVarValue;
|
2010-08-26 23:23:23 +02:00
|
|
|
const static int calibrationDelay;
|
2010-08-24 01:18:26 +02:00
|
|
|
|
2010-08-28 20:48:51 +02:00
|
|
|
double accel_data_x[6];
|
|
|
|
double accel_data_y[6];
|
|
|
|
double accel_data_z[6];
|
|
|
|
double mag_data_x[6];
|
|
|
|
double mag_data_y[6];
|
|
|
|
double mag_data_z[6];
|
|
|
|
int position;
|
2010-08-24 01:18:26 +02:00
|
|
|
private slots:
|
2010-08-25 01:33:25 +02:00
|
|
|
void launchAHRSCalibration();
|
2010-08-26 00:54:32 +02:00
|
|
|
void saveAHRSCalibration();
|
2010-08-25 01:33:25 +02:00
|
|
|
void calibPhase2();
|
2010-08-26 16:23:40 +02:00
|
|
|
void incrementProgress();
|
|
|
|
void ahrsSettingsRequest();
|
|
|
|
void ahrsSettingsSaveRAM();
|
|
|
|
void ahrsSettingsSaveSD();
|
2010-08-28 20:48:51 +02:00
|
|
|
void savePositionData();
|
|
|
|
void computeScaleBias();
|
|
|
|
void calibrationMode();
|
2010-08-25 01:33:25 +02:00
|
|
|
|
|
|
|
protected:
|
2010-08-28 20:48:51 +02:00
|
|
|
void showEvent(QShowEvent *event);
|
2010-08-25 01:33:25 +02:00
|
|
|
|
2010-08-24 01:18:26 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ConfigAHRSWidget_H
|