Commit 14a59a98 authored by Don Gagne's avatar Don Gagne

Mag Cal UI

parent a2e9481b
......@@ -195,8 +195,6 @@ Rectangle {
}
VehicleRotationCal {
width: 200
height: 200
calValid: true
calInProgress: controller.gyroCalInProgress
imageSource: "qrc:///qml/VehicleDown.png"
......@@ -206,10 +204,10 @@ Rectangle {
}
Rectangle {
id: accelCalArea
id: orientationCalArea
width: parent.calDisplayAreaWidth
height: parent.height
visible: controller.showAccelCalArea
visible: controller.showOrientationCalArea
color: qgcPal.windowShade
QGCLabel {
......@@ -227,46 +225,40 @@ Rectangle {
spacing: 5
VehicleRotationCal {
width: 200
height: 200
calValid: controller.accelCalDownSideDone
calInProgress: controller.accelCalDownSideInProgress
imageSource: "qrc:///qml/VehicleDown.png"
calValid: controller.orientationCalDownSideDone
calInProgress: controller.orientationCalDownSideInProgress
calInProgressText: controller.calInProgressText
imageSource: "qrc:///qml/VehicleDown.png"
}
VehicleRotationCal {
width: 200
height: 200
calValid: controller.accelCalUpsideDownSideDone
calInProgress: controller.accelCalUpsideDownSideInProgress
imageSource: "qrc:///qml/VehicleUpsideDown.png"
calValid: controller.orientationCalUpsideDownSideDone
calInProgress: controller.orientationCalUpsideDownSideInProgress
calInProgressText: controller.calInProgressText
imageSource: "qrc:///qml/VehicleUpsideDown.png"
}
VehicleRotationCal {
width: 200
height: 200
calValid: controller.accelCalNoseDownSideDone
calInProgress: controller.accelCalNoseDownSideInProgress
imageSource: "qrc:///qml/VehicleNoseDown.png"
calValid: controller.orientationCalNoseDownSideDone
calInProgress: controller.orientationCalNoseDownSideInProgress
calInProgressText: controller.calInProgressText
imageSource: "qrc:///qml/VehicleNoseDown.png"
}
VehicleRotationCal {
width: 200
height: 200
calValid: controller.accelCalTailDownSideDone
calInProgress: controller.accelCalTailDownSideInProgress
imageSource: "qrc:///qml/VehicleTailDown.png"
calValid: controller.orientationCalTailDownSideDone
calInProgress: controller.orientationCalTailDownSideInProgress
calInProgressText: controller.calInProgressText
imageSource: "qrc:///qml/VehicleTailDown.png"
}
VehicleRotationCal {
width: 200
height: 200
calValid: controller.accelCalLeftSideDone
calInProgress: controller.accelCalLeftSideInProgress
imageSource: "qrc:///qml/VehicleLeft.png"
calValid: controller.orientationCalLeftSideDone
calInProgress: controller.orientationCalLeftSideInProgress
calInProgressText: controller.calInProgressText
imageSource: "qrc:///qml/VehicleLeft.png"
}
VehicleRotationCal {
width: 200
height: 200
calValid: controller.accelCalRightSideDone
calInProgress: controller.accelCalRightSideInProgress
imageSource: "qrc:///qml/VehicleRight.png"
calValid: controller.orientationCalRightSideDone
calInProgress: controller.orientationCalRightSideInProgress
calInProgressText: controller.calInProgressText
imageSource: "qrc:///qml/VehicleRight.png"
}
}
}
......
......@@ -37,23 +37,25 @@ SensorsComponentController::SensorsComponentController(AutoPilotPlugin* autopilo
_statusLog(NULL),
_progressBar(NULL),
_showGyroCalArea(false),
_showAccelCalArea(false),
_showOrientationCalArea(false),
_showCompass0(false),
_showCompass1(false),
_showCompass2(false),
_gyroCalInProgress(false),
_accelCalDownSideDone(false),
_accelCalUpsideDownSideDone(false),
_accelCalLeftSideDone(false),
_accelCalRightSideDone(false),
_accelCalNoseDownSideDone(false),
_accelCalTailDownSideDone(false),
_accelCalDownSideInProgress(false),
_accelCalUpsideDownSideInProgress(false),
_accelCalLeftSideInProgress(false),
_accelCalRightSideInProgress(false),
_accelCalNoseDownSideInProgress(false),
_accelCalTailDownSideInProgress(false),
_magCalInProgress(false),
_accelCalInProgress(false),
_orientationCalDownSideDone(false),
_orientationCalUpsideDownSideDone(false),
_orientationCalLeftSideDone(false),
_orientationCalRightSideDone(false),
_orientationCalNoseDownSideDone(false),
_orientationCalTailDownSideDone(false),
_orientationCalDownSideInProgress(false),
_orientationCalUpsideDownSideInProgress(false),
_orientationCalLeftSideInProgress(false),
_orientationCalRightSideInProgress(false),
_orientationCalNoseDownSideInProgress(false),
_orientationCalTailDownSideInProgress(false),
_textLoggingStarted(false),
_autopilot(autopilot)
{
......@@ -95,6 +97,9 @@ void SensorsComponentController::_startCalibration(void)
void SensorsComponentController::_stopCalibration(bool failed)
{
_magCalInProgress = false;
_accelCalInProgress = false;
_compassButton->setEnabled(true);
_gyroButton->setEnabled(true);
_accelButton->setEnabled(true);
......@@ -160,6 +165,7 @@ void SensorsComponentController::_handleUASTextMessage(int uasId, int compId, in
{
QString startingSidePrefix("Hold still, starting to measure ");
QString sideDoneSuffix(" side done, rotate to a different side");
QString orientationDetectedSuffix(" orientation detected");
Q_UNUSED(compId);
Q_UNUSED(severity);
......@@ -194,83 +200,107 @@ void SensorsComponentController::_handleUASTextMessage(int uasId, int compId, in
if (text == "gyro calibration: started") {
_updateAndEmitShowGyroCalArea(true);
_updateAndEmitGyroCalInProgress(true);
} else if (text == "accel calibration: started") {
_accelCalDownSideDone = false;
_accelCalUpsideDownSideDone = false;
_accelCalLeftSideDone = false;
_accelCalRightSideDone = false;
_accelCalTailDownSideDone = false;
_accelCalNoseDownSideDone = false;
_accelCalDownSideInProgress = false;
_accelCalUpsideDownSideInProgress = false;
_accelCalLeftSideInProgress = false;
_accelCalRightSideInProgress = false;
_accelCalNoseDownSideInProgress = false;
_accelCalTailDownSideInProgress = false;
emit accelCalSidesDoneChanged();
emit accelCalSidesInProgressChanged();
_updateAndEmitShowAccelCalArea(true);
} else if (text == "accel calibration: started" || text == "mag calibration: started") {
if (text == "accel calibration: started") {
_accelCalInProgress = true;
_updateAndEmitCalInProgressText("Hold Still");
} else {
_updateAndEmitCalInProgressText("Rotate");
_magCalInProgress = true;
}
_orientationCalDownSideDone = false;
_orientationCalUpsideDownSideDone = false;
_orientationCalLeftSideDone = false;
_orientationCalRightSideDone = false;
_orientationCalTailDownSideDone = false;
_orientationCalNoseDownSideDone = false;
_orientationCalDownSideInProgress = false;
_orientationCalUpsideDownSideInProgress = false;
_orientationCalLeftSideInProgress = false;
_orientationCalRightSideInProgress = false;
_orientationCalNoseDownSideInProgress = false;
_orientationCalTailDownSideInProgress = false;
emit orientationCalSidesDoneChanged();
emit orientationCalSidesInProgressChanged();
_updateAndEmitShowOrientationCalArea(true);
} else if (text.startsWith(startingSidePrefix)) {
QString side = text.right(text.length() - startingSidePrefix.length()).section(" ", 0, 0);
qDebug() << "Side started" << side;
if (side == "down") {
_accelCalDownSideInProgress = true;
_orientationCalDownSideInProgress = true;
} else if (side == "up") {
_orientationCalUpsideDownSideInProgress = true;
} else if (side == "left") {
_orientationCalLeftSideInProgress = true;
} else if (side == "right") {
_orientationCalRightSideInProgress = true;
} else if (side == "front") {
_orientationCalNoseDownSideInProgress = true;
} else if (side == "back") {
_orientationCalTailDownSideInProgress = true;
}
emit orientationCalSidesInProgressChanged();
} else if (text.endsWith(orientationDetectedSuffix)) {
QString side = text.section(" ", 0, 0);
qDebug() << "Side started" << side;
if (side == "down") {
_orientationCalDownSideInProgress = true;
} else if (side == "up") {
_accelCalUpsideDownSideInProgress = true;
_orientationCalUpsideDownSideInProgress = true;
} else if (side == "left") {
_accelCalLeftSideInProgress = true;
_orientationCalLeftSideInProgress = true;
} else if (side == "right") {
_accelCalRightSideInProgress = true;
_orientationCalRightSideInProgress = true;
} else if (side == "front") {
_accelCalNoseDownSideInProgress = true;
_orientationCalNoseDownSideInProgress = true;
} else if (side == "back") {
_accelCalTailDownSideInProgress = true;
_orientationCalTailDownSideInProgress = true;
}
emit accelCalSidesInProgressChanged();
emit orientationCalSidesInProgressChanged();
} else if (text.endsWith(sideDoneSuffix)) {
QString side = text.section(" ", 0, 0);
qDebug() << "Side finished" << side;
if (side == "down") {
_accelCalDownSideInProgress = false;
_accelCalDownSideDone = true;
_orientationCalDownSideInProgress = false;
_orientationCalDownSideDone = true;
} else if (side == "up") {
_accelCalUpsideDownSideInProgress = false;
_accelCalUpsideDownSideDone = true;
_orientationCalUpsideDownSideInProgress = false;
_orientationCalUpsideDownSideDone = true;
} else if (side == "left") {
_accelCalLeftSideInProgress = false;
_accelCalLeftSideDone = true;
_orientationCalLeftSideInProgress = false;
_orientationCalLeftSideDone = true;
} else if (side == "right") {
_accelCalRightSideInProgress = false;
_accelCalRightSideDone = true;
_orientationCalRightSideInProgress = false;
_orientationCalRightSideDone = true;
} else if (side == "front") {
_accelCalNoseDownSideInProgress = false;
_accelCalNoseDownSideDone = true;
_orientationCalNoseDownSideInProgress = false;
_orientationCalNoseDownSideDone = true;
} else if (side == "back") {
_accelCalTailDownSideInProgress = false;
_accelCalTailDownSideDone = true;
_orientationCalTailDownSideInProgress = false;
_orientationCalTailDownSideDone = true;
}
emit accelCalSidesInProgressChanged();
emit accelCalSidesDoneChanged();
} else if (text == "accel calibration: done") {
emit orientationCalSidesInProgressChanged();
emit orientationCalSidesDoneChanged();
} else if (text == "accel calibration: done" || text == "mag calibration: done") {
_progressBar->setProperty("value", 1);
_accelCalDownSideDone = true;
_accelCalUpsideDownSideDone = true;
_accelCalLeftSideDone = true;
_accelCalRightSideDone = true;
_accelCalTailDownSideDone = true;
_accelCalNoseDownSideDone = true;
_accelCalDownSideInProgress = false;
_accelCalUpsideDownSideInProgress = false;
_accelCalLeftSideInProgress = false;
_accelCalRightSideInProgress = false;
_accelCalNoseDownSideInProgress = false;
_accelCalTailDownSideInProgress = false;
emit accelCalSidesDoneChanged();
emit accelCalSidesInProgressChanged();
_orientationCalDownSideDone = true;
_orientationCalUpsideDownSideDone = true;
_orientationCalLeftSideDone = true;
_orientationCalRightSideDone = true;
_orientationCalTailDownSideDone = true;
_orientationCalNoseDownSideDone = true;
_orientationCalDownSideInProgress = false;
_orientationCalUpsideDownSideInProgress = false;
_orientationCalLeftSideInProgress = false;
_orientationCalRightSideInProgress = false;
_orientationCalNoseDownSideInProgress = false;
_orientationCalTailDownSideInProgress = false;
emit orientationCalSidesDoneChanged();
emit orientationCalSidesInProgressChanged();
_stopCalibration(false /* success */);
} else if (text == "gyro calibration: done") {
_stopCalibration(false /* success */);
} else if (text == "mag calibration: done" || text == "dpress calibration: done") {
} else if (text == "dpress calibration: done") {
_stopCalibration(false /* success */);
} else if (text.endsWith(" calibration: failed")) {
_stopCalibration(true /* failed */);
......@@ -321,14 +351,20 @@ void SensorsComponentController::_updateAndEmitShowGyroCalArea(bool show)
emit showGyroCalAreaChanged();
}
void SensorsComponentController::_updateAndEmitShowAccelCalArea(bool show)
void SensorsComponentController::_updateAndEmitShowOrientationCalArea(bool show)
{
_showAccelCalArea = show;
emit showAccelCalAreaChanged();
_showOrientationCalArea = show;
emit showOrientationCalAreaChanged();
}
void SensorsComponentController::_hideAllCalAreas(void)
{
_updateAndEmitShowGyroCalArea(false);
_updateAndEmitShowAccelCalArea(false);
_updateAndEmitShowOrientationCalArea(false);
}
void SensorsComponentController::_updateAndEmitCalInProgressText(const QString& text)
{
_calInProgressText = text;
emit calInProgressTextChanged(text);
}
......@@ -56,23 +56,25 @@ public:
Q_PROPERTY(bool showCompass2 MEMBER _showCompass2 CONSTANT)
Q_PROPERTY(bool showGyroCalArea MEMBER _showGyroCalArea NOTIFY showGyroCalAreaChanged)
Q_PROPERTY(bool showAccelCalArea MEMBER _showAccelCalArea NOTIFY showAccelCalAreaChanged)
Q_PROPERTY(bool showOrientationCalArea MEMBER _showOrientationCalArea NOTIFY showOrientationCalAreaChanged)
Q_PROPERTY(bool gyroCalInProgress MEMBER _gyroCalInProgress NOTIFY gyroCalInProgressChanged)
Q_PROPERTY(bool accelCalDownSideDone MEMBER _accelCalDownSideDone NOTIFY accelCalSidesDoneChanged)
Q_PROPERTY(bool accelCalUpsideDownSideDone MEMBER _accelCalUpsideDownSideDone NOTIFY accelCalSidesDoneChanged)
Q_PROPERTY(bool accelCalLeftSideDone MEMBER _accelCalLeftSideDone NOTIFY accelCalSidesDoneChanged)
Q_PROPERTY(bool accelCalRightSideDone MEMBER _accelCalRightSideDone NOTIFY accelCalSidesDoneChanged)
Q_PROPERTY(bool accelCalNoseDownSideDone MEMBER _accelCalNoseDownSideDone NOTIFY accelCalSidesDoneChanged)
Q_PROPERTY(bool accelCalTailDownSideDone MEMBER _accelCalTailDownSideDone NOTIFY accelCalSidesDoneChanged)
Q_PROPERTY(QString calInProgressText MEMBER _calInProgressText NOTIFY calInProgressTextChanged)
Q_PROPERTY(bool accelCalDownSideInProgress MEMBER _accelCalDownSideInProgress NOTIFY accelCalSidesInProgressChanged)
Q_PROPERTY(bool accelCalUpsideDownSideInProgress MEMBER _accelCalUpsideDownSideInProgress NOTIFY accelCalSidesInProgressChanged)
Q_PROPERTY(bool accelCalLeftSideInProgress MEMBER _accelCalLeftSideInProgress NOTIFY accelCalSidesInProgressChanged)
Q_PROPERTY(bool accelCalRightSideInProgress MEMBER _accelCalRightSideInProgress NOTIFY accelCalSidesInProgressChanged)
Q_PROPERTY(bool accelCalNoseDownSideInProgress MEMBER _accelCalNoseDownSideInProgress NOTIFY accelCalSidesInProgressChanged)
Q_PROPERTY(bool accelCalTailDownSideInProgress MEMBER _accelCalTailDownSideInProgress NOTIFY accelCalSidesInProgressChanged)
Q_PROPERTY(bool orientationCalDownSideDone MEMBER _orientationCalDownSideDone NOTIFY orientationCalSidesDoneChanged)
Q_PROPERTY(bool orientationCalUpsideDownSideDone MEMBER _orientationCalUpsideDownSideDone NOTIFY orientationCalSidesDoneChanged)
Q_PROPERTY(bool orientationCalLeftSideDone MEMBER _orientationCalLeftSideDone NOTIFY orientationCalSidesDoneChanged)
Q_PROPERTY(bool orientationCalRightSideDone MEMBER _orientationCalRightSideDone NOTIFY orientationCalSidesDoneChanged)
Q_PROPERTY(bool orientationCalNoseDownSideDone MEMBER _orientationCalNoseDownSideDone NOTIFY orientationCalSidesDoneChanged)
Q_PROPERTY(bool orientationCalTailDownSideDone MEMBER _orientationCalTailDownSideDone NOTIFY orientationCalSidesDoneChanged)
Q_PROPERTY(bool orientationCalDownSideInProgress MEMBER _orientationCalDownSideInProgress NOTIFY orientationCalSidesInProgressChanged)
Q_PROPERTY(bool orientationCalUpsideDownSideInProgress MEMBER _orientationCalUpsideDownSideInProgress NOTIFY orientationCalSidesInProgressChanged)
Q_PROPERTY(bool orientationCalLeftSideInProgress MEMBER _orientationCalLeftSideInProgress NOTIFY orientationCalSidesInProgressChanged)
Q_PROPERTY(bool orientationCalRightSideInProgress MEMBER _orientationCalRightSideInProgress NOTIFY orientationCalSidesInProgressChanged)
Q_PROPERTY(bool orientationCalNoseDownSideInProgress MEMBER _orientationCalNoseDownSideInProgress NOTIFY orientationCalSidesInProgressChanged)
Q_PROPERTY(bool orientationCalTailDownSideInProgress MEMBER _orientationCalTailDownSideInProgress NOTIFY orientationCalSidesInProgressChanged)
Q_INVOKABLE void calibrateCompass(void);
Q_INVOKABLE void calibrateGyro(void);
......@@ -83,10 +85,11 @@ public:
signals:
void showGyroCalAreaChanged(void);
void showAccelCalAreaChanged(void);
void showOrientationCalAreaChanged(void);
void gyroCalInProgressChanged(void);
void accelCalSidesDoneChanged(void);
void accelCalSidesInProgressChanged(void);
void orientationCalSidesDoneChanged(void);
void orientationCalSidesInProgressChanged(void);
void calInProgressTextChanged(const QString& newText);
private slots:
void _handleUASTextMessage(int uasId, int compId, int severity, QString text);
......@@ -101,8 +104,10 @@ private:
void _updateAndEmitGyroCalInProgress(bool inProgress);
void _updateAndEmitCalInProgressText(const QString& text);
void _updateAndEmitShowGyroCalArea(bool show);
void _updateAndEmitShowAccelCalArea(bool show);
void _updateAndEmitShowOrientationCalArea(bool show);
QQuickItem* _statusLog;
QQuickItem* _progressBar;
......@@ -112,27 +117,31 @@ private:
QQuickItem* _airspeedButton;
bool _showGyroCalArea;
bool _showAccelCalArea;
bool _showOrientationCalArea;
bool _showCompass0;
bool _showCompass1;
bool _showCompass2;
bool _gyroCalInProgress;
bool _accelCalDownSideDone;
bool _accelCalUpsideDownSideDone;
bool _accelCalLeftSideDone;
bool _accelCalRightSideDone;
bool _accelCalNoseDownSideDone;
bool _accelCalTailDownSideDone;
bool _accelCalDownSideInProgress;
bool _accelCalUpsideDownSideInProgress;
bool _accelCalLeftSideInProgress;
bool _accelCalRightSideInProgress;
bool _accelCalNoseDownSideInProgress;
bool _accelCalTailDownSideInProgress;
bool _magCalInProgress;
bool _accelCalInProgress;
QString _calInProgressText;
bool _orientationCalDownSideDone;
bool _orientationCalUpsideDownSideDone;
bool _orientationCalLeftSideDone;
bool _orientationCalRightSideDone;
bool _orientationCalNoseDownSideDone;
bool _orientationCalTailDownSideDone;
bool _orientationCalDownSideInProgress;
bool _orientationCalUpsideDownSideInProgress;
bool _orientationCalLeftSideInProgress;
bool _orientationCalRightSideInProgress;
bool _orientationCalNoseDownSideInProgress;
bool _orientationCalTailDownSideInProgress;
bool _textLoggingStarted;
......
......@@ -29,25 +29,28 @@ import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
Rectangle {
property var __qgcPal: QGCPalette { colorGroupEnabled: enabled }
property ScreenTools __screenTools: ScreenTools { }
// Indicates whether calibration is valid for this control
property bool calValid: false
// Indicates whether the control is currently being calibrated
property bool calInProgress: false
// Text to show while calibration is in progress
property string calInProgressText: "Hold Still"
// Image source
property var imageSource: ""
property var __qgcPal: QGCPalette { colorGroupEnabled: enabled }
property ScreenTools __screenTools: ScreenTools { }
width: 200
height: 200
color: calInProgress ? "yellow" : (calValid ? "green" : "red")
Rectangle {
readonly property int inset: 5
property string calText: calInProgress ? "Hold Still" : (calValid ? "Completed" : "Incomplete")
property string calText: calInProgress ? calInProgressText : (calValid ? "Completed" : "Incomplete")
x: inset
y: inset
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment