QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
FWLandingPatternEditor.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Dialogs
4import QtQuick.Layouts
5
6import QGroundControl
7import QGroundControl.Controls
8import QGroundControl.FactControls
9
10// Editor for Fixed Wing Landing Pattern complex mission item
11Rectangle {
12 id: _root
13 height: visible ? ((editorColumn.visible ? editorColumn.height : editorColumnNeedLandingPoint.height) + (_margin * 2)) : 0
14 width: availableWidth
15 color: qgcPal.windowShadeDark
16 radius: _radius
17
18 // The following properties must be available up the hierarchy chain
19 //property real availableWidth ///< Width for control
20 //property var missionItem ///< Mission Item for editor
21
22 property var _masterControler: masterController
23 property var _missionController: _masterControler.missionController
24 property var _missionVehicle: _masterControler.controllerVehicle
25 property real _margin: ScreenTools.defaultFontPixelWidth / 2
26 property real _spacer: ScreenTools.defaultFontPixelWidth / 2
27 property string _setToVehicleHeadingStr: qsTr("Set to vehicle heading")
28 property string _setToVehicleLocationStr: qsTr("Set to vehicle location")
29 property int _altitudeMode: missionItem.altitudesAreRelative ? QGroundControl.AltitudeModeRelative : QGroundControl.AltitudeModeAbsolute
30
31
32 Column {
33 id: editorColumn
34 anchors.margins: _margin
35 anchors.left: parent.left
36 anchors.right: parent.right
37 spacing: _margin
38 visible: !editorColumnNeedLandingPoint.visible
39
40 SectionHeader {
41 id: finalApproachSection
42 anchors.left: parent.left
43 anchors.right: parent.right
44 text: qsTr("Final approach")
45 }
46
47 Column {
48 anchors.left: parent.left
49 anchors.right: parent.right
50 spacing: _margin
51 visible: finalApproachSection.checked
52
53 Item { width: 1; height: _spacer }
54
55 FactCheckBox {
56 text: qsTr("Use loiter to altitude")
57 fact: missionItem.useLoiterToAlt
58 }
59
60 GridLayout {
61 anchors.left: parent.left
62 anchors.right: parent.right
63 columns: 2
64
65 QGCLabel { text: qsTr("Altitude") }
66
67 AltitudeFactTextField {
68 Layout.fillWidth: true
69 fact: missionItem.finalApproachAltitude
70 altitudeMode: _altitudeMode
71 }
72
73 FactCheckBox {
74 id: flightSpeedCheckbox
75 text: qsTr("Flight Speed")
76 fact: missionItem.useDoChangeSpeed
77 }
78
79 FactTextField {
80 Layout.fillWidth: true
81 fact: missionItem.finalApproachSpeed
82 enabled: flightSpeedCheckbox.checked
83 }
84
85 QGCLabel {
86 text: qsTr("Radius")
87 visible: missionItem.useLoiterToAlt.rawValue
88 }
89
90 FactTextField {
91 Layout.fillWidth: true
92 fact: missionItem.loiterRadius
93 visible: missionItem.useLoiterToAlt.rawValue
94 }
95 }
96
97 Item { width: 1; height: _spacer }
98
99 FactCheckBox {
100 text: qsTr("Loiter clockwise")
101 fact: missionItem.loiterClockwise
102 visible: missionItem.useLoiterToAlt.rawValue
103 }
104
105 QGCButton {
106 text: _setToVehicleHeadingStr
107 visible: globals.activeVehicle
108 onClicked: missionItem.landingHeading.rawValue = globals.activeVehicle.heading.rawValue
109 }
110 }
111
112 SectionHeader {
113 id: landingPointSection
114 anchors.left: parent.left
115 anchors.right: parent.right
116 text: qsTr("Landing point")
117 }
118
119 Column {
120 anchors.left: parent.left
121 anchors.right: parent.right
122 spacing: _margin
123 visible: landingPointSection.checked
124
125 Item { width: 1; height: _spacer }
126
127 GridLayout {
128 anchors.left: parent.left
129 anchors.right: parent.right
130 columns: 2
131
132 QGCLabel { text: qsTr("Heading") }
133
134 FactTextField {
135 Layout.fillWidth: true
136 fact: missionItem.landingHeading
137 }
138
139 QGCLabel { text: qsTr("Altitude") }
140
141 AltitudeFactTextField {
142 Layout.fillWidth: true
143 fact: missionItem.landingAltitude
144 altitudeMode: _altitudeMode
145 }
146
147 QGCRadioButton {
148 id: specifyLandingDistance
149 text: qsTr("Distance")
150 checked: missionItem.valueSetIsDistance.rawValue
151 onClicked: missionItem.valueSetIsDistance.rawValue = checked
152 Layout.fillWidth: true
153 }
154
155 FactTextField {
156 fact: missionItem.landingDistance
157 enabled: specifyLandingDistance.checked
158 Layout.fillWidth: true
159 }
160
161 QGCRadioButton {
162 id: specifyGlideSlope
163 text: qsTr("Glide Slope")
164 checked: !missionItem.valueSetIsDistance.rawValue
165 onClicked: missionItem.valueSetIsDistance.rawValue = !checked
166 Layout.fillWidth: true
167 }
168
169 FactTextField {
170 fact: missionItem.glideSlope
171 enabled: specifyGlideSlope.checked
172 Layout.fillWidth: true
173 }
174
175 QGCButton {
176 text: _setToVehicleLocationStr
177 visible: globals.activeVehicle
178 Layout.columnSpan: 2
179 onClicked: missionItem.landingCoordinate = globals.activeVehicle.coordinate
180 }
181 }
182 }
183
184 Item { width: 1; height: _spacer }
185
186 QGCCheckBox {
187 anchors.right: parent.right
188 text: qsTr("Altitudes relative to launch")
189 checked: missionItem.altitudesAreRelative
190 visible: QGroundControl.corePlugin.options.showMissionAbsoluteAltitude || !missionItem.altitudesAreRelative
191 onClicked: missionItem.altitudesAreRelative = checked
192 }
193
194 SectionHeader {
195 id: cameraSection
196 anchors.left: parent.left
197 anchors.right: parent.right
198 text: qsTr("Camera")
199 }
200
201 Column {
202 anchors.left: parent.left
203 anchors.right: parent.right
204 spacing: _margin
205 visible: cameraSection.checked
206
207 Item { width: 1; height: _spacer }
208
209 FactCheckBox {
210 text: _stopTakingPhotos.shortDescription
211 fact: _stopTakingPhotos
212
213 property Fact _stopTakingPhotos: missionItem.stopTakingPhotos
214 }
215
216 FactCheckBox {
217 text: _stopTakingVideo.shortDescription
218 fact: _stopTakingVideo
219
220 property Fact _stopTakingVideo: missionItem.stopTakingVideo
221 }
222 }
223
224 Column {
225 anchors.left: parent.left
226 anchors.right: parent.right
227 spacing: 0
228
229 QGCLabel {
230 anchors.left: parent.left
231 anchors.right: parent.right
232 wrapMode: Text.WordWrap
233 color: qgcPal.warningText
234 font.pointSize: ScreenTools.smallFontPointSize
235 text: qsTr("* Approximate glide slope altitudes.")
236 }
237
238 QGCLabel {
239 anchors.left: parent.left
240 anchors.right: parent.right
241 wrapMode: Text.WordWrap
242 color: qgcPal.warningText
243 font.pointSize: ScreenTools.smallFontPointSize
244 text: qsTr("* Actual flight path will vary.")
245 }
246
247 QGCLabel {
248 anchors.left: parent.left
249 anchors.right: parent.right
250 wrapMode: Text.WordWrap
251 color: qgcPal.warningText
252 font.pointSize: ScreenTools.smallFontPointSize
253 text: qsTr("* Avoid tailwind on landing.")
254 }
255 }
256 }
257
258 Column {
259 id: editorColumnNeedLandingPoint
260 anchors.margins: _margin
261 anchors.top: parent.top
262 anchors.left: parent.left
263 anchors.right: parent.right
264 visible: !missionItem.landingCoordSet || missionItem.wizardMode
265 spacing: ScreenTools.defaultFontPixelHeight
266
267 Column {
268 id: landingCoordColumn
269 anchors.left: parent.left
270 anchors.right: parent.right
271 spacing: ScreenTools.defaultFontPixelHeight
272 visible: !missionItem.landingCoordSet
273
274 QGCLabel {
275 anchors.left: parent.left
276 anchors.right: parent.right
277 wrapMode: Text.WordWrap
278 horizontalAlignment: Text.AlignHCenter
279 text: qsTr("Click in map to set landing point.")
280 }
281
282 QGCLabel {
283 anchors.left: parent.left
284 anchors.right: parent.right
285 horizontalAlignment: Text.AlignHCenter
286 text: qsTr("- or -")
287 visible: globals.activeVehicle
288 }
289
290 QGCButton {
291 anchors.horizontalCenter: parent.horizontalCenter
292 text: _setToVehicleLocationStr
293 visible: globals.activeVehicle
294
295 onClicked: {
296 missionItem.landingCoordinate = globals.activeVehicle.coordinate
297 missionItem.landingHeading.rawValue = globals.activeVehicle.heading.rawValue
298 missionItem.setLandingHeadingToTakeoffHeading()
299 }
300 }
301 }
302
303 ColumnLayout {
304 anchors.left: parent.left
305 anchors.right: parent.right
306 spacing: ScreenTools.defaultFontPixelHeight / 2
307 visible: !landingCoordColumn.visible
308
309 onVisibleChanged: {
310 if (visible) {
311 console.log(missionItem.landingDistance.rawValue)
312 }
313 }
314
315 QGCLabel {
316 Layout.fillWidth: true
317 wrapMode: Text.WordWrap
318 text: qsTr("Drag the loiter point to adjust landing direction for wind and obstacles.")
319 }
320
321 FactCheckBox {
322 text: qsTr("Loiter clockwise")
323 fact: missionItem.loiterClockwise
324 visible: missionItem.useLoiterToAlt.rawValue
325 }
326
327 QGCButton {
328 text: qsTr("Done")
329 Layout.fillWidth: true
330 onClicked: {
331 missionItem.wizardMode = false
332 missionItem.landingDragAngleOnly = false
333 }
334 }
335 }
336 }
337}