-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
GPS: Add support for GNSS receiver resilience information #11781
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/**************************************************************************** | ||
* | ||
* (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 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 | ||
} | ||
} | ||
|
||
function getAuthenticationText(){ | ||
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 | ||
|
||
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle | ||
|
||
SettingsGroupLayout { | ||
heading: qsTr("GPS Authentication") | ||
contentSpacing: 0 | ||
showDividers: false | ||
|
||
LabelledLabel { | ||
label: qsTr("Status") | ||
labelText: getAuthenticationText() | ||
} | ||
|
||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,25 @@ ToolIndicatorPage { | |
property var rtkSettings: QGroundControl.settingsManager.rtkSettings | ||
property bool useFixedPosition: rtkSettings.useFixedBasePosition.rawValue | ||
|
||
function errorText() { | ||
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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be worthwhile to concatenate all errors or does that not fit? I'm just thinking "Multiple errors" might not be very helpful, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was worried that too many errors would make it too crowdy even if it's unlikely to happen, I could try concatenatinge all them as it would make it clearer though |
||
} | ||
|
||
contentComponent: Component { | ||
ColumnLayout { | ||
spacing: ScreenTools.defaultFontPixelHeight / 2 | ||
|
@@ -58,6 +77,12 @@ ToolIndicatorPage { | |
label: qsTr("Course Over Ground") | ||
labelText: activeVehicle ? activeVehicle.gps.courseOverGround.valueString : valueNA | ||
} | ||
|
||
LabelledLabel { | ||
label: qsTr("GPS Error") | ||
labelText: errorText() | ||
visible: _activeVehicle.gps.systemErrors.value > 0 | ||
} | ||
} | ||
|
||
SettingsGroupLayout { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
/**************************************************************************** | ||
* | ||
* (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.spoofingState.value > 0 || _activeVehicle.gps.jammingState.value > 0 | ||
|
||
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle | ||
|
||
function interferenceIconColor() { | ||
if (_activeVehicle.gps.spoofingState.value === 1 && _activeVehicle.gps.jammingState.value === 1) { | ||
return qgcPal.colorWhite | ||
} else if ((_activeVehicle.gps.spoofingState.value === 2 && _activeVehicle.gps.jammingState.value<3) || (_activeVehicle.gps.jammingState.value === 2 && _activeVehicle.gps.spoofingState.value<3)) { | ||
return qgcPal.colorOrange | ||
} else if (_activeVehicle.gps.spoofingState.value === 3 || _activeVehicle.gps.jammingState.value === 3) { | ||
return qgcPal.colorRed | ||
} | ||
return qgcPal.colorGrey | ||
} | ||
|
||
function spoofingText() { | ||
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.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") | ||
} | ||
|
||
function interferenceText() { | ||
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 Integer.class.isIntsance(_activeVehicle.gps.spoofingState.value) ? qsTr("N/A") : 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: interferenceIconColor() | ||
} | ||
|
||
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 | ||
|
||
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle | ||
|
||
SettingsGroupLayout { | ||
heading: qsTr("GPS Interference Status") | ||
showDividers: true | ||
|
||
LabelledLabel { | ||
label: qsTr("GPS Jamming") | ||
labelText: jammingText() | ||
} | ||
|
||
LabelledLabel { | ||
label: qsTr("GPS Spoofing") | ||
labelText: spoofingText() | ||
} | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?