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