QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GPSIndicatorPage.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Layouts
3
4import QGroundControl
5import QGroundControl.Controls
6import QGroundControl.FactControls
7
8// This indicator page is used both when showing RTK status only with no vehicle connect and when showing GPS/RTK status with a vehicle connected
9
10ToolIndicatorPage {
11 showExpand: true
12
13 property var activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
14 property string na: qsTr("N/A", "No data to display")
15 property string valueNA: qsTr("–.––", "No data to display")
16 property var rtkSettings: QGroundControl.settingsManager.rtkSettings
17 property var useFixedPosition: rtkSettings.useFixedBasePosition.rawValue
18 property var manufacturer: rtkSettings.baseReceiverManufacturers.rawValue
19
20 readonly property var _trimble: 0b0001
21 readonly property var _septentrio: 0b0010
22 readonly property var _femtomes: 0b0100
23 readonly property var _ublox: 0b1000
24 readonly property var _all: 0b1111
25 property var settingsDisplayId: _all
26
27 function updateSettingsDisplayId() {
28 switch(manufacturer) {
29 case 0: // All
30 settingsDisplayId = _trimble | _septentrio | _femtomes | _ublox
31 break
32 case 1: // Trimble
33 settingsDisplayId = _trimble
34 break
35 case 2: // Septentrio
36 settingsDisplayId = _septentrio
37 break
38 case 3: // Femtomes
39 settingsDisplayId = _femtomes
40 break
41 case 4: // UBlox
42 settingsDisplayId = _ublox
43 break
44 default:
45 settingsDisplayId = _all
46 }
47 }
48
49 onManufacturerChanged: {
50 updateSettingsDisplayId()
51 }
52
53 Component.onCompleted: {
54 updateSettingsDisplayId()
55 }
56
57 function errorText() {
58 if (!_activeVehicle) {
59 return qsTr("Disconnected");
60 }
61
62 switch (_activeVehicle.gps.systemErrors.value) {
63 case 1:
64 return qsTr("Incoming correction");
65 case 2:
66 return qsTr("Configuration");
67 case 4:
68 return qsTr("Software");
69 case 8:
70 return qsTr("Antenna");
71 case 16:
72 return qsTr("Event congestion");
73 case 32:
74 return qsTr("CPU overload");
75 case 64:
76 return qsTr("Output congestion");
77 default:
78 return qsTr("Multiple errors");
79 }
80 }
81
82 contentComponent: Component {
83 ColumnLayout {
84 spacing: ScreenTools.defaultFontPixelHeight / 2
85
86 SettingsGroupLayout {
87 heading: qsTr("Vehicle GPS Status")
88 visible: activeVehicle
89
90 LabelledLabel {
91 label: qsTr("Satellites")
92 labelText: activeVehicle ? activeVehicle.gps.count.valueString : na
93 }
94
95 LabelledLabel {
96 label: qsTr("GPS Lock")
97 labelText: activeVehicle ? activeVehicle.gps.lock.enumStringValue : na
98 }
99
100 LabelledLabel {
101 label: qsTr("HDOP")
102 labelText: activeVehicle ? activeVehicle.gps.hdop.valueString : valueNA
103 }
104
105 LabelledLabel {
106 label: qsTr("VDOP")
107 labelText: activeVehicle ? activeVehicle.gps.vdop.valueString : valueNA
108 }
109
110 LabelledLabel {
111 label: qsTr("Course Over Ground")
112 labelText: activeVehicle ? activeVehicle.gps.courseOverGround.valueString : valueNA
113 }
114
115 LabelledLabel {
116 label: qsTr("GPS Error")
117 labelText: errorText()
118 visible: activeVehicle && activeVehicle.gps.systemErrors.value > 0
119 }
120 }
121
122 SettingsGroupLayout {
123 heading: qsTr("RTK GPS Status")
124 visible: QGroundControl.gpsRtk.connected.value
125
126 QGCLabel {
127 text: (QGroundControl.gpsRtk.active.value) ? qsTr("Survey-in Active") : qsTr("RTK Streaming")
128 }
129
130 LabelledLabel {
131 label: qsTr("Satellites")
132 labelText: QGroundControl.gpsRtk.numSatellites.value
133 }
134
135 LabelledLabel {
136 label: qsTr("Duration")
137 labelText: QGroundControl.gpsRtk.currentDuration.value + ' s'
138 }
139
140 LabelledLabel {
141 label: QGroundControl.gpsRtk.valid.value ? qsTr("Accuracy") : qsTr("Current Accuracy")
142 labelText: QGroundControl.gpsRtk.currentAccuracy.valueString + " " + QGroundControl.unitsConversion.appSettingsHorizontalDistanceUnitsString
143 visible: QGroundControl.gpsRtk.currentAccuracy.value > 0
144 }
145 }
146 }
147 }
148
149 expandedComponent: Component {
150 SettingsGroupLayout {
151 heading: qsTr("RTK GPS Settings")
152
153 property real sliderWidth: ScreenTools.defaultFontPixelWidth * 40
154
155 FactCheckBoxSlider {
156 Layout.fillWidth: true
157 text: qsTr("AutoConnect")
158 fact: QGroundControl.settingsManager.autoConnectSettings.autoConnectRTKGPS
159 visible: fact.visible
160 }
161
162 GridLayout {
163 columns: 2
164
165 QGCLabel {
166 text: qsTr("Settings displayed")
167 }
168 FactComboBox {
169 Layout.fillWidth: true
170 fact: QGroundControl.settingsManager.rtkSettings.baseReceiverManufacturers
171 visible: QGroundControl.settingsManager.rtkSettings.baseReceiverManufacturers.visible
172 }
173 }
174
175 RowLayout {
176 QGCRadioButton {
177 text: qsTr("Survey-In")
178 checked: useFixedPosition == BaseModeDefinition.BaseSurveyIn
179 onClicked: rtkSettings.useFixedBasePosition.rawValue = BaseModeDefinition.BaseSurveyIn
180 visible: settingsDisplayId & _all
181 }
182
183 QGCRadioButton {
184 text: qsTr("Specify position")
185 checked: useFixedPosition == BaseModeDefinition.BaseFixed
186 onClicked: rtkSettings.useFixedBasePosition.rawValue = BaseModeDefinition.BaseFixed
187 visible: settingsDisplayId & _all
188 }
189 }
190
191 FactSlider {
192 Layout.fillWidth: true
193 Layout.preferredWidth: sliderWidth
194 label: qsTr("Accuracy")
195 fact: QGroundControl.settingsManager.rtkSettings.surveyInAccuracyLimit
196 majorTickStepSize: 0.1
197 visible: (
198 useFixedPosition == BaseModeDefinition.BaseSurveyIn
199 && rtkSettings.surveyInAccuracyLimit.visible
200 && (settingsDisplayId & _ublox)
201 )
202 }
203
204 FactSlider {
205 Layout.fillWidth: true
206 Layout.preferredWidth: sliderWidth
207 label: qsTr("Min Duration")
208 fact: rtkSettings.surveyInMinObservationDuration
209 majorTickStepSize: 10
210 visible: (
211 useFixedPosition == BaseModeDefinition.BaseSurveyIn
212 && rtkSettings.surveyInMinObservationDuration.visible
213 && (settingsDisplayId & (_ublox | _femtomes | _trimble))
214 )
215 }
216
217 LabelledFactTextField {
218 label: rtkSettings.fixedBasePositionLatitude.shortDescription
219 fact: rtkSettings.fixedBasePositionLatitude
220 visible: (
221 useFixedPosition == BaseModeDefinition.BaseFixed
222 && (settingsDisplayId & _all)
223 )
224 }
225
226 LabelledFactTextField {
227 label: rtkSettings.fixedBasePositionLongitude.shortDescription
228 fact: rtkSettings.fixedBasePositionLongitude
229 visible: (
230 useFixedPosition == BaseModeDefinition.BaseFixed
231 && (settingsDisplayId & _all)
232 )
233 }
234
235 LabelledFactTextField {
236 label: rtkSettings.fixedBasePositionAltitude.shortDescription
237 fact: rtkSettings.fixedBasePositionAltitude
238 visible: (
239 useFixedPosition == BaseModeDefinition.BaseFixed
240 && (settingsDisplayId & _all)
241 )
242 }
243
244 LabelledFactTextField {
245 label: rtkSettings.fixedBasePositionAccuracy.shortDescription
246 fact: rtkSettings.fixedBasePositionAccuracy
247 visible: (
248 useFixedPosition == BaseModeDefinition.BaseFixed
249 && (settingsDisplayId & _ublox)
250 )
251 }
252
253 LabelledButton {
254 label: qsTr("Current Base Position")
255 buttonText: enabled ? qsTr("Save") : qsTr("Not Yet Valid")
256 visible: useFixedPosition == BaseModeDefinition.BaseFixed
257 enabled: QGroundControl.gpsRtk.valid.value
258
259 onClicked: {
260 rtkSettings.fixedBasePositionLatitude.rawValue = QGroundControl.gpsRtk.currentLatitude.rawValue
261 rtkSettings.fixedBasePositionLongitude.rawValue = QGroundControl.gpsRtk.currentLongitude.rawValue
262 rtkSettings.fixedBasePositionAltitude.rawValue = QGroundControl.gpsRtk.currentAltitude.rawValue
263 rtkSettings.fixedBasePositionAccuracy.rawValue = QGroundControl.gpsRtk.currentAccuracy.rawValue
264 }
265 }
266 }
267 }
268}