Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for GNSS receiver resilience information #11486

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion libs/mavlink/include/mavlink/v2.0
Submodule v2.0 updated 62 files
+2 −2 ASLUAV/ASLUAV.h
+1 −1 ASLUAV/mavlink.h
+1 −1 ASLUAV/version.h
+1 −1 AVSSUAS/AVSSUAS.h
+1 −1 AVSSUAS/mavlink.h
+1 −1 AVSSUAS/version.h
+4 −4 all/all.h
+1 −1 all/mavlink.h
+1 −1 all/version.h
+2 −2 ardupilotmega/ardupilotmega.h
+1 −1 ardupilotmega/mavlink.h
+1 −1 ardupilotmega/version.h
+4 −4 common/common.h
+1 −1 common/mavlink.h
+1 −1 common/version.h
+1 −1 csAirLink/csAirLink.h
+1 −1 csAirLink/mavlink.h
+1 −1 csAirLink/version.h
+1 −1 cubepilot/cubepilot.h
+1 −1 cubepilot/mavlink.h
+1 −1 cubepilot/version.h
+88 −5 development/development.h
+1 −1 development/mavlink.h
+6 −6 development/mavlink_msg_battery_status_v2.h
+456 −0 development/mavlink_msg_fuel_status.h
+568 −0 development/mavlink_msg_gnss_integrity.h
+138 −0 development/testsuite.h
+1 −1 development/version.h
+1 −1 icarous/icarous.h
+1 −1 icarous/mavlink.h
+1 −1 icarous/version.h
+2 −2 matrixpilot/matrixpilot.h
+1 −1 matrixpilot/mavlink.h
+1 −1 matrixpilot/version.h
+2 −2 message_definitions/all.xml
+8 −7 message_definitions/common.xml
+140 −2 message_definitions/development.xml
+1 −1 message_definitions/matrixpilot.xml
+1 −1 minimal/mavlink.h
+1 −1 minimal/minimal.h
+1 −1 minimal/version.h
+1 −1 paparazzi/mavlink.h
+1 −1 paparazzi/paparazzi.h
+1 −1 paparazzi/version.h
+1 −1 python_array_test/mavlink.h
+1 −1 python_array_test/python_array_test.h
+1 −1 python_array_test/version.h
+1 −1 standard/mavlink.h
+1 −1 standard/standard.h
+1 −1 standard/version.h
+1 −1 storm32/mavlink.h
+2 −2 storm32/storm32.h
+1 −1 storm32/version.h
+1 −1 test/mavlink.h
+1 −1 test/test.h
+1 −1 test/version.h
+1 −1 uAvionix/mavlink.h
+1 −1 uAvionix/uAvionix.h
+1 −1 uAvionix/version.h
+1 −1 ualberta/mavlink.h
+1 −1 ualberta/ualberta.h
+1 −1 ualberta/version.h
2 changes: 2 additions & 0 deletions qgcimages.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@
<file alias="GeoTagIcon">src/AnalyzeView/GeoTagIcon.svg</file>
<file alias="Gps.svg">src/UI/toolbar/Images/Gps.svg</file>
<file alias="Hamburger.svg">src/UI/toolbar/Images/Hamburger.svg</file>
<file alias="GpsAuthentication.svg">src/UI/toolbar/Images/GpsAuthentication.svg</file>
<file alias="GpsInterference.svg">src/UI/toolbar/Images/GpsInterference.svg</file>
<file alias="Help.svg">src/FlightMap/Images/Help.svg</file>
<file alias="HelpBlack.svg">src/FlightMap/Images/HelpBlack.svg</file>
<file alias="HITL.svg">src/AutoPilotPlugins/PX4/Images/HITL.svg</file>
Expand Down
2 changes: 2 additions & 0 deletions qgroundcontrol.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<file alias="TelemetryRSSIIndicator.qml">src/UI/toolbar/TelemetryRSSIIndicator.qml</file>
<file alias="VTOLModeIndicator.qml">src/UI/toolbar/VTOLModeIndicator.qml</file>
<file alias="APMSupportForwardingIndicator.qml">src/UI/toolbar/APMSupportForwardingIndicator.qml</file>
<file alias="GPSAuthenticationIndicator.qml">src/UI/toolbar/GPSAuthenticationIndicator.qml</file>
<file alias="GPSInterferenceIndicator.qml">src/UI/toolbar/GPSInterferenceIndicator.qml</file>
</qresource>
<qresource prefix="/checklists">
<file alias="DefaultChecklist.qml">src/FlightDisplay/DefaultChecklist.qml</file>
Expand Down
2 changes: 1 addition & 1 deletion src/Comms/MockLink/MockLink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@ void MockLink::_sendGpsRawInt(void)
0, // Altitude uncertainty in meters * 1000 (positive for up).
0, // Speed uncertainty in meters * 1000 (positive for up).
0, // Heading / track uncertainty in degrees * 1e5.
65535); // Yaw not provided
65535);
respondWithMavlinkMessage(msg);
}

Expand Down
2 changes: 2 additions & 0 deletions src/FirmwarePlugin/FirmwarePlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@ const QVariantList& FirmwarePlugin::toolIndicators(const Vehicle*)
QVariant::fromValue(QUrl::fromUserInput("qrc:/qml/QGroundControl/Controls/FlightModeIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/MessageIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/GPSIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/GPSInterferenceIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/GPSAuthenticationIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/TelemetryRSSIIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/RCRSSIIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/qml/QGroundControl/Controls/BatteryIndicator.qml")),
Expand Down
1 change: 1 addition & 0 deletions src/QmlControls/QGCPalette.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ void QGCPalette::_buildMap()
DECLARE_QGC_COLOR(mapIndicator, "#585858", "#be781c", "#585858", "#be781c")
DECLARE_QGC_COLOR(mapIndicatorChild, "#585858", "#766043", "#585858", "#766043")
DECLARE_QGC_COLOR(colorGreen, "#009431", "#009431", "#00e04b", "#00e04b")
DECLARE_QGC_COLOR(colorYellow, "#ffdb00", "#ffdb00", "#e1c100", "#e1c100")
DECLARE_QGC_COLOR(colorOrange, "#b95604", "#b95604", "#de8500", "#de8500")
DECLARE_QGC_COLOR(colorRed, "#ed3939", "#ed3939", "#f32836", "#f32836")
DECLARE_QGC_COLOR(colorGrey, "#808080", "#808080", "#bfbfbf", "#bfbfbf")
Expand Down
1 change: 1 addition & 0 deletions src/QmlControls/QGCPalette.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class QGCPalette : public QObject
DEFINE_QGC_COLOR(brandingPurple, setBrandingPurple)
DEFINE_QGC_COLOR(brandingBlue, setBrandingBlue)
DEFINE_QGC_COLOR(colorGreen, setColorGreen)
DEFINE_QGC_COLOR(colorYellow, setColorYellow)
DEFINE_QGC_COLOR(colorOrange, setColorOrange)
DEFINE_QGC_COLOR(colorRed, setColorRed)
DEFINE_QGC_COLOR(colorGrey, setColorGrey)
Expand Down
68 changes: 68 additions & 0 deletions src/UI/toolbar/GPSAuthenticationIndicator.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/****************************************************************************
*
* (c) 2009-2020 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
import QtQuick.Layouts

import QGroundControl
import QGroundControl.Controls
import QGroundControl.ScreenTools
import QGroundControl.Palette

//-------------------------------------------------------------------------
//-- GPS Authentication Indicator
Item {
id: control
width: height
anchors.top: parent.top
anchors.bottom: parent.bottom

property bool showIndicator: _activeVehicle.gps.authenticationState.value !== 0

property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle

function authenticationIconColor() {
if (_activeVehicle.gps.authenticationState.value === 0) {
return qgcPal.colorGrey
} else if (_activeVehicle.gps.authenticationState.value === 1) {
return qgcPal.colorYellow
} else if (_activeVehicle.gps.authenticationState.value === 2) {
return qgcPal.colorRed
} else if (_activeVehicle.gps.authenticationState.value === 3) {
return qgcPal.colorGreen
} else if (_activeVehicle.gps.authenticationState.value === 4) {
return qgcPal.colorGrey
}
}

QGCColoredImage {
id: gpsAuthenticationIcon
width: height
anchors.top: parent.top
anchors.bottom: parent.bottom
source: "/qmlimages/GpsAuthentication.svg"
fillMode: Image.PreserveAspectFit
sourceSize.height: height
opacity: 1
color: authenticationIconColor()
}

MouseArea {
anchors.fill: parent
onClicked: mainWindow.showIndicatorDrawer(gpsIndicatorPage, control)
}

Component {
id: gpsIndicatorPage

GPSIndicatorPage {

}
}
}
2 changes: 1 addition & 1 deletion src/UI/toolbar/GPSIndicator.qml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Item {
fillMode: Image.PreserveAspectFit
sourceSize.height: height
opacity: (_activeVehicle && _activeVehicle.gps.count.value >= 0) ? 1 : 0.5
color: qgcPal.buttonText
color: (_activeVehicle && _activeVehicle.gps.systemErrors.value !== 0) ? qgcPal.colorRed : qgcPal.buttonText
}

Column {
Expand Down
64 changes: 64 additions & 0 deletions src/UI/toolbar/GPSInterferenceIndicator.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/****************************************************************************
*
* (c) 2009-2024 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
import QtQuick.Layouts

import QGroundControl
import QGroundControl.Controls
import QGroundControl.ScreenTools
import QGroundControl.Palette

//-------------------------------------------------------------------------
//-- GPS Interference Indicator
Item {
id: control
width: height
anchors.top: parent.top
anchors.bottom: parent.bottom

property bool showIndicator: _activeVehicle.gps.authenticationState.value !== 0

property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle

function interferenceIconColor() {
if (_activeVehicle.gps.spoofingState.value === 1) {
return qgcPal.colorGreen
} else if (_activeVehicle.gps.spoofingState.value === 2) {
return qgcPal.colorRed
} else if (_activeVehicle.gps.spoofingState.value === 3) {
return qgcPal.colorBlue
}
}

QGCColoredImage {
id: gpsSpoofingIcon
width: height
anchors.top: parent.top
anchors.bottom: parent.bottom
source: "/qmlimages/GpsInterference.svg"
fillMode: Image.PreserveAspectFit
sourceSize.height: height
opacity: 1
color: interferenceIconColor()
}

MouseArea {
anchors.fill: parent
onClicked: mainWindow.showIndicatorDrawer(gpsIndicatorPage, control)
}

Component {
id: gpsIndicatorPage

GPSIndicatorPage {

}
}
}
4 changes: 4 additions & 0 deletions src/UI/toolbar/Images/GpsAuthentication.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/UI/toolbar/Images/GpsInterference.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions src/Vehicle/FactGroups/GPSFact.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,21 @@
"name": "count",
"shortDesc": "Sat Count",
"type": "uint32"
},
{
"name": "systemErrors",
"shortDesc": "General System Errors",
"type": "uint32"
},
{
"name": "spoofingState",
"shortDesc": "Signal Spoofing State",
"type": "uint8"
},
{
"name": "authenticationState",
"shortDesc": "Signal Authentication State",
"type": "uint8"
}
]
}
52 changes: 36 additions & 16 deletions src/Vehicle/FactGroups/VehicleGPSFactGroup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,21 @@
#include "VehicleGPSFactGroup.h"
#include "Vehicle.h"
#include "QGCGeo.h"
#include "development/mavlink_msg_gnss_integrity.h"

VehicleGPSFactGroup::VehicleGPSFactGroup(QObject* parent)
: FactGroup(1000, ":/json/Vehicle/GPSFact.json", parent)
, _latFact (0, _latFactName, FactMetaData::valueTypeDouble)
, _lonFact (0, _lonFactName, FactMetaData::valueTypeDouble)
, _mgrsFact (0, _mgrsFactName, FactMetaData::valueTypeString)
, _hdopFact (0, _hdopFactName, FactMetaData::valueTypeDouble)
, _vdopFact (0, _vdopFactName, FactMetaData::valueTypeDouble)
, _courseOverGroundFact (0, _courseOverGroundFactName, FactMetaData::valueTypeDouble)
, _countFact (0, _countFactName, FactMetaData::valueTypeInt32)
, _lockFact (0, _lockFactName, FactMetaData::valueTypeInt32)
, _latFact (0, _latFactName, FactMetaData::valueTypeDouble)
, _lonFact (0, _lonFactName, FactMetaData::valueTypeDouble)
, _mgrsFact (0, _mgrsFactName, FactMetaData::valueTypeString)
, _hdopFact (0, _hdopFactName, FactMetaData::valueTypeDouble)
, _vdopFact (0, _vdopFactName, FactMetaData::valueTypeDouble)
, _courseOverGroundFact (0, _courseOverGroundFactName, FactMetaData::valueTypeDouble)
, _countFact (0, _countFactName, FactMetaData::valueTypeInt32)
, _lockFact (0, _lockFactName, FactMetaData::valueTypeInt32)
, _systemErrorsFact (0, _systemErrorsFactName, FactMetaData::valueTypeUint32)
, _spoofingStateFact (0, _spoofingStateFactName, FactMetaData::valueTypeUint8)
, _authenticationStateFact (0, _authenticationStateFactName, FactMetaData::valueTypeUint8)
{
_addFact(&_latFact, _latFactName);
_addFact(&_lonFact, _lonFactName);
Expand All @@ -30,6 +34,9 @@ VehicleGPSFactGroup::VehicleGPSFactGroup(QObject* parent)
_addFact(&_courseOverGroundFact, _courseOverGroundFactName);
_addFact(&_lockFact, _lockFactName);
_addFact(&_countFact, _countFactName);
_addFact(&_systemErrorsFact, _systemErrorsFactName);
_addFact(&_spoofingStateFact, _spoofingStateFactName);
_addFact(&_authenticationStateFact, _authenticationStateFactName);

_latFact.setRawValue(std::numeric_limits<float>::quiet_NaN());
_lonFact.setRawValue(std::numeric_limits<float>::quiet_NaN());
Expand All @@ -51,6 +58,9 @@ void VehicleGPSFactGroup::handleMessage(Vehicle* /* vehicle */, mavlink_message_
case MAVLINK_MSG_ID_HIGH_LATENCY2:
_handleHighLatency2(message);
break;
case MAVLINK_MSG_ID_GNSS_INTEGRITY:
_handleGnssIntegrity(message);
break;
default:
break;
}
Expand All @@ -61,14 +71,14 @@ void VehicleGPSFactGroup::_handleGpsRawInt(mavlink_message_t& message)
mavlink_gps_raw_int_t gpsRawInt;
mavlink_msg_gps_raw_int_decode(&message, &gpsRawInt);

lat()->setRawValue (gpsRawInt.lat * 1e-7);
lon()->setRawValue (gpsRawInt.lon * 1e-7);
mgrs()->setRawValue (QGCGeo::convertGeoToMGRS(QGeoCoordinate(gpsRawInt.lat * 1e-7, gpsRawInt.lon * 1e-7)));
count()->setRawValue (gpsRawInt.satellites_visible == 255 ? 0 : gpsRawInt.satellites_visible);
hdop()->setRawValue (gpsRawInt.eph == UINT16_MAX ? qQNaN() : gpsRawInt.eph / 100.0);
vdop()->setRawValue (gpsRawInt.epv == UINT16_MAX ? qQNaN() : gpsRawInt.epv / 100.0);
courseOverGround()->setRawValue (gpsRawInt.cog == UINT16_MAX ? qQNaN() : gpsRawInt.cog / 100.0);
lock()->setRawValue (gpsRawInt.fix_type);
lat()->setRawValue (gpsRawInt.lat * 1e-7);
lon()->setRawValue (gpsRawInt.lon * 1e-7);
mgrs()->setRawValue (QGCGeo::convertGeoToMGRS(QGeoCoordinate(gpsRawInt.lat * 1e-7, gpsRawInt.lon * 1e-7)));
count()->setRawValue (gpsRawInt.satellites_visible == 255 ? 0 : gpsRawInt.satellites_visible);
hdop()->setRawValue (gpsRawInt.eph == UINT16_MAX ? qQNaN() : gpsRawInt.eph / 100.0);
vdop()->setRawValue (gpsRawInt.epv == UINT16_MAX ? qQNaN() : gpsRawInt.epv / 100.0);
courseOverGround()->setRawValue (gpsRawInt.cog == UINT16_MAX ? qQNaN() : gpsRawInt.cog / 100.0);
lock()->setRawValue (gpsRawInt.fix_type);
}

void VehicleGPSFactGroup::_handleHighLatency(mavlink_message_t& message)
Expand Down Expand Up @@ -104,3 +114,13 @@ void VehicleGPSFactGroup::_handleHighLatency2(mavlink_message_t& message)
hdop()->setRawValue (highLatency2.eph == UINT8_MAX ? qQNaN() : highLatency2.eph / 10.0);
vdop()->setRawValue (highLatency2.epv == UINT8_MAX ? qQNaN() : highLatency2.epv / 10.0);
}

void VehicleGPSFactGroup::_handleGnssIntegrity(mavlink_message_t& message)
{
mavlink_gnss_integrity_t gnssIntegrity;
mavlink_msg_gnss_integrity_decode(&message, &gnssIntegrity);

systemErrors()->setRawValue (gnssIntegrity.system_errors);
spoofingState()->setRawValue (gnssIntegrity.spoofing_state);
authenticationState()->setRawValue(gnssIntegrity.authentication_state);
}
51 changes: 32 additions & 19 deletions src/Vehicle/FactGroups/VehicleGPSFactGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,38 @@ class VehicleGPSFactGroup : public FactGroup
public:
VehicleGPSFactGroup(QObject* parent = nullptr);

Q_PROPERTY(Fact* lat READ lat CONSTANT)
Q_PROPERTY(Fact* lon READ lon CONSTANT)
Q_PROPERTY(Fact* mgrs READ mgrs CONSTANT)
Q_PROPERTY(Fact* hdop READ hdop CONSTANT)
Q_PROPERTY(Fact* vdop READ vdop CONSTANT)
Q_PROPERTY(Fact* courseOverGround READ courseOverGround CONSTANT)
Q_PROPERTY(Fact* count READ count CONSTANT)
Q_PROPERTY(Fact* lock READ lock CONSTANT)
Q_PROPERTY(Fact* lat READ lat CONSTANT)
Q_PROPERTY(Fact* lon READ lon CONSTANT)
Q_PROPERTY(Fact* mgrs READ mgrs CONSTANT)
Q_PROPERTY(Fact* hdop READ hdop CONSTANT)
Q_PROPERTY(Fact* vdop READ vdop CONSTANT)
Q_PROPERTY(Fact* courseOverGround READ courseOverGround CONSTANT)
Q_PROPERTY(Fact* count READ count CONSTANT)
Q_PROPERTY(Fact* lock READ lock CONSTANT)
Q_PROPERTY(Fact* systemErrors READ systemErrors CONSTANT)
Q_PROPERTY(Fact* spoofingState READ spoofingState CONSTANT)
Q_PROPERTY(Fact* authenticationState READ authenticationState CONSTANT)

Fact* lat () { return &_latFact; }
Fact* lon () { return &_lonFact; }
Fact* mgrs () { return &_mgrsFact; }
Fact* hdop () { return &_hdopFact; }
Fact* vdop () { return &_vdopFact; }
Fact* courseOverGround () { return &_courseOverGroundFact; }
Fact* count () { return &_countFact; }
Fact* lock () { return &_lockFact; }
Fact* lat () { return &_latFact; }
Fact* lon () { return &_lonFact; }
Fact* mgrs () { return &_mgrsFact; }
Fact* hdop () { return &_hdopFact; }
Fact* vdop () { return &_vdopFact; }
Fact* courseOverGround () { return &_courseOverGroundFact; }
Fact* count () { return &_countFact; }
Fact* lock () { return &_lockFact; }
Fact* systemErrors () { return &_systemErrorsFact; }
Fact* spoofingState () { return &_spoofingStateFact; }
Fact* authenticationState () { return &_authenticationStateFact; }

// Overrides from FactGroup
virtual void handleMessage(Vehicle* vehicle, mavlink_message_t& message) override;

protected:
void _handleGpsRawInt (mavlink_message_t& message);
void _handleHighLatency (mavlink_message_t& message);
void _handleHighLatency2(mavlink_message_t& message);
void _handleGpsRawInt (mavlink_message_t& message);
void _handleHighLatency (mavlink_message_t& message);
void _handleHighLatency2 (mavlink_message_t& message);
void _handleGnssIntegrity(mavlink_message_t& message);

const QString _latFactName = QStringLiteral("lat");
const QString _lonFactName = QStringLiteral("lon");
Expand All @@ -53,6 +60,9 @@ class VehicleGPSFactGroup : public FactGroup
const QString _courseOverGroundFactName = QStringLiteral("courseOverGround");
const QString _countFactName = QStringLiteral("count");
const QString _lockFactName = QStringLiteral("lock");
const QString _systemErrorsFactName = QStringLiteral("systemErrors");
const QString _spoofingStateFactName = QStringLiteral("spoofingState");
const QString _authenticationStateFactName = QStringLiteral("authenticationState");

Fact _latFact;
Fact _lonFact;
Expand All @@ -62,4 +72,7 @@ class VehicleGPSFactGroup : public FactGroup
Fact _courseOverGroundFact;
Fact _countFact;
Fact _lockFact;
Fact _systemErrorsFact;
Fact _spoofingStateFact;
Fact _authenticationStateFact;
};