/** ****************************************************************************** * * @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 CONFIGREVOWIDGET_H #define CONFIGREVOWIDGET_H #include "ui_revosensors.h" #include "configtaskwidget.h" #include "../uavobjectwidgetutils/configtaskwidget.h" #include "extensionsystem/pluginmanager.h" #include "uavobjectmanager.h" #include "uavobject.h" #include #include #include #include #include #include #include "calibration/thermal/thermalcalibrationmodel.h" #include "calibration/calibrationutils.h" class Ui_Widget; class ConfigRevoWidget : public ConfigTaskWidget { Q_OBJECT typedef struct { RevoCalibration::DataFields revoCalibration; AccelGyroSettings::DataFields accelGyroSettings; } SavedSettings; public: ConfigRevoWidget(QWidget *parent = 0); ~ConfigRevoWidget(); private: void displayVisualHelp(QString elementID); // ! Computes the scale and bias of the mag based on collected data void sixPointCalibrationCompute(bool mag, bool accel); SavedSettings savedSettings; OpenPilot::ThermalCalibrationModel *m_thermalCalibrationModel; Ui_RevoSensorsWidget *m_ui; QMutex sensorsUpdateLock; double maxBarHeight; int phaseCounter; const static double maxVarValue; const static int calibrationDelay = 10; bool collectingData; QList gyro_accum_x; QList gyro_accum_y; QList gyro_accum_z; QList accel_accum_x; QList accel_accum_y; QList accel_accum_z; QList mag_accum_x; QList mag_accum_y; QList mag_accum_z; QList rot_accum_roll; QList rot_accum_pitch; double accel_data_x[6], accel_data_y[6], accel_data_z[6]; double mag_data_x[6], mag_data_y[6], mag_data_z[6]; double rot_data_roll; double rot_data_pitch; bool calibratingMag; bool calibratingAccel; UAVObject::Metadata initialAttitudeStateMdata; UAVObject::Metadata initialAccelStateMdata; UAVObject::Metadata initialGyroStateMdata; UAVObject::Metadata initialMagStateMdata; float initialMagCorrectionRate; int position; static const int NOISE_SAMPLES = 50; // Board rotation store/recall qint16 storedBoardRotation[3]; bool isBoardRotationStored; void storeAndClearBoardRotation(); void recallBoardRotation(); void displayInstructions(QString instructions = QString(), bool replace = false); private slots: // ! Overriden method from the configTaskWidget to update UI virtual void refreshWidgetsValues(UAVObject *object = NULL); // Slots for calibrating the mags void sixPointCalibrationMagStart(); void sixPointCalibrationAccelStart(); void sixPointCalibrationStart(bool calibrateAccel, bool calibrateMag); void sixPointCalibrationGetSample(UAVObject *obj); void sixPointCalibrationSavePositionData(); // Slots for calibrating the accel and gyro void levelCalibrationStart(); void levelCalibrationSavePosition(); void levelCalibrationCompute(); void levelCalibrationGetSample(UAVObject *); // Slots for gyro bias zero void gyroCalibrationStart(); void gyroBiasCalibrationGetSample(UAVObject *obj); // Slot for clearing home location void clearHomeLocation(); void disableAllCalibrations(); void enableAllCalibrations(); protected: void showEvent(QShowEvent *event); void resizeEvent(QResizeEvent *event); }; #endif // ConfigRevoWidget_H