Browse Source

Merge pull request #1679 from DonLakeFlyer/MagCal2

Change mag cal to 6 orientations
QGC4.4
Lorenz Meier 10 years ago
parent
commit
71a4352ee1
  1. 6
      src/AutoPilotPlugins/PX4/SensorsComponent.qml
  2. 21
      src/AutoPilotPlugins/PX4/SensorsComponentController.cc
  3. 8
      src/AutoPilotPlugins/PX4/SensorsComponentController.h

6
src/AutoPilotPlugins/PX4/SensorsComponent.qml

@ -436,7 +436,7 @@ QGCView {
visible: controller.orientationCalUpsideDownSideVisible visible: controller.orientationCalUpsideDownSideVisible
calValid: controller.orientationCalUpsideDownSideDone calValid: controller.orientationCalUpsideDownSideDone
calInProgress: controller.orientationCalUpsideDownSideInProgress calInProgress: controller.orientationCalUpsideDownSideInProgress
calInProgressText: "Hold Still" calInProgressText: controller.orientationCalUpsideDownSideRotate ? "Rotate" : "Hold Still"
imageSource: "qrc:///qmlimages/VehicleUpsideDown.png" imageSource: "qrc:///qmlimages/VehicleUpsideDown.png"
} }
VehicleRotationCal { VehicleRotationCal {
@ -450,7 +450,7 @@ QGCView {
visible: controller.orientationCalTailDownSideVisible visible: controller.orientationCalTailDownSideVisible
calValid: controller.orientationCalTailDownSideDone calValid: controller.orientationCalTailDownSideDone
calInProgress: controller.orientationCalTailDownSideInProgress calInProgress: controller.orientationCalTailDownSideInProgress
calInProgressText: "Hold Still" calInProgressText: controller.orientationCalTailDownSideRotate ? "Rotate" : "Hold Still"
imageSource: "qrc:///qmlimages/VehicleTailDown.png" imageSource: "qrc:///qmlimages/VehicleTailDown.png"
} }
VehicleRotationCal { VehicleRotationCal {
@ -464,7 +464,7 @@ QGCView {
visible: controller.orientationCalRightSideVisible visible: controller.orientationCalRightSideVisible
calValid: controller.orientationCalRightSideDone calValid: controller.orientationCalRightSideDone
calInProgress: controller.orientationCalRightSideInProgress calInProgress: controller.orientationCalRightSideInProgress
calInProgressText: "Hold Still" calInProgressText: controller.orientationCalRightSideRotate ? "Rotate" : "Hold Still"
imageSource: "qrc:///qmlimages/VehicleRight.png" imageSource: "qrc:///qmlimages/VehicleRight.png"
} }
} }

21
src/AutoPilotPlugins/PX4/SensorsComponentController.cc

@ -64,8 +64,11 @@ SensorsComponentController::SensorsComponentController(void) :
_orientationCalNoseDownSideInProgress(false), _orientationCalNoseDownSideInProgress(false),
_orientationCalTailDownSideInProgress(false), _orientationCalTailDownSideInProgress(false),
_orientationCalDownSideRotate(false), _orientationCalDownSideRotate(false),
_orientationCalUpsideDownSideRotate(false),
_orientationCalLeftSideRotate(false), _orientationCalLeftSideRotate(false),
_orientationCalRightSideRotate(false),
_orientationCalNoseDownSideRotate(false), _orientationCalNoseDownSideRotate(false),
_orientationCalTailDownSideRotate(false),
_unknownFirmwareVersion(false), _unknownFirmwareVersion(false),
_waitingForCancel(false) _waitingForCancel(false)
{ {
@ -242,9 +245,11 @@ void SensorsComponentController::_handleUASTextMessage(int uasId, int compId, in
// Split version number and cal type // Split version number and cal type
QStringList parts = text.split(" "); QStringList parts = text.split(" ");
if (parts.count() != 2 && parts[0].toInt() != 1) { if (parts.count() != 2 && parts[0].toInt() != _supportedFirmwareCalVersion) {
_unknownFirmwareVersion = true; _unknownFirmwareVersion = true;
qDebug() << "Unknown cal firmware version, using log"; QString msg = "Unsupported calibration firmware version, using log";
_appendStatusLog(msg);
qDebug() << msg;
return; return;
} }
@ -287,7 +292,10 @@ void SensorsComponentController::_handleUASTextMessage(int uasId, int compId, in
} else if (text == "mag") { } else if (text == "mag") {
_magCalInProgress = true; _magCalInProgress = true;
_orientationCalDownSideVisible = true; _orientationCalDownSideVisible = true;
_orientationCalUpsideDownSideVisible = true;
_orientationCalLeftSideVisible = true; _orientationCalLeftSideVisible = true;
_orientationCalRightSideVisible = true;
_orientationCalTailDownSideVisible = true;
_orientationCalNoseDownSideVisible = true; _orientationCalNoseDownSideVisible = true;
} else if (text == "gyro") { } else if (text == "gyro") {
_gyroCalInProgress = true; _gyroCalInProgress = true;
@ -314,6 +322,9 @@ void SensorsComponentController::_handleUASTextMessage(int uasId, int compId, in
} }
} else if (side == "up") { } else if (side == "up") {
_orientationCalUpsideDownSideInProgress = true; _orientationCalUpsideDownSideInProgress = true;
if (_magCalInProgress) {
_orientationCalUpsideDownSideRotate = true;
}
} else if (side == "left") { } else if (side == "left") {
_orientationCalLeftSideInProgress = true; _orientationCalLeftSideInProgress = true;
if (_magCalInProgress) { if (_magCalInProgress) {
@ -321,6 +332,9 @@ void SensorsComponentController::_handleUASTextMessage(int uasId, int compId, in
} }
} else if (side == "right") { } else if (side == "right") {
_orientationCalRightSideInProgress = true; _orientationCalRightSideInProgress = true;
if (_magCalInProgress) {
_orientationCalRightSideRotate = true;
}
} else if (side == "front") { } else if (side == "front") {
_orientationCalNoseDownSideInProgress = true; _orientationCalNoseDownSideInProgress = true;
if (_magCalInProgress) { if (_magCalInProgress) {
@ -328,6 +342,9 @@ void SensorsComponentController::_handleUASTextMessage(int uasId, int compId, in
} }
} else if (side == "back") { } else if (side == "back") {
_orientationCalTailDownSideInProgress = true; _orientationCalTailDownSideInProgress = true;
if (_magCalInProgress) {
_orientationCalTailDownSideRotate = true;
}
} }
if (_magCalInProgress) { if (_magCalInProgress) {

8
src/AutoPilotPlugins/PX4/SensorsComponentController.h

@ -78,8 +78,11 @@ public:
Q_PROPERTY(bool orientationCalTailDownSideInProgress MEMBER _orientationCalTailDownSideInProgress NOTIFY orientationCalSidesInProgressChanged) Q_PROPERTY(bool orientationCalTailDownSideInProgress MEMBER _orientationCalTailDownSideInProgress NOTIFY orientationCalSidesInProgressChanged)
Q_PROPERTY(bool orientationCalDownSideRotate MEMBER _orientationCalDownSideRotate NOTIFY orientationCalSidesRotateChanged) Q_PROPERTY(bool orientationCalDownSideRotate MEMBER _orientationCalDownSideRotate NOTIFY orientationCalSidesRotateChanged)
Q_PROPERTY(bool orientationCalUpsideDownSideRotate MEMBER _orientationCalUpsideDownSideRotate NOTIFY orientationCalSidesRotateChanged)
Q_PROPERTY(bool orientationCalLeftSideRotate MEMBER _orientationCalLeftSideRotate NOTIFY orientationCalSidesRotateChanged) Q_PROPERTY(bool orientationCalLeftSideRotate MEMBER _orientationCalLeftSideRotate NOTIFY orientationCalSidesRotateChanged)
Q_PROPERTY(bool orientationCalRightSideRotate MEMBER _orientationCalRightSideRotate NOTIFY orientationCalSidesRotateChanged)
Q_PROPERTY(bool orientationCalNoseDownSideRotate MEMBER _orientationCalNoseDownSideRotate NOTIFY orientationCalSidesRotateChanged) Q_PROPERTY(bool orientationCalNoseDownSideRotate MEMBER _orientationCalNoseDownSideRotate NOTIFY orientationCalSidesRotateChanged)
Q_PROPERTY(bool orientationCalTailDownSideRotate MEMBER _orientationCalTailDownSideRotate NOTIFY orientationCalSidesRotateChanged)
Q_PROPERTY(bool waitingForCancel MEMBER _waitingForCancel NOTIFY waitingForCancelChanged) Q_PROPERTY(bool waitingForCancel MEMBER _waitingForCancel NOTIFY waitingForCancelChanged)
@ -161,11 +164,16 @@ private:
bool _orientationCalTailDownSideInProgress; bool _orientationCalTailDownSideInProgress;
bool _orientationCalDownSideRotate; bool _orientationCalDownSideRotate;
bool _orientationCalUpsideDownSideRotate;
bool _orientationCalLeftSideRotate; bool _orientationCalLeftSideRotate;
bool _orientationCalRightSideRotate;
bool _orientationCalNoseDownSideRotate; bool _orientationCalNoseDownSideRotate;
bool _orientationCalTailDownSideRotate;
bool _unknownFirmwareVersion; bool _unknownFirmwareVersion;
bool _waitingForCancel; bool _waitingForCancel;
static const int _supportedFirmwareCalVersion = 2;
}; };
#endif #endif

Loading…
Cancel
Save