OP-975 remove "magic strings", cleanup
@ -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
|
@ -33,14 +33,15 @@
|
||||
#include <accelgyrosettings.h>
|
||||
#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();
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -29,13 +29,13 @@
|
||||
#include <attitudestate.h>
|
||||
#include <attitudesettings.h>
|
||||
#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;
|
||||
}
|
||||
}
|
||||
|
@ -39,8 +39,7 @@
|
||||
#include <accelstate.h>
|
||||
#include <magstate.h>
|
||||
namespace OpenPilot {
|
||||
class LevelCalibrationModel : public QObject
|
||||
{
|
||||
class LevelCalibrationModel : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LevelCalibrationModel(QObject *parent = 0);
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
#include <QMessageBox>
|
||||
#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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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 \
|
||||
|
@ -30,22 +30,20 @@
|
||||
<file>images/pipx-normal.png</file>
|
||||
<file>images/revolution_top.png</file>
|
||||
<file>calibration/WizardStepIndicator.qml</file>
|
||||
<file>images/calibration/plane-horizontal.png</file>
|
||||
<file>images/calibration/plane-horizontal-rotated.png</file>
|
||||
<file>images/calibration/dwn.png</file>
|
||||
<file>images/calibration/enu.png</file>
|
||||
<file>images/calibration/board-dwn.png</file>
|
||||
<file>images/calibration/board-enu.png</file>
|
||||
<file>images/calibration/plane-dwn.png</file>
|
||||
<file>images/calibration/plane-enu.png</file>
|
||||
<file>images/calibration/plane-ned.png</file>
|
||||
<file>images/calibration/plane-suw.png</file>
|
||||
<file>images/calibration/plane-use.png</file>
|
||||
<file>images/calibration/plane-wds.png</file>
|
||||
<file>images/calibration/ned.png</file>
|
||||
<file>images/calibration/suw.png</file>
|
||||
<file>images/calibration/use.png</file>
|
||||
<file>images/calibration/wds.png</file>
|
||||
<file>images/calibration/board-ned.png</file>
|
||||
<file>images/calibration/board-suw.png</file>
|
||||
<file>images/calibration/board-use.png</file>
|
||||
<file>images/calibration/board-wds.png</file>
|
||||
<file>images/calibration/empty.png</file>
|
||||
<file>images/calibration/plane-swd.png</file>
|
||||
<file>images/calibration/swd.png</file>
|
||||
<file>images/calibration/board-swd.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -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()));
|
||||
|
Before Width: | Height: | Size: 150 KiB After Width: | Height: | Size: 150 KiB |
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 86 KiB |
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 117 KiB After Width: | Height: | Size: 117 KiB |
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 176 KiB After Width: | Height: | Size: 176 KiB |
Before Width: | Height: | Size: 84 KiB |