diff --git a/ground/openpilotgcs/src/plugins/config/calibration/calibrationuiutils.h b/ground/openpilotgcs/src/plugins/config/calibration/calibrationuiutils.h new file mode 100644 index 000000000..c2d2c2b3e --- /dev/null +++ b/ground/openpilotgcs/src/plugins/config/calibration/calibrationuiutils.h @@ -0,0 +1,16 @@ +#ifndef CALIBRATIONUIUTILS_H +#define CALIBRATIONUIUTILS_H + +#define CALIBRATION_HELPER_IMAGE_NED QStringLiteral("ned") +#define CALIBRATION_HELPER_IMAGE_DWN QStringLiteral("dwn") +#define CALIBRATION_HELPER_IMAGE_ENU QStringLiteral("enu") +#define CALIBRATION_HELPER_IMAGE_SUW QStringLiteral("suw") +#define CALIBRATION_HELPER_IMAGE_SWD QStringLiteral("swd") +#define CALIBRATION_HELPER_IMAGE_USE QStringLiteral("use") +#define CALIBRATION_HELPER_IMAGE_WDS QStringLiteral("wds") + +#define CALIBRATION_HELPER_IMAGE_EMPTY QStringLiteral("empty") + +#define CALIBRATION_HELPER_BOARD_PREFIX QStringLiteral("board-") +#define CALIBRATION_HELPER_PLANE_PREFIX QStringLiteral("plane-") +#endif // CALIBRATIONUIUTILS_H diff --git a/ground/openpilotgcs/src/plugins/config/calibration/gyrobiascalibrationmodel.cpp b/ground/openpilotgcs/src/plugins/config/calibration/gyrobiascalibrationmodel.cpp index 12fd561b1..933005098 100644 --- a/ground/openpilotgcs/src/plugins/config/calibration/gyrobiascalibrationmodel.cpp +++ b/ground/openpilotgcs/src/plugins/config/calibration/gyrobiascalibrationmodel.cpp @@ -33,14 +33,15 @@ #include #include "calibration/gyrobiascalibrationmodel.h" #include "calibration/calibrationutils.h" +#include "calibration/calibrationuiutils.h" + static const int LEVEL_SAMPLES = 100; #include "gyrobiascalibrationmodel.h" namespace OpenPilot { GyroBiasCalibrationModel::GyroBiasCalibrationModel(QObject *parent) : QObject(parent), collectingData(false) -{ -} +{} /******* gyro bias zero ******/ @@ -66,7 +67,7 @@ void GyroBiasCalibrationModel::start() attitudeSettingsData.BiasCorrectGyro = AttitudeSettings::BIASCORRECTGYRO_FALSE; attitudeSettings->setData(attitudeSettingsData); attitudeSettings->updated(); - displayVisualHelp("plane-ned"); + displayVisualHelp(CALIBRATION_HELPER_PLANE_PREFIX + CALIBRATION_HELPER_IMAGE_NED); displayInstructions("Calibrating the gyroscopes. Keep the copter/plane steady...", true); gyro_accum_x.clear(); @@ -158,6 +159,7 @@ void GyroBiasCalibrationModel::getSample(UAVObject *obj) gyroState->setMetadata(initialGyroStateMdata); displayInstructions("Calibration done!", false); + displayVisualHelp(CALIBRATION_HELPER_IMAGE_EMPTY); // Recall saved board rotation recallBoardRotation(); } diff --git a/ground/openpilotgcs/src/plugins/config/calibration/gyrobiascalibrationmodel.h b/ground/openpilotgcs/src/plugins/config/calibration/gyrobiascalibrationmodel.h index 057ae193a..9afe9657d 100644 --- a/ground/openpilotgcs/src/plugins/config/calibration/gyrobiascalibrationmodel.h +++ b/ground/openpilotgcs/src/plugins/config/calibration/gyrobiascalibrationmodel.h @@ -34,8 +34,7 @@ #include "uavobjectmanager.h" #include "uavobject.h" namespace OpenPilot { -class GyroBiasCalibrationModel : public QObject -{ +class GyroBiasCalibrationModel : public QObject { Q_OBJECT public: explicit GyroBiasCalibrationModel(QObject *parent = 0); diff --git a/ground/openpilotgcs/src/plugins/config/calibration/levelcalibrationmodel.cpp b/ground/openpilotgcs/src/plugins/config/calibration/levelcalibrationmodel.cpp index c21f678a4..9db6dc3b5 100644 --- a/ground/openpilotgcs/src/plugins/config/calibration/levelcalibrationmodel.cpp +++ b/ground/openpilotgcs/src/plugins/config/calibration/levelcalibrationmodel.cpp @@ -29,13 +29,13 @@ #include #include #include "extensionsystem/pluginmanager.h" +#include "calibration/calibrationuiutils.h" static const int LEVEL_SAMPLES = 100; namespace OpenPilot { LevelCalibrationModel::LevelCalibrationModel(QObject *parent) : QObject(parent) -{ -} +{} /******* Level calibration *******/ @@ -63,7 +63,7 @@ void LevelCalibrationModel::start() /* Show instructions and enable controls */ displayInstructions("Place horizontally and click save position...", true); - displayVisualHelp("plane-ned"); + displayVisualHelp(CALIBRATION_HELPER_PLANE_PREFIX + CALIBRATION_HELPER_IMAGE_NED); disableAllCalibrations(); savePositionEnabledChanged(true); position = 0; @@ -131,7 +131,7 @@ void LevelCalibrationModel::getSample(UAVObject *obj) rot_data_roll = OpenPilot::CalibrationUtils::listMean(rot_accum_roll); displayInstructions("Leave horizontally, rotate 180° along yaw axis and click save position...", true); - displayVisualHelp("plane-swd"); + displayVisualHelp(CALIBRATION_HELPER_PLANE_PREFIX + CALIBRATION_HELPER_IMAGE_SWD); disableAllCalibrations(); @@ -145,6 +145,7 @@ void LevelCalibrationModel::getSample(UAVObject *obj) attitudeState->setMetadata(initialAttitudeStateMdata); compute(); enableAllCalibrations(); + displayVisualHelp(CALIBRATION_HELPER_IMAGE_EMPTY); break; } } diff --git a/ground/openpilotgcs/src/plugins/config/calibration/levelcalibrationmodel.h b/ground/openpilotgcs/src/plugins/config/calibration/levelcalibrationmodel.h index cc4c79428..07ce6ccc0 100644 --- a/ground/openpilotgcs/src/plugins/config/calibration/levelcalibrationmodel.h +++ b/ground/openpilotgcs/src/plugins/config/calibration/levelcalibrationmodel.h @@ -39,8 +39,7 @@ #include #include namespace OpenPilot { -class LevelCalibrationModel : public QObject -{ +class LevelCalibrationModel : public QObject { Q_OBJECT public: explicit LevelCalibrationModel(QObject *parent = 0); diff --git a/ground/openpilotgcs/src/plugins/config/calibration/sixpointcalibrationmodel.cpp b/ground/openpilotgcs/src/plugins/config/calibration/sixpointcalibrationmodel.cpp index 1861b01e4..db18eebbd 100644 --- a/ground/openpilotgcs/src/plugins/config/calibration/sixpointcalibrationmodel.cpp +++ b/ground/openpilotgcs/src/plugins/config/calibration/sixpointcalibrationmodel.cpp @@ -30,6 +30,7 @@ #include "extensionsystem/pluginmanager.h" #include #include "math.h" +#include "calibration/calibrationuiutils.h" #define POINT_SAMPLE_SIZE 50 #define GRAVITY 9.81f @@ -151,7 +152,7 @@ void SixPointCalibrationModel::start(bool calibrateAccel, bool calibrateMag) /* Show instructions and enable controls */ displayInstructions("Place horizontally, nose pointing north and click save position...", true); - showHelp("ned"); + showHelp(CALIBRATION_HELPER_IMAGE_NED); disableAllCalibrations(); savePositionEnabledChanged(true); position = 0; @@ -242,29 +243,30 @@ void SixPointCalibrationModel::getSample(UAVObject *obj) position = (position + 1) % 6; if (position == 1) { displayInstructions("Place with nose down, right side west and click save position...", false); - showHelp("dwn"); + showHelp(CALIBRATION_HELPER_IMAGE_DWN); } if (position == 2) { displayInstructions("Place right side down, nose west and click save position...", false); - showHelp("wds"); + showHelp(CALIBRATION_HELPER_IMAGE_WDS); } if (position == 3) { displayInstructions("Place upside down, nose east and click save position...", false); - showHelp("enu"); + showHelp(CALIBRATION_HELPER_IMAGE_ENU); } if (position == 4) { displayInstructions("Place with nose up, left side north and click save position...", false); - showHelp("use"); + showHelp(CALIBRATION_HELPER_IMAGE_USE); } if (position == 5) { displayInstructions("Place with left side down, nose south and click save position...", false); - showHelp("suw"); + showHelp(CALIBRATION_HELPER_IMAGE_SUW); } if (position == 0) { compute(calibratingMag, calibratingAccel); savePositionEnabledChanged(false); enableAllCalibrations(); + showHelp(CALIBRATION_HELPER_IMAGE_EMPTY); /* Cleanup original settings */ accelState->setMetadata(initialAccelStateMdata); @@ -381,13 +383,16 @@ UAVObjectManager *SixPointCalibrationModel::getObjectManager() Q_ASSERT(objMngr); return objMngr; } -void SixPointCalibrationModel::showHelp(QString image){ - - if(calibratingAccel){ +void SixPointCalibrationModel::showHelp(QString image) +{ + if (image == CALIBRATION_HELPER_IMAGE_EMPTY) { displayVisualHelp(image); - }else { - displayVisualHelp("plane-" + image); + } else { + if (calibratingAccel) { + displayVisualHelp(CALIBRATION_HELPER_BOARD_PREFIX + image); + } else { + displayVisualHelp(CALIBRATION_HELPER_PLANE_PREFIX + image); + } } } - } diff --git a/ground/openpilotgcs/src/plugins/config/config.pro b/ground/openpilotgcs/src/plugins/config/config.pro index 83ee669b3..8c73c6d28 100644 --- a/ground/openpilotgcs/src/plugins/config/config.pro +++ b/ground/openpilotgcs/src/plugins/config/config.pro @@ -54,7 +54,8 @@ HEADERS += configplugin.h \ calibration/thermal/compensationcalculationtransition.h \ calibration/sixpointcalibrationmodel.h \ calibration/levelcalibrationmodel.h \ - calibration/gyrobiascalibrationmodel.h + calibration/gyrobiascalibrationmodel.h \ + calibration/calibrationuiutils.h SOURCES += configplugin.cpp \ configgadgetwidget.cpp \ diff --git a/ground/openpilotgcs/src/plugins/config/configgadget.qrc b/ground/openpilotgcs/src/plugins/config/configgadget.qrc index dca07c097..87368b7af 100644 --- a/ground/openpilotgcs/src/plugins/config/configgadget.qrc +++ b/ground/openpilotgcs/src/plugins/config/configgadget.qrc @@ -30,22 +30,20 @@ images/pipx-normal.png images/revolution_top.png calibration/WizardStepIndicator.qml - images/calibration/plane-horizontal.png - images/calibration/plane-horizontal-rotated.png - images/calibration/dwn.png - images/calibration/enu.png + images/calibration/board-dwn.png + images/calibration/board-enu.png images/calibration/plane-dwn.png images/calibration/plane-enu.png images/calibration/plane-ned.png images/calibration/plane-suw.png images/calibration/plane-use.png images/calibration/plane-wds.png - images/calibration/ned.png - images/calibration/suw.png - images/calibration/use.png - images/calibration/wds.png + images/calibration/board-ned.png + images/calibration/board-suw.png + images/calibration/board-use.png + images/calibration/board-wds.png images/calibration/empty.png images/calibration/plane-swd.png - images/calibration/swd.png + images/calibration/board-swd.png diff --git a/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp b/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp index 3c9408609..e36b0fda7 100644 --- a/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp @@ -139,7 +139,7 @@ ConfigRevoWidget::ConfigRevoWidget(QWidget *parent) : m_gyroBiasCalibrationModel = new OpenPilot::GyroBiasCalibrationModel(this); connect(m_ui->gyroBiasStart, SIGNAL(clicked()), m_gyroBiasCalibrationModel, SLOT(start())); - connect(m_gyroBiasCalibrationModel , SIGNAL(progressChanged(int)), this->m_ui->gyroBiasProgress, SLOT(setValue(int))); + connect(m_gyroBiasCalibrationModel, SIGNAL(progressChanged(int)), this->m_ui->gyroBiasProgress, SLOT(setValue(int))); connect(m_gyroBiasCalibrationModel, SIGNAL(disableAllCalibrations()), this, SLOT(disableAllCalibrations())); connect(m_gyroBiasCalibrationModel, SIGNAL(enableAllCalibrations()), this, SLOT(enableAllCalibrations())); diff --git a/ground/openpilotgcs/src/plugins/config/images/calibration/dwn.png b/ground/openpilotgcs/src/plugins/config/images/calibration/board-dwn.png similarity index 100% rename from ground/openpilotgcs/src/plugins/config/images/calibration/dwn.png rename to ground/openpilotgcs/src/plugins/config/images/calibration/board-dwn.png diff --git a/ground/openpilotgcs/src/plugins/config/images/calibration/enu.png b/ground/openpilotgcs/src/plugins/config/images/calibration/board-enu.png similarity index 100% rename from ground/openpilotgcs/src/plugins/config/images/calibration/enu.png rename to ground/openpilotgcs/src/plugins/config/images/calibration/board-enu.png diff --git a/ground/openpilotgcs/src/plugins/config/images/calibration/ned.png b/ground/openpilotgcs/src/plugins/config/images/calibration/board-ned.png similarity index 100% rename from ground/openpilotgcs/src/plugins/config/images/calibration/ned.png rename to ground/openpilotgcs/src/plugins/config/images/calibration/board-ned.png diff --git a/ground/openpilotgcs/src/plugins/config/images/calibration/suw.png b/ground/openpilotgcs/src/plugins/config/images/calibration/board-suw.png similarity index 100% rename from ground/openpilotgcs/src/plugins/config/images/calibration/suw.png rename to ground/openpilotgcs/src/plugins/config/images/calibration/board-suw.png diff --git a/ground/openpilotgcs/src/plugins/config/images/calibration/swd.png b/ground/openpilotgcs/src/plugins/config/images/calibration/board-swd.png similarity index 100% rename from ground/openpilotgcs/src/plugins/config/images/calibration/swd.png rename to ground/openpilotgcs/src/plugins/config/images/calibration/board-swd.png diff --git a/ground/openpilotgcs/src/plugins/config/images/calibration/use.png b/ground/openpilotgcs/src/plugins/config/images/calibration/board-use.png similarity index 100% rename from ground/openpilotgcs/src/plugins/config/images/calibration/use.png rename to ground/openpilotgcs/src/plugins/config/images/calibration/board-use.png diff --git a/ground/openpilotgcs/src/plugins/config/images/calibration/wds.png b/ground/openpilotgcs/src/plugins/config/images/calibration/board-wds.png similarity index 100% rename from ground/openpilotgcs/src/plugins/config/images/calibration/wds.png rename to ground/openpilotgcs/src/plugins/config/images/calibration/board-wds.png diff --git a/ground/openpilotgcs/src/plugins/config/images/calibration/plane-horizontal.png b/ground/openpilotgcs/src/plugins/config/images/calibration/plane-horizontal.png deleted file mode 100644 index 70f7538ff..000000000 Binary files a/ground/openpilotgcs/src/plugins/config/images/calibration/plane-horizontal.png and /dev/null differ