Commit 944d7224 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #4350 from DonLakeFlyer/APMOnboardCal

ArduPilot: Onboard compass cal support
parents 7af82baf d3174b1c
<RCC>
<qresource prefix="/unittest">
<file alias="APMArduCopterMockLink.params">src/comm/APMArduCopterMockLink.params</file>
<file alias="APMArduPlaneMockLink.params">src/comm/APMArduPlaneMockLink.params</file>
<file alias="APMArduSubMockLink.params">src/comm/APMArduSubMockLink.params</file>
</qresource>
<qresource prefix="/qml">
<file alias="APMAirframeComponent.qml">src/AutoPilotPlugins/APM/APMAirframeComponent.qml</file>
<file alias="APMAirframeComponentSummary.qml">src/AutoPilotPlugins/APM/APMAirframeComponentSummary.qml</file>
<file alias="APMCameraComponent.qml">src/AutoPilotPlugins/APM/APMCameraComponent.qml</file>
<file alias="APMCameraComponentSummary.qml">src/AutoPilotPlugins/APM/APMCameraComponentSummary.qml</file>
<file alias="APMFlightModesComponent.qml">src/AutoPilotPlugins/APM/APMFlightModesComponent.qml</file>
<file alias="APMFlightModesComponentSummary.qml">src/AutoPilotPlugins/APM/APMFlightModesComponentSummary.qml</file>
<file alias="APMLightsComponent.qml">src/AutoPilotPlugins/APM/APMLightsComponent.qml</file>
<file alias="APMLightsComponentSummary.qml">src/AutoPilotPlugins/APM/APMLightsComponentSummary.qml</file>
<file alias="APMNotSupported.qml">src/AutoPilotPlugins/APM/APMNotSupported.qml</file>
<file alias="APMPowerComponent.qml">src/AutoPilotPlugins/APM/APMPowerComponent.qml</file>
<file alias="APMPowerComponentSummary.qml">src/AutoPilotPlugins/APM/APMPowerComponentSummary.qml</file>
<file alias="APMRadioComponentSummary.qml">src/AutoPilotPlugins/APM/APMRadioComponentSummary.qml</file>
<file alias="APMSafetyComponentCopter.qml">src/AutoPilotPlugins/APM/APMSafetyComponentCopter.qml</file>
<file alias="APMSafetyComponentPlane.qml">src/AutoPilotPlugins/APM/APMSafetyComponentPlane.qml</file>
<file alias="APMSafetyComponentRover.qml">src/AutoPilotPlugins/APM/APMSafetyComponentRover.qml</file>
<file alias="APMSafetyComponentSub.qml">src/AutoPilotPlugins/APM/APMSafetyComponentSub.qml</file>
<file alias="APMSafetyComponentSummaryCopter.qml">src/AutoPilotPlugins/APM/APMSafetyComponentSummaryCopter.qml</file>
<file alias="APMSafetyComponentSummaryPlane.qml">src/AutoPilotPlugins/APM/APMSafetyComponentSummaryPlane.qml</file>
<file alias="APMSafetyComponentSummaryRover.qml">src/AutoPilotPlugins/APM/APMSafetyComponentSummaryRover.qml</file>
<file alias="APMSafetyComponentSummarySub.qml">src/AutoPilotPlugins/APM/APMSafetyComponentSummarySub.qml</file>
<file alias="APMSensorsComponent.qml">src/AutoPilotPlugins/APM/APMSensorsComponent.qml</file>
<file alias="APMSensorsComponentSummary.qml">src/AutoPilotPlugins/APM/APMSensorsComponentSummary.qml</file>
<file alias="APMTuningComponentCopter.qml">src/AutoPilotPlugins/APM/APMTuningComponentCopter.qml</file>
</qresource>
<qresource prefix="/json">
<file alias="APM/MavCmdInfoCommon.json">src/FirmwarePlugin/APM/MavCmdInfoCommon.json</file>
<file alias="APM/MavCmdInfoFixedWing.json">src/FirmwarePlugin/APM/MavCmdInfoFixedWing.json</file>
<file alias="APM/MavCmdInfoMultiRotor.json">src/FirmwarePlugin/APM/MavCmdInfoMultiRotor.json</file>
<file alias="APM/MavCmdInfoRover.json">src/FirmwarePlugin/APM/MavCmdInfoRover.json</file>
<file alias="APM/MavCmdInfoSub.json">src/FirmwarePlugin/APM/MavCmdInfoSub.json</file>
<file alias="APM/MavCmdInfoVTOL.json">src/FirmwarePlugin/APM/MavCmdInfoVTOL.json</file>
</qresource>
</RCC>
<RCC>
<qresource prefix="/unittest">
<file alias="PX4MockLink.params">src/comm/PX4MockLink.params</file>
</qresource>
<qresource prefix="/qml">
<file alias="PX4AdvancedFlightModes.qml">src/AutoPilotPlugins/PX4/PX4AdvancedFlightModes.qml</file>
<file alias="PX4FlightModes.qml">src/AutoPilotPlugins/PX4/PX4FlightModes.qml</file>
<file alias="PX4FlowSensor.qml">src/VehicleSetup/PX4FlowSensor.qml</file>
<file alias="PX4RadioComponentSummary.qml">src/AutoPilotPlugins/PX4/PX4RadioComponentSummary.qml</file>
<file alias="PX4SimpleFlightModes.qml">src/AutoPilotPlugins/PX4/PX4SimpleFlightModes.qml</file>
<file alias="PX4TuningComponentCopter.qml">src/AutoPilotPlugins/PX4/PX4TuningComponentCopter.qml</file>
<file alias="PX4TuningComponentPlane.qml">src/AutoPilotPlugins/PX4/PX4TuningComponentPlane.qml</file>
<file alias="PX4TuningComponentVTOL.qml">src/AutoPilotPlugins/PX4/PX4TuningComponentVTOL.qml</file>
</qresource>
<qresource prefix="/json">
<file alias="PX4/MavCmdInfoCommon.json">src/FirmwarePlugin/PX4/MavCmdInfoCommon.json</file>
<file alias="PX4/MavCmdInfoFixedWing.json">src/FirmwarePlugin/PX4/MavCmdInfoFixedWing.json</file>
<file alias="PX4/MavCmdInfoMultiRotor.json">src/FirmwarePlugin/PX4/MavCmdInfoMultiRotor.json</file>
<file alias="PX4/MavCmdInfoRover.json">src/FirmwarePlugin/PX4/MavCmdInfoRover.json</file>
<file alias="PX4/MavCmdInfoSub.json">src/FirmwarePlugin/PX4/MavCmdInfoSub.json</file>
<file alias="PX4/MavCmdInfoVTOL.json">src/FirmwarePlugin/PX4/MavCmdInfoVTOL.json</file>
</qresource>
</RCC>
......@@ -268,33 +268,6 @@
<qresource prefix="/res/audio">
<file alias="Alert">resources/audio/alert.wav</file>
</qresource>
<qresource prefix="/AutoPilotPlugins/PX4">
<file alias="AirframeFactMetaData.xml">src/AutoPilotPlugins/PX4/AirframeFactMetaData.xml</file>
</qresource>
<qresource prefix="/AutoPilotPlugins/APM">
<file alias="APMAirframeFactMetaData.xml">src/AutoPilotPlugins/APM/APMAirframeFactMetaData.xml</file>
</qresource>
<qresource prefix="/FirmwarePlugin/APM">
<file alias="APMParameterFactMetaData.Plane.3.3.xml">src/FirmwarePlugin/APM/APMParameterFactMetaData.Plane.3.3.xml</file>
<file alias="APMParameterFactMetaData.Plane.3.5.xml">src/FirmwarePlugin/APM/APMParameterFactMetaData.Plane.3.5.xml</file>
<file alias="APMParameterFactMetaData.Plane.3.7.xml">src/FirmwarePlugin/APM/APMParameterFactMetaData.Plane.3.7.xml</file>
<file alias="APMParameterFactMetaData.Copter.3.3.xml">src/FirmwarePlugin/APM/APMParameterFactMetaData.Copter.3.3.xml</file>
<file alias="APMParameterFactMetaData.Copter.3.4.xml">src/FirmwarePlugin/APM/APMParameterFactMetaData.Copter.3.4.xml</file>
<file alias="APMParameterFactMetaData.Rover.3.0.xml">src/FirmwarePlugin/APM/APMParameterFactMetaData.Rover.3.0.xml</file>
<file alias="APMParameterFactMetaData.Sub.3.4.xml">src/FirmwarePlugin/APM/APMParameterFactMetaData.Sub.3.4.xml</file>
<file alias="CopterGeoFenceEditor.qml">src/FirmwarePlugin/APM/CopterGeoFenceEditor.qml</file>
<file alias="PlaneGeoFenceEditor.qml">src/FirmwarePlugin/APM/PlaneGeoFenceEditor.qml</file>
<file alias="Copter.OfflineEditing.params">src/FirmwarePlugin/APM/Copter3.4.OfflineEditing.params</file>
<file alias="Plane.OfflineEditing.params">src/FirmwarePlugin/APM/Plane3.7.OfflineEditing.params</file>
</qresource>
<qresource prefix="/FirmwarePlugin">
<file alias="GeoFenceEditor.qml">src/FirmwarePlugin/GeoFenceEditor.qml</file>
</qresource>
<qresource prefix="/FirmwarePlugin/PX4">
<file alias="PX4ParameterFactMetaData.xml">src/FirmwarePlugin/PX4/PX4ParameterFactMetaData.xml</file>
<file alias="PX4GeoFenceEditor.qml">src/FirmwarePlugin/PX4/PX4GeoFenceEditor.qml</file>
<file alias="PX4.OfflineEditing.params">src/FirmwarePlugin/PX4/V1.4.OfflineEditing.params</file>
</qresource>
<qresource prefix="/opengl">
<file>resources/opengl/buglist.json</file>
</qresource>
......
......@@ -782,7 +782,7 @@ SOURCES += \
# ArduPilot FirmwarePlugin
APMFirmwarePlugin {
RESOURCES *= apmresources.qrc
RESOURCES *= src/FirmwarePlugin/APM/APMResources.qrc
INCLUDEPATH += \
src/AutoPilotPlugins/APM \
......@@ -842,7 +842,6 @@ APMFirmwarePlugin {
}
APMFirmwarePluginFactory {
RESOURCES *= apmresources.qrc
HEADERS += src/FirmwarePlugin/APM/APMFirmwarePluginFactory.h
SOURCES += src/FirmwarePlugin/APM/APMFirmwarePluginFactory.cc
}
......@@ -850,7 +849,7 @@ APMFirmwarePluginFactory {
# PX4 FirmwarePlugin
PX4FirmwarePlugin {
RESOURCES *= px4resources.qrc
RESOURCES *= src/FirmwarePlugin/PX4/PX4Resources.qrc
INCLUDEPATH += \
src/AutoPilotPlugins/PX4 \
......@@ -900,7 +899,6 @@ PX4FirmwarePlugin {
}
PX4FirmwarePluginFactory {
RESOURCES *= px4resources.qrc
HEADERS += src/FirmwarePlugin/PX4/PX4FirmwarePluginFactory.h
SOURCES += src/FirmwarePlugin/PX4/PX4FirmwarePluginFactory.cc
}
......
......@@ -38,6 +38,7 @@
<file alias="OfflineMap.qml">src/QtLocationPlugin/QMLControl/OfflineMap.qml</file>
<file alias="PowerComponent.qml">src/AutoPilotPlugins/PX4/PowerComponent.qml</file>
<file alias="PowerComponentSummary.qml">src/AutoPilotPlugins/PX4/PowerComponentSummary.qml</file>
<file alias="PX4FlowSensor.qml">src/VehicleSetup/PX4FlowSensor.qml</file>
<file alias="QGroundControl/Controls/AnalyzePage.qml">src/AnalyzeView/AnalyzePage.qml</file>
<file alias="QGroundControl/Controls/AppMessages.qml">src/QmlControls/AppMessages.qml</file>
<file alias="QGroundControl/Controls/ClickableColor.qml">src/QmlControls/ClickableColor.qml</file>
......@@ -159,4 +160,13 @@
<file alias="RallyPoint.FactMetaData.json">src/MissionManager/RallyPoint.FactMetaData.json</file>
<file alias="Survey.FactMetaData.json">src/MissionManager/Survey.FactMetaData.json</file>
</qresource>
<qresource prefix="/MockLink">
<file alias="APMArduCopterMockLink.params">src/comm/APMArduCopterMockLink.params</file>
<file alias="APMArduPlaneMockLink.params">src/comm/APMArduPlaneMockLink.params</file>
<file alias="APMArduSubMockLink.params">src/comm/APMArduSubMockLink.params</file>
<file alias="PX4MockLink.params">src/comm/PX4MockLink.params</file>
</qresource>
<qresource prefix="/FirmwarePlugin">
<file alias="GeoFenceEditor.qml">src/FirmwarePlugin/GeoFenceEditor.qml</file>
</qresource>
</RCC>
......@@ -20,6 +20,7 @@
#include "APMCompassCal.h"
Q_DECLARE_LOGGING_CATEGORY(APMSensorsComponentControllerLog)
Q_DECLARE_LOGGING_CATEGORY(APMSensorsComponentControllerVerboseLog)
/// Sensors Component MVC Controller for SensorsComponent.qml.
class APMSensorsComponentController : public FactPanelController
......@@ -28,6 +29,7 @@ class APMSensorsComponentController : public FactPanelController
public:
APMSensorsComponentController(void);
~APMSensorsComponentController();
Q_PROPERTY(QQuickItem* statusLog MEMBER _statusLog)
Q_PROPERTY(QQuickItem* progressBar MEMBER _progressBar)
......@@ -75,7 +77,15 @@ public:
Q_PROPERTY(bool orientationCalTailDownSideRotate MEMBER _orientationCalTailDownSideRotate NOTIFY orientationCalSidesRotateChanged)
Q_PROPERTY(bool waitingForCancel MEMBER _waitingForCancel NOTIFY waitingForCancelChanged)
Q_PROPERTY(bool compass1CalSucceeded READ compass1CalSucceeded NOTIFY compass1CalSucceededChanged)
Q_PROPERTY(bool compass2CalSucceeded READ compass2CalSucceeded NOTIFY compass2CalSucceededChanged)
Q_PROPERTY(bool compass3CalSucceeded READ compass3CalSucceeded NOTIFY compass3CalSucceededChanged)
Q_PROPERTY(double compass1CalFitness READ compass1CalFitness NOTIFY compass1CalFitnessChanged)
Q_PROPERTY(double compass2CalFitness READ compass2CalFitness NOTIFY compass2CalFitnessChanged)
Q_PROPERTY(double compass3CalFitness READ compass3CalFitness NOTIFY compass3CalFitnessChanged)
Q_INVOKABLE void calibrateCompass(void);
Q_INVOKABLE void calibrateAccel(void);
Q_INVOKABLE void calibrateMotorInterference(void);
......@@ -86,7 +96,25 @@ public:
bool compassSetupNeeded(void) const;
bool accelSetupNeeded(void) const;
typedef enum {
CalTypeAccel,
CalTypeOnboardCompass,
CalTypeOffboardCompass,
CalTypeLevelHorizon,
CalTypeCompassMot,
CalTypeNone
} CalType_t;
Q_ENUM(CalType_t)
bool compass1CalSucceeded(void) const { return _rgCompassCalSucceeded[0]; }
bool compass2CalSucceeded(void) const { return _rgCompassCalSucceeded[1]; }
bool compass3CalSucceeded(void) const { return _rgCompassCalSucceeded[2]; }
double compass1CalFitness(void) const { return _rgCompassCalFitness[0]; }
double compass2CalFitness(void) const { return _rgCompassCalFitness[1]; }
double compass3CalFitness(void) const { return _rgCompassCalFitness[2]; }
signals:
void showGyroCalAreaChanged(void);
void showOrientationCalAreaChanged(void);
......@@ -97,11 +125,18 @@ signals:
void resetStatusTextArea(void);
void waitingForCancelChanged(void);
void setupNeededChanged(void);
void calibrationComplete(void);
void calibrationComplete(CalType_t calType);
void compass1CalSucceededChanged(bool compass1CalSucceeded);
void compass2CalSucceededChanged(bool compass2CalSucceeded);
void compass3CalSucceededChanged(bool compass3CalSucceeded);
void compass1CalFitnessChanged(double compass1CalFitness);
void compass2CalFitnessChanged(double compass2CalFitness);
void compass3CalFitnessChanged(double compass3CalFitness);
private slots:
void _handleUASTextMessage(int uasId, int compId, int severity, QString text);
void _mavlinkMessageReceived(LinkInterface* link, mavlink_message_t message);
void _mavCommandResult(int vehicleId, int component, int command, int result, bool noReponseFromVehicle);
private:
void _startLogCalibration(void);
......@@ -110,7 +145,11 @@ private:
void _refreshParams(void);
void _hideAllCalAreas(void);
void _resetInternalState(void);
void _handleCommandAck(mavlink_message_t& message);
void _handleMagCalProgress(mavlink_message_t& message);
void _handleMagCalReport(mavlink_message_t& message);
void _restorePreviousCompassCalFitness(void);
enum StopCalibrationCode {
StopCalibrationSuccess,
StopCalibrationSuccessShowLog,
......@@ -137,11 +176,13 @@ private:
bool _showOrientationCalArea;
bool _magCalInProgress;
bool _accelCalInProgress;
bool _compassMotCalInProgress;
bool _levelInProgress;
CalType_t _calTypeInProgress;
uint8_t _rgCompassCalProgress[3];
bool _rgCompassCalComplete[3];
bool _rgCompassCalSucceeded[3];
float _rgCompassCalFitness[3];
bool _orientationCalDownSideDone;
bool _orientationCalUpsideDownSideDone;
bool _orientationCalLeftSideDone;
......@@ -171,6 +212,10 @@ private:
bool _orientationCalTailDownSideRotate;
bool _waitingForCancel;
bool _restoreCompassCalFitness;
float _previousCompassCalFitness;
static const char* _compassCalFitnessParam;
static const int _supportedFirmwareCalVersion = 2;
};
......
......@@ -7,6 +7,7 @@ import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controllers 1.0
import QGroundControl.ArduPilot 1.0
/*
IMPORTANT NOTE: Any changes made here must also be made to SensorsComponentSummary.qml
......@@ -18,55 +19,35 @@ FactPanel {
color: qgcPal.windowShadeDark
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
APMSensorsComponentController { id: controller; factPanel: panel }
property Fact compass1IdFact: controller.getParameterFact(-1, "COMPASS_DEV_ID")
property Fact compass2IdFact: controller.getParameterFact(-1, "COMPASS_DEV_ID2")
property Fact compass3IdFact: controller.getParameterFact(-1, "COMPASS_DEV_ID3")
property Fact compass1OfsXFact: controller.getParameterFact(-1, "COMPASS_OFS_X")
property Fact compass1OfsYFact: controller.getParameterFact(-1, "COMPASS_OFS_Y")
property Fact compass1OfsZFact: controller.getParameterFact(-1, "COMPASS_OFS_Z")
property Fact compass2OfsXFact: controller.getParameterFact(-1, "COMPASS_OFS2_X")
property Fact compass2OfsYFact: controller.getParameterFact(-1, "COMPASS_OFS2_Y")
property Fact compass2OfsZFact: controller.getParameterFact(-1, "COMPASS_OFS2_Z")
property Fact compass3OfsXFact: controller.getParameterFact(-1, "COMPASS_OFS3_X")
property Fact compass3OfsYFact: controller.getParameterFact(-1, "COMPASS_OFS3_Y")
property Fact compass3OfsZFact: controller.getParameterFact(-1, "COMPASS_OFS3_Z")
property bool compass1Available: compass1IdFact.value !== 0
property bool compass2Available: compass2IdFact.value !== 0
property bool compass3Available: compass3IdFact.value !== 0
property bool compass1Calibrated: compass1Available ? compass1OfsXFact.value != 0.0 && compass1OfsYFact.value != 0.0 &&compass1OfsZFact.value != 0.0 : false
property bool compass2Calibrated: compass2Available ? compass2OfsXFact.value != 0.0 && compass2OfsYFact.value != 0.0 &&compass2OfsZFact.value != 0.0 : false
property bool compass3Calibrated: compass3Available ? compass3OfsXFact.value != 0.0 && compass3OfsYFact.value != 0.0 &&compass3OfsZFact.value != 0.0 : false
APMSensorsComponentController { id: controller; factPanel: panel }
property bool compassCalNeeded: controller.compassSetupNeeded
APMSensorParams {
id: sensorParams
factPanelController: controller
}
Column {
anchors.fill: parent
VehicleSummaryRow {
labelText: qsTr("Compass 1:")
visible: compass1Available
valueText: compass1Calibrated ? qsTr("Ready") : qsTr("Setup required")
}
VehicleSummaryRow {
labelText: qsTr("Compass 2:")
visible: compass2Available
valueText: compass2Calibrated ? qsTr("Ready") : qsTr("Setup required")
}
VehicleSummaryRow {
labelText: qsTr("Compass 3:")
visible: compass3Available
valueText: compass3Calibrated ? qsTr("Ready") : qsTr("Setup required")
Repeater {
model: 3
VehicleSummaryRow {
labelText: qsTr("Compass ") + (index + 1) + ":"
valueText: sensorParams.rgCompassAvailable[index] ?
(sensorParams.rgCompassCalibrated[index] ?
(sensorParams.rgCompassPrimary[index] ? "Primary" : "Secondary") +
(sensorParams.rgCompassExternalParamAvailable[index] ?
(sensorParams.rgCompassExternal[index] ? ", External" : ", Internal" ) :
"") :
qsTr("Setup required")) :
qsTr("Not installed")
}
}
VehicleSummaryRow {
labelText: qsTr("Accelerometer:")
labelText: qsTr("Accelerometer(s):")
valueText: controller.accelSetupNeeded ? qsTr("Setup required") : qsTr("Ready")
}
}
......
<RCC>
<qresource prefix="/qml">
<file alias="APMAirframeComponent.qml">../../AutoPilotPlugins/APM/APMAirframeComponent.qml</file>
<file alias="APMAirframeComponentSummary.qml">../../AutoPilotPlugins/APM/APMAirframeComponentSummary.qml</file>
<file alias="APMCameraComponent.qml">../../AutoPilotPlugins/APM/APMCameraComponent.qml</file>
<file alias="APMCameraComponentSummary.qml">../../AutoPilotPlugins/APM/APMCameraComponentSummary.qml</file>
<file alias="APMFlightModesComponent.qml">../../AutoPilotPlugins/APM/APMFlightModesComponent.qml</file>
<file alias="APMFlightModesComponentSummary.qml">../../AutoPilotPlugins/APM/APMFlightModesComponentSummary.qml</file>
<file alias="APMLightsComponent.qml">../../AutoPilotPlugins/APM/APMLightsComponent.qml</file>
<file alias="APMLightsComponentSummary.qml">../../AutoPilotPlugins/APM/APMLightsComponentSummary.qml</file>
<file alias="APMNotSupported.qml">../../AutoPilotPlugins/APM/APMNotSupported.qml</file>
<file alias="APMPowerComponent.qml">../../AutoPilotPlugins/APM/APMPowerComponent.qml</file>
<file alias="APMPowerComponentSummary.qml">../../AutoPilotPlugins/APM/APMPowerComponentSummary.qml</file>
<file alias="APMRadioComponentSummary.qml">../../AutoPilotPlugins/APM/APMRadioComponentSummary.qml</file>
<file alias="APMSafetyComponentCopter.qml">../../AutoPilotPlugins/APM/APMSafetyComponentCopter.qml</file>
<file alias="APMSafetyComponentPlane.qml">../../AutoPilotPlugins/APM/APMSafetyComponentPlane.qml</file>
<file alias="APMSafetyComponentRover.qml">../../AutoPilotPlugins/APM/APMSafetyComponentRover.qml</file>
<file alias="APMSafetyComponentSub.qml">../../AutoPilotPlugins/APM/APMSafetyComponentSub.qml</file>
<file alias="APMSafetyComponentSummaryCopter.qml">../../AutoPilotPlugins/APM/APMSafetyComponentSummaryCopter.qml</file>
<file alias="APMSafetyComponentSummaryPlane.qml">../../AutoPilotPlugins/APM/APMSafetyComponentSummaryPlane.qml</file>
<file alias="APMSafetyComponentSummaryRover.qml">../../AutoPilotPlugins/APM/APMSafetyComponentSummaryRover.qml</file>
<file alias="APMSafetyComponentSummarySub.qml">../../AutoPilotPlugins/APM/APMSafetyComponentSummarySub.qml</file>
<file alias="APMSensorsComponent.qml">../../AutoPilotPlugins/APM/APMSensorsComponent.qml</file>
<file alias="APMSensorsComponentSummary.qml">../../AutoPilotPlugins/APM/APMSensorsComponentSummary.qml</file>
<file alias="APMTuningComponentCopter.qml">../../AutoPilotPlugins/APM/APMTuningComponentCopter.qml</file>
<file alias="QGroundControl/ArduPilot/APMSensorParams.qml">APMSensorParams.qml</file>
<file alias="QGroundControl/ArduPilot/qmldir">QGroundControl.ArduPilot.qmldir</file>
</qresource>
<qresource prefix="/json">
<file alias="APM/MavCmdInfoCommon.json">MavCmdInfoCommon.json</file>
<file alias="APM/MavCmdInfoFixedWing.json">MavCmdInfoFixedWing.json</file>
<file alias="APM/MavCmdInfoMultiRotor.json">MavCmdInfoMultiRotor.json</file>
<file alias="APM/MavCmdInfoRover.json">MavCmdInfoRover.json</file>
<file alias="APM/MavCmdInfoSub.json">MavCmdInfoSub.json</file>
<file alias="APM/MavCmdInfoVTOL.json">MavCmdInfoVTOL.json</file>
</qresource>
<qresource prefix="/AutoPilotPlugins/APM">
<file alias="APMAirframeFactMetaData.xml">../../AutoPilotPlugins/APM/APMAirframeFactMetaData.xml</file>
</qresource>
<qresource prefix="/FirmwarePlugin/APM">
<file alias="APMParameterFactMetaData.Plane.3.3.xml">APMParameterFactMetaData.Plane.3.3.xml</file>
<file alias="APMParameterFactMetaData.Plane.3.5.xml">APMParameterFactMetaData.Plane.3.5.xml</file>
<file alias="APMParameterFactMetaData.Plane.3.7.xml">APMParameterFactMetaData.Plane.3.7.xml</file>
<file alias="APMParameterFactMetaData.Copter.3.3.xml">APMParameterFactMetaData.Copter.3.3.xml</file>
<file alias="APMParameterFactMetaData.Copter.3.4.xml">APMParameterFactMetaData.Copter.3.4.xml</file>
<file alias="APMParameterFactMetaData.Rover.3.0.xml">APMParameterFactMetaData.Rover.3.0.xml</file>
<file alias="APMParameterFactMetaData.Sub.3.4.xml">APMParameterFactMetaData.Sub.3.4.xml</file>
<file alias="CopterGeoFenceEditor.qml">CopterGeoFenceEditor.qml</file>
<file alias="PlaneGeoFenceEditor.qml">PlaneGeoFenceEditor.qml</file>
<file alias="Copter.OfflineEditing.params">Copter3.4.OfflineEditing.params</file>
<file alias="Plane.OfflineEditing.params">Plane3.7.OfflineEditing.params</file>
</qresource>
</RCC>
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import QtQuick 2.2
import QGroundControl.FactSystem 1.0
/// This is used to handle the various differences between firmware versions and missing parameters in each in a standard way.
Item {
property var factPanelController ///< Must be specified by consumer of control
property Fact _noFact: Fact { }
property Fact compassPrimaryFact: factPanelController.getParameterFact(-1, "COMPASS_PRIMARY")
property bool compass1Primary: compassPrimaryFact.rawValue == 0
property bool compass2Primary: compassPrimaryFact.rawValue == 1
property bool compass3Primary: compassPrimaryFact.rawValue == 2
property var rgCompassPrimary: [ compass1Primary, compass2Primary, compass3Primary ]
property Fact compass1Id: factPanelController.getParameterFact(-1, "COMPASS_DEV_ID")
property Fact compass2Id: factPanelController.getParameterFact(-1, "COMPASS_DEV_ID2")
property Fact compass3Id: factPanelController.getParameterFact(-1, "COMPASS_DEV_ID3")
property bool compass1Available: compass1Id.value > 0
property bool compass2Available: compass2Id.value > 0
property bool compass3Available: compass3Id.value > 0
property var rgCompassAvailable: [ compass1Available, compass2Available, compass3Available ]
property bool compass1RotParamAvailable: factPanelController.parameterExists(-1, "COMPASS_ORIENT")
property bool compass2RotParamAvailable: factPanelController.parameterExists(-1, "COMPASS_ORIENT2")
property bool compass3RotParamAvailable: factPanelController.parameterExists(-1, "COMPASS_ORIENT3")
property var rgCompassRotParamAvailable: [ compass1RotParamAvailable, compass2RotParamAvailable, compass3RotParamAvailable ]
property Fact compass1RotFact: compass2RotParamAvailable ? factPanelController.getParameterFact(-1, "COMPASS_ORIENT") : _noFact
property Fact compass2RotFact: compass2RotParamAvailable ? factPanelController.getParameterFact(-1, "COMPASS_ORIENT2") : _noFact
property Fact compass3RotFact: compass3RotParamAvailable ? factPanelController.getParameterFact(-1, "COMPASS_ORIENT3") : _noFact
property var rgCompassRotFact: [ compass1RotFact, compass2RotFact, compass3RotFact ]
property bool compass1UseParamAvailable: factPanelController.parameterExists(-1, "COMPASS_USE")
property bool compass2UseParamAvailable: factPanelController.parameterExists(-1, "COMPASS_USE2")
property bool compass3UseParamAvailable: factPanelController.parameterExists(-1, "COMPASS_USE3")
property var rgCompassUseParamAvailable: [ compass1UseParamAvailable, compass2UseParamAvailable, compass3UseParamAvailable ]
property Fact compass1UseFact: compass1UseParamAvailable ? factPanelController.getParameterFact(-1, "COMPASS_USE") : _noFact
property Fact compass2UseFact: compass2UseParamAvailable ? factPanelController.getParameterFact(-1, "COMPASS_USE2") : _noFact
property Fact compass3UseFact: compass3UseParamAvailable ? factPanelController.getParameterFact(-1, "COMPASS_USE3") : _noFact
property var rgCompassUseFact: [ compass1UseFact, compass2UseFact, compass3UseFact ]
property bool compass1Use: compass1UseParamAvailable ? compass1UseFact.value : true
property bool compass2Use: compass2UseParamAvailable ? compass2UseFact.value : true
property bool compass3Use: compass3UseParamAvailable ? compass3UseFact.value : true
property bool compass1ExternalParamAvailable: factPanelController.parameterExists(-1, "COMPASS_EXTERNAL")
property bool compass2ExternalParamAvailable: factPanelController.parameterExists(-1, "COMPASS_EXTERN2")
property bool compass3ExternalParamAvailable: factPanelController.parameterExists(-1, "COMPASS_EXTERN3")
property var rgCompassExternalParamAvailable: [ compass1ExternalParamAvailable, compass2ExternalParamAvailable, compass3ExternalParamAvailable ]
property Fact compass1ExternalFact: compass1ExternalParamAvailable ? factPanelController.getParameterFact(-1, "COMPASS_EXTERNAL") : _noFact
property Fact compass2ExternalFact: compass2ExternalParamAvailable ? factPanelController.getParameterFact(-1, "COMPASS_EXTERN2") : _noFact
property Fact compass3ExternalFact: compass3ExternalParamAvailable ? factPanelController.getParameterFact(-1, "COMPASS_EXTERN3") : _noFact
property bool compass1External: !!compass1ExternalFact.rawValue
property bool compass2External: !!compass2ExternalFact.rawValue
property bool compass3External: !!compass3ExternalFact.rawValue
property var rgCompassExternal: [ compass1External, compass2External, compass3External ]
property Fact compass1OfsXFact: factPanelController.getParameterFact(-1, "COMPASS_OFS_X")
property Fact compass1OfsYFact: factPanelController.getParameterFact(-1, "COMPASS_OFS_Y")
property Fact compass1OfsZFact: factPanelController.getParameterFact(-1, "COMPASS_OFS_Z")
property Fact compass2OfsXFact: factPanelController.getParameterFact(-1, "COMPASS_OFS2_X")
property Fact compass2OfsYFact: factPanelController.getParameterFact(-1, "COMPASS_OFS2_Y")
property Fact compass2OfsZFact: factPanelController.getParameterFact(-1, "COMPASS_OFS2_Z")
property Fact compass3OfsXFact: factPanelController.getParameterFact(-1, "COMPASS_OFS3_X")
property Fact compass3OfsYFact: factPanelController.getParameterFact(-1, "COMPASS_OFS3_Y")
property Fact compass3OfsZFact: factPanelController.getParameterFact(-1, "COMPASS_OFS3_Z")
property bool compass1Calibrated: compass1Available ? compass1OfsXFact.value != 0.0 && compass1OfsYFact.value != 0.0 &&compass1OfsZFact.value != 0.0 : false
property bool compass2Calibrated: compass2Available ? compass2OfsXFact.value != 0.0 && compass2OfsYFact.value != 0.0 &&compass2OfsZFact.value != 0.0 : false
property bool compass3Calibrated: compass3Available ? compass3OfsXFact.value != 0.0 && compass3OfsYFact.value != 0.0 &&compass3OfsZFact.value != 0.0 : false
property var rgCompassCalibrated: [ compass1Calibrated, compass2Calibrated, compass3Calibrated ]
}
Module QGroundControl.ArduPilot
APMSensorParams 1.0 APMSensorParams.qml
<RCC>
<qresource prefix="/qml">
<file alias="PX4AdvancedFlightModes.qml">../../AutoPilotPlugins/PX4/PX4AdvancedFlightModes.qml</file>
<file alias="PX4FlightModes.qml">../../AutoPilotPlugins/PX4/PX4FlightModes.qml</file>
<file alias="PX4RadioComponentSummary.qml">../../AutoPilotPlugins/PX4/PX4RadioComponentSummary.qml</file>
<file alias="PX4SimpleFlightModes.qml">../../AutoPilotPlugins/PX4/PX4SimpleFlightModes.qml</file>
<file alias="PX4TuningComponentCopter.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentCopter.qml</file>
<file alias="PX4TuningComponentPlane.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentPlane.qml</file>
<file alias="PX4TuningComponentVTOL.qml">../../AutoPilotPlugins/PX4/PX4TuningComponentVTOL.qml</file>
</qresource>
<qresource prefix="/json">
<file alias="PX4/MavCmdInfoCommon.json">MavCmdInfoCommon.json</file>
<file alias="PX4/MavCmdInfoFixedWing.json">MavCmdInfoFixedWing.json</file>
<file alias="PX4/MavCmdInfoMultiRotor.json">MavCmdInfoMultiRotor.json</file>
<file alias="PX4/MavCmdInfoRover.json">MavCmdInfoRover.json</file>
<file alias="PX4/MavCmdInfoSub.json">MavCmdInfoSub.json</file>
<file alias="PX4/MavCmdInfoVTOL.json">MavCmdInfoVTOL.json</file>
</qresource>
<qresource prefix="/AutoPilotPlugins/PX4">
<file alias="AirframeFactMetaData.xml">../../AutoPilotPlugins/PX4/AirframeFactMetaData.xml</file>
</qresource>
<qresource prefix="/FirmwarePlugin/PX4">
<file alias="PX4ParameterFactMetaData.xml">PX4ParameterFactMetaData.xml</file>
<file alias="PX4GeoFenceEditor.qml">PX4GeoFenceEditor.qml</file>
<file alias="PX4.OfflineEditing.params">V1.4.OfflineEditing.params</file>
</qresource>
</RCC>
......@@ -180,7 +180,6 @@ Vehicle::Vehicle(LinkInterface* link,
// Now connect the new UAS
connect(_mav, SIGNAL(attitudeChanged (UASInterface*,double,double,double,quint64)), this, SLOT(_updateAttitude(UASInterface*, double, double, double, quint64)));
connect(_mav, SIGNAL(attitudeChanged (UASInterface*,int,double,double,double,quint64)), this, SLOT(_updateAttitude(UASInterface*,int,double, double, double, quint64)));
connect(_mav, SIGNAL(statusChanged (UASInterface*,QString,QString)), this, SLOT(_updateState(UASInterface*, QString,QString)));
_loadSettings();
......@@ -1124,14 +1123,6 @@ void Vehicle::_handletextMessageReceived(UASMessage* message)
}
}
void Vehicle::_updateState(UASInterface*, QString name, QString)
{
if (_currentState != name) {
_currentState = name;
emit currentStateChanged();
}
}
void Vehicle::_handleTextMessage(int newCount)
{
// Reset?
......
......@@ -230,7 +230,6 @@ public:
Q_PROPERTY(QmlObjectListModel* trajectoryPoints READ trajectoryPoints CONSTANT)
Q_PROPERTY(float latitude READ latitude NOTIFY coordinateChanged)
Q_PROPERTY(float longitude READ longitude NOTIFY coordinateChanged)
Q_PROPERTY(QString currentState READ currentState NOTIFY currentStateChanged)
Q_PROPERTY(bool messageTypeNone READ messageTypeNone NOTIFY messageTypeChanged)
Q_PROPERTY(bool messageTypeNormal READ messageTypeNormal NOTIFY messageTypeChanged)
Q_PROPERTY(bool messageTypeWarning READ messageTypeWarning NOTIFY messageTypeChanged)
......@@ -507,7 +506,6 @@ public:
float latitude () { return _coordinate.latitude(); }
float longitude () { return _coordinate.longitude(); }
bool mavPresent () { return _mav != NULL; }
QString currentState () { return _currentState; }
int rcRSSI () { return _rcRSSI; }
bool px4Firmware () const { return _firmwareType == MAV_AUTOPILOT_PX4; }
bool apmFirmware () const { return _firmwareType == MAV_AUTOPILOT_ARDUPILOTMEGA; }
......@@ -627,7 +625,6 @@ signals:
void latestErrorChanged ();
void longitudeChanged ();
void currentConfigChanged ();
void currentStateChanged ();
void flowImageIndexChanged ();
void rcRSSIChanged (int rcRSSI);
......@@ -677,7 +674,6 @@ private slots:
void _updateAttitude (UASInterface* uas, double roll, double pitch, double yaw, quint64 timestamp);
/** @brief Attitude from one specific component / redundant autopilot */
void _updateAttitude (UASInterface* uas, int component, double roll, double pitch, double yaw, quint64 timestamp);
void _updateState (UASInterface* system, QString name, QString description);
/** @brief A new camera image has arrived */
void _imageReady (UASInterface* uas);
void _connectionLostTimeout(void);
......@@ -757,7 +753,6 @@ private:
int _currentNormalCount;
MessageType_t _currentMessageType;
QString _latestError;
QString _currentState;
int _updateCount;
QString _formatedMessage;
int _rcRSSI;
......
......@@ -188,14 +188,14 @@ void MockLink::_loadParams(void)
if (_firmwareType == MAV_AUTOPILOT_ARDUPILOTMEGA) {
if (_vehicleType == MAV_TYPE_FIXED_WING) {
paramFile.setFileName(":/unittest/APMArduPlaneMockLink.params");
paramFile.setFileName(":/MockLink/APMArduPlaneMockLink.params");
} else if (_vehicleType == MAV_TYPE_SUBMARINE ) {
paramFile.setFileName(":/unittest/APMArduSubMockLink.params");
paramFile.setFileName(":/MockLink/APMArduSubMockLink.params");
} else {
paramFile.setFileName(":/unittest/APMArduCopterMockLink.params");
paramFile.setFileName(":/MockLink/APMArduCopterMockLink.params");
}
} else {
paramFile.setFileName(":/unittest/PX4MockLink.params");
paramFile.setFileName(":/MockLink/PX4MockLink.params");
}
......
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