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