Skip to content

Pr resilience #13009

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

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions qgcimages.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@
<file alias="Gps.svg">src/UI/toolbar/Images/Gps.svg</file>
<file alias="Hamburger.svg">src/UI/toolbar/Images/Hamburger.svg</file>
<file alias="HamburgerThin.svg">src/UI/toolbar/Images/HamburgerThin.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
29 changes: 14 additions & 15 deletions src/Comms/MockLink/MockLink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1233,23 +1233,22 @@ void MockLink::_sendGpsRawInt()
_vehicleComponentId,
mavlinkChannel(),
&msg,
timeTick++, // time since boot
timeTick++, // time since boot
GPS_FIX_TYPE_3D_FIX,
static_cast<int32_t>(_vehicleLatitude * 1E7),
static_cast<int32_t>(_vehicleLongitude * 1E7),
static_cast<int32_t>(_vehicleAltitudeAMSL * 1000),
3 * 100, // hdop
3 * 100, // vdop
UINT16_MAX, // velocity not known
UINT16_MAX, // course over ground not known
8, // satellites visible
(int32_t)(_vehicleLatitude * 1E7),
(int32_t)(_vehicleLongitude * 1E7),
(int32_t)(_vehicleAltitudeAMSL * 1000),
UINT16_MAX, UINT16_MAX, // HDOP/VDOP not known
UINT16_MAX, // velocity not known
UINT16_MAX, // course over ground not known
8, // satellites visible
//-- Extension
0, // Altitude (above WGS84, EGM96 ellipsoid), in meters * 1000 (positive for up).
0, // Position uncertainty in meters * 1000 (positive for up).
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
0, // Altitude (above WGS84, EGM96 ellipsoid), in meters * 1000 (positive for up).
0, // Position uncertainty in meters * 1000 (positive for up).
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
);
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 @@ -208,6 +208,8 @@ const QVariantList &FirmwarePlugin::toolIndicators(const Vehicle*)
_toolIndicatorList = QVariantList({
QVariant::fromValue(QUrl::fromUserInput("qrc:/qml/QGroundControl/Controls/FlightModeIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/qml/QGroundControl/Toolbar/VehicleGPSIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/qml/QGroundControl/Toolbar/GPSInterferenceIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/qml/QGroundControl/Toolbar/GPSAuthenticationIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/qml/QGroundControl/Toolbar/TelemetryRSSIIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/qml/QGroundControl/Toolbar/RCRSSIIndicator.qml")),
QVariant::fromValue(QUrl::fromUserInput("qrc:/qml/QGroundControl/Controls/BatteryIndicator.qml")),
Expand Down
27 changes: 27 additions & 0 deletions src/QmlControls/GPSIndicatorPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,27 @@ ToolIndicatorPage {
property var rtkSettings: QGroundControl.settingsManager.rtkSettings
property bool useFixedPosition: rtkSettings.useFixedBasePosition.rawValue

function errorText() {
if(!_activeVehicle){
return qsTr("Disconnected")
} else if (_activeVehicle.gps.systemErrors.value === 1) {
return qsTr("Incoming correction")
} else if (_activeVehicle.gps.systemErrors.value === 2) {
return qsTr("Configuration")
} else if (_activeVehicle.gps.systemErrors.value === 4) {
return qsTr("Software")
} else if (_activeVehicle.gps.systemErrors.value === 8) {
return qsTr("Antenna")
} else if (_activeVehicle.gps.systemErrors.value === 16) {
return qsTr("Event congestion")
} else if (_activeVehicle.gps.systemErrors.value === 32) {
return qsTr("CPU overload")
} else if (_activeVehicle.gps.systemErrors.value === 64) {
return qsTr("Output congestion")
}
return "Multiple errors"
}

contentComponent: Component {
ColumnLayout {
spacing: ScreenTools.defaultFontPixelHeight / 2
Expand Down Expand Up @@ -61,6 +82,12 @@ ToolIndicatorPage {
label: qsTr("Course Over Ground")
labelText: activeVehicle ? activeVehicle.gps.courseOverGround.valueString : valueNA
}

LabelledLabel {
label: qsTr("GPS Error")
labelText: errorText()
visible: _activeVehicle && _activeVehicle.gps.systemErrors.value > 0
}
}

SettingsGroupLayout {
Expand Down
1 change: 1 addition & 0 deletions src/QmlControls/QGCPalette.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ void QGCPalette::_buildMap()
DECLARE_QGC_COLOR(colorRed, "#b52b2b", "#b52b2b", "#f32836", "#f32836")
DECLARE_QGC_COLOR(colorGrey, "#808080", "#808080", "#bfbfbf", "#bfbfbf")
DECLARE_QGC_COLOR(colorBlue, "#1a72ff", "#1a72ff", "#536dff", "#536dff")
DECLARE_QGC_COLOR(colorWhite, "#222222", "#222222", "#ffffff", "#ffffff")
DECLARE_QGC_COLOR(alertBackground, "#eecc44", "#eecc44", "#eecc44", "#eecc44")
DECLARE_QGC_COLOR(alertBorder, "#808080", "#808080", "#808080", "#808080")
DECLARE_QGC_COLOR(alertText, "#000000", "#000000", "#000000", "#000000")
Expand Down
1 change: 1 addition & 0 deletions src/QmlControls/QGCPalette.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class QGCPalette : public QObject
DEFINE_QGC_COLOR(colorRed, setColorRed)
DEFINE_QGC_COLOR(colorGrey, setColorGrey)
DEFINE_QGC_COLOR(colorBlue, setColorBlue)
DEFINE_QGC_COLOR(colorWhite, setColorWhite)
DEFINE_QGC_COLOR(alertBackground, setAlertBackground)
DEFINE_QGC_COLOR(alertBorder, setAlertBorder)
DEFINE_QGC_COLOR(alertText, setAlertText)
Expand Down
2 changes: 2 additions & 0 deletions src/UI/toolbar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ qt_add_qml_module(ToolbarModule
ArmedIndicator.qml
GCSControlIndicator.qml
GimbalIndicator.qml
GPSAuthenticationIndicator.qml
GPSInterferenceIndicator.qml
JoystickIndicator.qml
LinkIndicator.qml
ModeIndicator.qml
Expand Down
102 changes: 102 additions & 0 deletions src/UI/toolbar/GPSAuthenticationIndicator.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/****************************************************************************
*
* (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 Authentication Indicator
Item {
id: control
width: height
anchors.top: parent.top
anchors.bottom: parent.bottom

property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle

property bool showIndicator: _activeVehicle && _activeVehicle.gps.authenticationState.value > 0


function authenticationIconColor() {
if(!_activeVehicle){
return qgcPal.colorGrey // Not connected
} else if (_activeVehicle.gps.authenticationState.value === 0) {
return qgcPal.colorGrey // Unknow
} else if (_activeVehicle.gps.authenticationState.value === 1) {
return qgcPal.colorYellow // Initializing
} else if (_activeVehicle.gps.authenticationState.value === 2) {
return qgcPal.colorRed // Error
} else if (_activeVehicle.gps.authenticationState.value === 3) {
return qgcPal.colorGreen // OK
} else if (_activeVehicle.gps.authenticationState.value === 4) {
return qgcPal.colorGrey // Disable
}

return qgcPal.colorGrey
}

function getAuthenticationText(){
if(!_activeVehicle){
return qsTr("Disconnected")
} else if (_activeVehicle.gps.authenticationState.value === 0) {
return qsTr("Unkown")
} else if (_activeVehicle.gps.authenticationState.value === 1) {
return qsTr("Initializing...")
} else if (_activeVehicle.gps.authenticationState.value === 2) {
return qsTr("Failed")
} else if (_activeVehicle.gps.authenticationState.value === 3) {
return qsTr("OK")
} else if (_activeVehicle.gps.authenticationState.value === 4) {
return qsTr("Disabled")
}
return qsTr("n/a")
}

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(authenticationContentComponent, control)
}

Component{
id: authenticationContentComponent

ColumnLayout{
spacing: ScreenTools.defaultFontPixelHeight / 2

SettingsGroupLayout {
heading: qsTr("GPS Authentication")
contentSpacing: 0
showDividers: false

LabelledLabel {
label: qsTr("Status")
labelText: getAuthenticationText()
}

}
}
}
}
121 changes: 121 additions & 0 deletions src/UI/toolbar/GPSInterferenceIndicator.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
/****************************************************************************
*
* (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 var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle

property bool showIndicator: _activeVehicle && (_activeVehicle.gps.spoofingState.value > 0 || _activeVehicle.gps.jammingState.value > 0)


function spoofingText() {
if(!_activeVehicle){
return qsTr("Disconnected")
} else if (_activeVehicle.gps.spoofingState.value === 1) {
return qsTr("OK")
} else if (_activeVehicle.gps.spoofingState.value === 2) {
return qsTr("Mitigated")
} else if (_activeVehicle.gps.spoofingState.value === 3) {
return qsTr("Ongoing")
}
return qsTr("n/a")
}

function jammingText() {
if(!_activeVehicle){
return qsTr("Disconnected")
} else if (_activeVehicle.gps.jammingState.value === 1) {
return qsTr("OK")
} else if (_activeVehicle.gps.jammingState.value === 2) {
return qsTr("Mitigated")
} else if (_activeVehicle.gps.jammingState.value === 3) {
return qsTr("Ongoing")
}
return qsTr("n/a")
}

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: {
if(!_activeVehicle){
return qgcPal.colorGrey
}

let spoofing = _activeVehicle.gps.spoofingState.value
let jamming = _activeVehicle.gps.jammingState.value

if (spoofing === 3 || jamming === 3) {
return qgcPal.colorRed
} else if (spoofing === 2 || jamming === 2) {
return qgcPal.colorOrange
} else if (spoofing === 1 || jamming === 1) {
return qgcPal.colorWhite
}
return qgcPal.colorGrey
}
}

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

Component {
id: gpsSpoofingPopup

ToolIndicatorPage {
showExpand: expandedComponent ? true : false
contentComponent: spoofingContentComponent
}
}

Component{
id: spoofingContentComponent

ColumnLayout{
spacing: ScreenTools.defaultFontPixelHeight / 2

SettingsGroupLayout {
heading: qsTr("GPS Interference Status")
showDividers: true

LabelledLabel {
label: qsTr("GPS Jamming")
labelText: jammingText()
}

LabelledLabel {
label: qsTr("GPS Spoofing")
labelText: spoofingText()
}
}
}
}
}
4 changes: 4 additions & 0 deletions src/UI/toolbar/Images/GpsAuthentication.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading