QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
VTOLLandingPatternEditor.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 QGCLabel {
73 text: qsTr("Radius")
74 visible: missionItem.useLoiterToAlt.rawValue
75 }
76
77 FactTextField {
78 Layout.fillWidth: true
79 fact: missionItem.loiterRadius
80 visible: missionItem.useLoiterToAlt.rawValue
81 }
82 }
83
84 Item { width: 1; height: _spacer }
85
86 FactCheckBox {
87 text: qsTr("Loiter clockwise")
88 fact: missionItem.loiterClockwise
89 visible: missionItem.useLoiterToAlt.rawValue
90 }
91
92 QGCButton {
93 text: _setToVehicleHeadingStr
94 visible: globals.activeVehicle
95 onClicked: missionItem.landingHeading.rawValue = globals.activeVehicle.heading.rawValue
96 }
97 }
98
99 SectionHeader {
100 id: landingPointSection
101 anchors.left: parent.left
102 anchors.right: parent.right
103 text: qsTr("Landing point")
104 }
105
106 Column {
107 anchors.left: parent.left
108 anchors.right: parent.right
109 spacing: _margin
110 visible: landingPointSection.checked
111
112 Item { width: 1; height: _spacer }
113
114 GridLayout {
115 anchors.left: parent.left
116 anchors.right: parent.right
117 columns: 2
118
119 QGCLabel { text: qsTr("Heading") }
120
121 FactTextField {
122 Layout.fillWidth: true
123 fact: missionItem.landingHeading
124 }
125
126 QGCLabel { text: qsTr("Altitude") }
127
128 AltitudeFactTextField {
129 Layout.fillWidth: true
130 fact: missionItem.landingAltitude
131 altitudeFrame: _altitudeFrame
132 }
133
134 QGCLabel { text: qsTr("Landing Dist") }
135
136 FactTextField {
137 fact: missionItem.landingDistance
138 Layout.fillWidth: true
139 }
140
141 QGCButton {
142 text: _setToVehicleLocationStr
143 visible: globals.activeVehicle
144 Layout.columnSpan: 2
145 onClicked: missionItem.landingCoordinate = globals.activeVehicle.coordinate
146 }
147 }
148 }
149
150 Item { width: 1; height: _spacer }
151
152 QGCCheckBox {
153 anchors.right: parent.right
154 text: qsTr("Altitudes relative to launch")
155 checked: missionItem.altitudesAreRelative
156 visible: QGroundControl.corePlugin.options.showMissionAbsoluteAltitude || !missionItem.altitudesAreRelative
157 onClicked: missionItem.altitudesAreRelative = checked
158 }
159
160 SectionHeader {
161 id: cameraSection
162 anchors.left: parent.left
163 anchors.right: parent.right
164 text: qsTr("Camera")
165 }
166
167 Column {
168 anchors.left: parent.left
169 anchors.right: parent.right
170 spacing: _margin
171 visible: cameraSection.checked
172
173 Item { width: 1; height: _spacer }
174
175 FactCheckBox {
176 text: _stopTakingPhotos.shortDescription
177 fact: _stopTakingPhotos
178
179 property Fact _stopTakingPhotos: missionItem.stopTakingPhotos
180 }
181
182 FactCheckBox {
183 text: _stopTakingVideo.shortDescription
184 fact: _stopTakingVideo
185
186 property Fact _stopTakingVideo: missionItem.stopTakingVideo
187 }
188 }
189
190 Column {
191 anchors.left: parent.left
192 anchors.right: parent.right
193 spacing: 0
194
195 QGCLabel {
196 anchors.left: parent.left
197 anchors.right: parent.right
198 wrapMode: Text.WordWrap
199 color: qgcPal.warningText
200 font.pointSize: ScreenTools.smallFontPointSize
201 text: qsTr("* Actual flight path will vary.")
202 }
203
204 QGCLabel {
205 anchors.left: parent.left
206 anchors.right: parent.right
207 wrapMode: Text.WordWrap
208 color: qgcPal.warningText
209 font.pointSize: ScreenTools.smallFontPointSize
210 text: qsTr("* Avoid tailwind on approach to land.")
211 }
212
213 QGCLabel {
214 anchors.left: parent.left
215 anchors.right: parent.right
216 wrapMode: Text.WordWrap
217 color: qgcPal.warningText
218 font.pointSize: ScreenTools.smallFontPointSize
219 text: qsTr("* Ensure landing distance is enough to complete transition.")
220 }
221 }
222 }
223
224 Column {
225 id: editorColumnNeedLandingPoint
226 anchors.margins: _margin
227 anchors.top: parent.top
228 anchors.left: parent.left
229 anchors.right: parent.right
230 visible: !missionItem.landingCoordSet || missionItem.wizardMode
231 spacing: ScreenTools.defaultFontPixelHeight
232
233 Column {
234 id: landingCoordColumn
235 anchors.left: parent.left
236 anchors.right: parent.right
237 spacing: ScreenTools.defaultFontPixelHeight
238 visible: !missionItem.landingCoordSet
239
240 QGCLabel {
241 anchors.left: parent.left
242 anchors.right: parent.right
243 wrapMode: Text.WordWrap
244 horizontalAlignment: Text.AlignHCenter
245 text: qsTr("Click in map to set landing point.")
246 }
247
248 QGCLabel {
249 anchors.left: parent.left
250 anchors.right: parent.right
251 horizontalAlignment: Text.AlignHCenter
252 text: qsTr("- or -")
253 visible: globals.activeVehicle
254 }
255
256 QGCButton {
257 anchors.horizontalCenter: parent.horizontalCenter
258 text: _setToVehicleLocationStr
259 visible: globals.activeVehicle
260
261 onClicked: {
262 missionItem.landingCoordinate = globals.activeVehicle.coordinate
263 missionItem.landingHeading.rawValue = globals.activeVehicle.heading.rawValue
264 missionItem.setLandingHeadingToTakeoffHeading()
265 }
266 }
267 }
268
269 ColumnLayout {
270 anchors.left: parent.left
271 anchors.right: parent.right
272 spacing: ScreenTools.defaultFontPixelHeight
273 visible: !landingCoordColumn.visible
274
275 onVisibleChanged: {
276 if (visible) {
277 console.log(missionItem.landingDistance.rawValue)
278 }
279 }
280
281 QGCLabel {
282 Layout.fillWidth: true
283 wrapMode: Text.WordWrap
284 text: qsTr("Drag the loiter point to adjust landing direction for wind and obstacles as well as distance to land point.")
285 }
286
287 QGCButton {
288 text: qsTr("Done")
289 Layout.fillWidth: true
290 onClicked: {
291 missionItem.wizardMode = false
292 missionItem.landingDragAngleOnly = false
293 }
294 }
295 }
296 }
297}