QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
PX4FlightBehaviorCopter.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Layouts
4
5import QGroundControl
6import QGroundControl.Controls
7
8SetupPage {
9 id: flightBehavior
10 pageComponent: pageComponent
11
12 property real _margins: ScreenTools.defaultFontPixelHeight
13
14 FactPanelController {
15 id: controller
16 }
17
18 QGCPalette {
19 id: qgcPal
20 }
21
22 property Fact _sys_vehicle_resp: controller.getParameterFact(-1, "SYS_VEHICLE_RESP", false)
23 property Fact _mpc_xy_vel_all: controller.getParameterFact(-1, "MPC_XY_VEL_ALL", false)
24 property Fact _mpc_z_vel_all: controller.getParameterFact(-1, "MPC_Z_VEL_ALL", false)
25
26 Component {
27 id: pageComponent
28
29 ColumnLayout {
30 width: Math.max(availableWidth, ScreenTools.defaultFontPixelWidth * 40)
31 spacing: _margins
32
33 ColumnLayout {
34 Layout.fillWidth: true
35 visible: _sys_vehicle_resp
36
37 SettingsGroupLayout {
38 Layout.fillWidth: true
39 enabled: responsivenessCheckbox.checked
40 heading: qsTr("Responsiveness")
41 headingDescription: qsTr("A higher value makes the vehicle react faster. Be aware that this affects braking as well, and a combination of slow responsiveness with high maximum velocity will lead to long braking distances.")
42
43 // It's a bit tricky to handle the fact that the parameter goes negative to signal disabled.
44 // We can't allow the slider to go negative, hence all the hoops to jump through with value and loadComplete.
45 ValueSlider {
46 Layout.fillWidth: true
47 from: 0.0
48 to: 1
49 majorTickStepSize: 0.01
50 value: { value = _sys_vehicle_resp ? Math.abs(_sys_vehicle_resp.value) : (from + to) / 2 }
51 decimalPlaces: _sys_vehicle_resp ? _sys_vehicle_resp.decimalPlaces : 0
52
53 property bool loadComplete: false
54
55 Component.onCompleted: loadComplete = true
56
57 onValueChanged: {
58 if (loadComplete && enabled) {
59 _sys_vehicle_resp.value = value
60 }
61 }
62 }
63 }
64
65 QGCCheckBox {
66 id: responsivenessCheckbox
67 Layout.fillWidth: true
68 text: qsTr("Enable responsiveness slider (if enabled, acceleration limit parameters and others are automatically set)")
69 checked: _sys_vehicle_resp && _sys_vehicle_resp.value >= 0
70 onClicked: _sys_vehicle_resp.value = checked ? Math.abs(_sys_vehicle_resp.value) : -Math.abs(_sys_vehicle_resp.value)
71 }
72
73 QGCLabel {
74 Layout.fillWidth: true
75 visible: _sys_vehicle_resp && _sys_vehicle_resp.value > 0.8
76 color: qgcPal.warningText
77 text: qsTr("Warning: a high responsiveness requires a vehicle with large thrust-to-weight ratio. The vehicle might lose altitude otherwise.")
78 }
79 }
80
81 ColumnLayout {
82 Layout.fillWidth: true
83 visible: _mpc_xy_vel_all
84
85 SettingsGroupLayout {
86 Layout.fillWidth: true
87 enabled: xyVelCheckbox.checked
88 heading: qsTr("Horizontal velocity (m/s)")
89 headingDescription: qsTr("Limit the horizonal velocity (applies to all modes).")
90
91 // It's a bit tricky to handle the fact that the parameter goes negative to signal disabled.
92 // We can't allow the slider to go negative, hence all the hoops to jump through with value and loadComplete.
93 ValueSlider {
94 Layout.fillWidth: true
95 from: 0.5
96 to: 20
97 majorTickStepSize: 0.6
98 value: { value = _mpc_xy_vel_all ? Math.abs(_mpc_xy_vel_all.value) : (from + to) / 2 }
99 decimalPlaces: _mpc_xy_vel_all ? _mpc_xy_vel_all.decimalPlaces : 0
100
101 property bool loadComplete: false
102
103 Component.onCompleted: loadComplete = true
104
105 onValueChanged: {
106 if (loadComplete && enabled) {
107 _mpc_xy_vel_all.value = value
108 }
109 }
110 }
111 }
112
113 QGCCheckBox {
114 id: xyVelCheckbox
115 Layout.fillWidth: true
116 text: qsTr("Enable horizontal velocity slider (if enabled, individual velocity limit parameters are automatically set)")
117 checked: _mpc_xy_vel_all ? (_mpc_xy_vel_all.value >= 0) : false
118 onClicked: mpc_xy_vel_all.value = checked ? Math.abs(_mpc_xy_vel_all.value) : -Math.abs(_mpc_xy_vel_all.value)
119 }
120 }
121
122 ColumnLayout {
123 Layout.fillWidth: true
124 visible: _mpc_z_vel_all
125
126 SettingsGroupLayout {
127 Layout.fillWidth: true
128 enabled: zVelCheckbox.checked
129 heading: qsTr("Vertical velocity (m/s)")
130 headingDescription: qsTr("Limit the vertical velocity (applies to all modes).")
131
132 // It's a bit tricky to handle the fact that the parameter goes negative to signal disabled.
133 // We can't allow the slider to go negative, hence all the hoops to jump through with value and loadComplete.
134 ValueSlider {
135 Layout.fillWidth: true
136 from: 0.2
137 to: 8
138 majorTickStepSize: 0.2
139 value: { value = _mpc_z_vel_all ? Math.abs(_mpc_z_vel_all.value) : (from + to) / 2 }
140 decimalPlaces: _mpc_z_vel_all ? _mpc_z_vel_all.decimalPlaces : 0
141
142 property bool loadComplete: false
143
144 Component.onCompleted: loadComplete = true
145
146 onValueChanged: {
147 if (loadComplete && enabled) {
148 _mpc_z_vel_all.value = value
149 }
150 }
151 }
152 }
153
154 QGCCheckBox {
155 id: zVelCheckbox
156 Layout.fillWidth: true
157 text: qsTr("Enable vertical velocity slider (if enabled, individual velocity limit parameters are automatically set)")
158 checked: _mpc_z_vel_all && _mpc_z_vel_all.value >= 0
159 onClicked: mpc_z_vel_all.value = checked ? Math.abs(_mpc_z_vel_all.value) : -Math.abs(_mpc_z_vel_all.value)
160 }
161 }
162
163 SettingsGroupLayout {
164 Layout.fillWidth: true
165 heading: qsTr("Mission Turning Radius")
166 headingDescription: qsTr("Increasing this leads to rounder turns in missions (corner cutting). Use the minimum value for accurate corner tracking.")
167
168 FactSlider {
169 Layout.fillWidth: true
170 from: QGroundControl.unitsConversion.metersToAppSettingsHorizontalDistanceUnits(2)
171 to: QGroundControl.unitsConversion.metersToAppSettingsHorizontalDistanceUnits(16)
172 majorTickStepSize: 0.5
173 fact: controller.getParameterFact(-1, "NAV_ACC_RAD")
174 }
175 }
176 }
177 }
178}