QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
SensorsLargeVehicleForm.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Layouts
3
4import QGroundControl
5import QGroundControl.Controls
6
7import "PX4SensorsRows.js" as SensorsRows
8
9/// The compass calibration for a vehicle too big to rotate, which sets only the offsets from a known heading and the
10/// vehicle's GPS position. It sits under the six side calibration, collapsed until it is asked for.
11ColumnLayout {
12 id: control
13
14 /// SensorsRows.gpsReadiness()
15 required property var gps
16 property bool open: false
17 /// The firmware's answer to the last calibration, empty before one
18 property string message: ""
19 property bool success: false
20 /// A calibration was requested and the vehicle has not answered yet
21 property bool pending: false
22 signal calibrateRequested(real heading)
23 signal rebootRequested
24
25 readonly property real _heading: SensorsRows.parseHeading(headingField.text)
26 readonly property bool _headingValid: !isNaN(_heading) && _heading >= 0 && _heading < 360
27
28 spacing: ScreenTools.defaultFontPixelHeight * 0.5
29
30 QGCPalette { id: qgcPal }
31
32 RowLayout {
33 spacing: ScreenTools.defaultFontPixelWidth
34 visible: !control.open
35
36 QGCLabel {
37 text: qsTr("Too big to rotate?")
38 color: qgcPal.textSecondary
39 }
40
41 QGCLabel {
42 objectName: "sensorsCal_largeVehicleOpen"
43 text: qsTr("Large vehicle calibration") + " ▸"
44 color: qgcPal.accent
45
46 TapHandler {
47 onTapped: control.open = true
48 }
49 }
50 }
51
52 Rectangle {
53 Layout.fillWidth: true
54 implicitHeight: formLayout.implicitHeight + ScreenTools.defaultFontPixelHeight
55 radius: ScreenTools.defaultBorderRadius * 2
56 color: qgcPal.windowCard
57 border.color: qgcPal.borderSubtle
58 visible: control.open
59
60 ColumnLayout {
61 id: formLayout
62 anchors.fill: parent
63 anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5
64 spacing: ScreenTools.defaultFontPixelHeight * 0.5
65
66 RowLayout {
67 Layout.fillWidth: true
68 spacing: ScreenTools.defaultFontPixelWidth
69
70 QGCLabel {
71 text: qsTr("Large vehicle calibration")
72 font.bold: true
73 }
74
75 QGCChip {
76 text: qsTr("Offsets only")
77 }
78
79 Item { Layout.fillWidth: true }
80
81 QGCLabel {
82 text: qsTr("Hide") + " ▾"
83 color: qgcPal.accent
84
85 TapHandler {
86 onTapped: control.open = false
87 }
88 }
89 }
90
91 QGCLabel {
92 Layout.fillWidth: true
93 wrapMode: Text.WordWrap
94 color: qgcPal.textSecondary
95 text: qsTr("Point the vehicle at a known heading and hold it still. This uses the heading and the GPS position, and is less accurate than calibrating all six sides.")
96 }
97
98 RowLayout {
99 Layout.fillWidth: true
100 spacing: ScreenTools.defaultFontPixelWidth * 2
101
102 ColumnLayout {
103 spacing: ScreenTools.defaultFontPixelHeight * 0.15
104
105 QGCLabel {
106 text: qsTr("Heading (0 is true north)")
107 color: qgcPal.textSecondary
108 font.pointSize: ScreenTools.smallFontPointSize
109 }
110
111 QGCTextField {
112 id: headingField
113 objectName: "sensorsCal_headingField"
114 text: "0"
115 numericValuesOnly: true
116 showUnits: true
117 unitsLabel: qsTr("deg")
118 validationError: !control._headingValid
119 }
120 }
121
122 SensorsGpsStatus {
123 gps: control.gps
124 }
125
126 Item { Layout.fillWidth: true }
127
128 QGCButton {
129 objectName: "sensorsCal_largeVehicleCalibrate"
130 text: qsTr("Calibrate")
131 primary: true
132 enabled: control.gps.ready && control._headingValid && !control.pending
133 onClicked: control.calibrateRequested(control._heading)
134 }
135 }
136
137 QGCLabel {
138 objectName: "sensorsCal_largeVehicleHint"
139 Layout.fillWidth: true
140 wrapMode: Text.WordWrap
141 text: control.message !== "" ? control.message :
142 control.pending ? qsTr("Calibrating…") : (control.gps.ready ? "" : control.gps.message)
143 color: control.message !== "" ? (control.success ? qgcPal.successText : qgcPal.errorText) :
144 control.pending ? qgcPal.textSecondary : qgcPal.errorText
145 visible: text !== ""
146 }
147
148 QGCButton {
149 objectName: "sensorsCal_largeVehicleReboot"
150 text: qsTr("Reboot vehicle")
151 primary: true
152 visible: control.success && control.message !== ""
153 onClicked: control.rebootRequested()
154 }
155 }
156 }
157}