6import QGroundControl.Controls
7import QGroundControl.FactControls
11 anchors.top: parent.top
12 anchors.bottom: parent.bottom
13 width: gimbalIndicatorRow.width
15 property bool showIndicator: gimbalController.gimbals.count
17 property var activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
18 property var gimbalController: activeVehicle.gimbalController
19 property var gimbals: gimbalController.gimbals
20 property var activeGimbal: gimbalController.activeGimbal
21 property var multiGimbalSetup: gimbalController.gimbals.count > 1
22 property bool joystickButtonsAvailable: activeVehicle ? joystickManager.activeJoystickEnabledForActiveVehicle : false
23 property bool showAzimuth: QGroundControl.settingsManager.gimbalControllerSettings.toolbarIndicatorShowAzimuth.rawValue
25 property var margins: ScreenTools.defaultFontPixelWidth
26 property var panelRadius: ScreenTools.defaultFontPixelWidth * 0.5
27 property var buttonHeight: height * 1.6
28 property var squareButtonPadding: ScreenTools.defaultFontPixelWidth
29 property var separatorHeight: buttonHeight * 0.9
30 property var settingsPanelVisible: false
32 property var _gimbalControllerSettings: QGroundControl.settingsManager.gimbalControllerSettings
34 QGCPalette { id: qgcPal }
37 id: gimbalIndicatorRow
38 anchors.top: parent.top
39 anchors.bottom: parent.bottom
40 spacing: ScreenTools.defaultFontPixelWidth / 2
43 anchors.top: parent.top
44 anchors.bottom: parent.bottom
48 id: gimbalIndicatorIcon
49 anchors.horizontalCenter: parent.horizontalCenter
51 height: multiGimbalSetup ? parent.height - gimbalIdLabel.contentHeight : parent.height
52 source: "/res/CameraGimbal.png"
53 fillMode: Image.PreserveAspectFit
54 sourceSize.height: height
55 color: qgcPal.windowTransparentText
61 anchors.horizontalCenter: parent.horizontalCenter
62 font.pointSize: ScreenTools.smallFontPointSize
63 text: activeGimbal ? activeGimbal.deviceId.rawValue : ""
64 color: qgcPal.windowTransparentText
65 visible: multiGimbalSetup
69 // Telemetry and status indicator
71 anchors.verticalCenter: parent.verticalCenter
75 columnSpacing: margins / 2
79 font.pointSize: ScreenTools.smallFontPointSize
80 text: activeGimbal && activeGimbal.retracted ?
82 (activeGimbal && activeGimbal.yawLock ? qsTr("Yaw locked") : qsTr("Yaw follow"))
83 color: qgcPal.windowTransparentText
85 Layout.alignment: Qt.AlignHCenter
89 font.pointSize: ScreenTools.smallFontPointSize
90 text: activeGimbal ? qsTr("P: ") + activeGimbal.absolutePitch.valueString : ""
91 color: qgcPal.windowTransparentText
95 font.pointSize: ScreenTools.smallFontPointSize
98 (qsTr("Az: ") + activeGimbal.absoluteYaw.valueString) :
99 (qsTr("Y: ") + activeGimbal.bodyYaw.valueString)) :
101 color: qgcPal.windowTransparentText
108 onClicked: mainWindow.showIndicatorDrawer(gimbalPopup, control)
116 waitForParameters: false
117 contentComponent: gimbalContentComponent
118 expandedComponent: gimbalExpandedComponent
123 id: gimbalContentComponent
126 spacing: ScreenTools.defaultFontPixelWidth / 2
128 SettingsGroupLayout {
129 heading: qsTr("Active Gimbal")
130 visible: multiGimbalSetup
133 id: gimbalSelectorCombo
134 Layout.fillWidth: true
135 visible: multiGimbalSetup
136 onCurrentIndexChanged: gimbalController.activeGimbal = gimbalController.gimbals.get(currentIndex)
138 function _updateComboModel() {
141 for (var i = 0; i < gimbals.count; i++) {
142 var gimbal = gimbals.get(i)
143 gimbalModel.push(qsTr("Gimbal %1").arg(gimbal.deviceId.valueString))
144 if (gimbal === activeGimbal) {
148 gimbalSelectorCombo.model = gimbalModel
149 gimbalSelectorCombo.currentIndex = activeIndex
152 Component.onCompleted: _updateComboModel()
155 function onCountChanged(count) { _updateComboModel() }
160 SettingsGroupLayout {
161 heading: qsTr("Commands")
165 Layout.fillWidth: true
166 text: activeGimbal.yawLock ? qsTr("Yaw Follow") : qsTr("Yaw Lock")
167 visible: activeGimbal.supportsYawLock
169 gimbalController.setGimbalYawLock(!activeGimbal.yawLock)
170 mainWindow.closeIndicatorDrawer()
175 Layout.fillWidth: true
178 gimbalController.centerGimbal()
179 mainWindow.closeIndicatorDrawer()
184 Layout.fillWidth: true
185 text: qsTr("Tilt 90")
187 gimbalController.sendPitchBodyYaw(-90, 0)
188 mainWindow.closeIndicatorDrawer()
193 Layout.fillWidth: true
194 text: qsTr("Point Home")
196 activeVehicle.guidedModeROI(activeVehicle.homePosition)
197 mainWindow.closeIndicatorDrawer()
202 Layout.fillWidth: true
203 text: qsTr("Retract")
204 visible: activeGimbal.supportsRetract
206 gimbalController.setGimbalRetract(true)
207 mainWindow.closeIndicatorDrawer()
212 Layout.fillWidth: true
213 text: activeGimbal.gimbalHaveControl ? qsTr("Release Control") : qsTr("Acquire Control")
214 visible: _gimbalControllerSettings.toolbarIndicatorShowAcquireReleaseControl.rawValue
216 activeGimbal.gimbalHaveControl ? gimbalController.releaseGimbalControl() : gimbalController.acquireGimbalControl()
217 mainWindow.closeIndicatorDrawer()
225 id: gimbalExpandedComponent
228 spacing: ScreenTools.defaultFontPixelWidth / 2
230 SettingsGroupLayout {
231 heading: qsTr("On-Screen Control")
235 id: enableOnScreenControlCheckbox
236 Layout.fillWidth: true
237 text: qsTr("Enabled")
238 fact: _gimbalControllerSettings.EnableOnScreenControl
241 LabelledFactComboBox {
242 label: qsTr("Control type")
243 fact: _gimbalControllerSettings.ControlType
244 visible: enableOnScreenControlCheckbox.checked
247 LabelledFactTextField {
248 label: qsTr("Horizontal FOV")
249 fact: _gimbalControllerSettings.CameraHFov
250 visible: enableOnScreenControlCheckbox.checked && _gimbalControllerSettings.ControlType.rawValue === 0
253 LabelledFactTextField {
254 label: qsTr("Vertical FOV")
255 fact: _gimbalControllerSettings.CameraVFov
256 visible: enableOnScreenControlCheckbox.checked && _gimbalControllerSettings.ControlType.rawValue === 0
259 LabelledFactTextField {
260 label: qsTr("Max speed")
261 fact: _gimbalControllerSettings.CameraSlideSpeed
262 visible: enableOnScreenControlCheckbox.checked && _gimbalControllerSettings.ControlType.rawValue === 1
266 SettingsGroupLayout {
267 heading: qsTr("Zoom speed")
270 LabelledFactTextField {
271 label: qsTr("Max speed (min zoom)")
272 fact: _gimbalControllerSettings.zoomMaxSpeed
275 LabelledFactTextField {
276 label: qsTr("Min speed (max zoom)")
277 fact: _gimbalControllerSettings.zoomMinSpeed
282 SettingsGroupLayout {
283 LabelledFactTextField {
284 label: qsTr("Joystick buttons speed:")
285 fact: _gimbalControllerSettings.joystickButtonsSpeed
286 enabled: joystickButtonsAvailable && _gimbalControllerSettings.visible
290 Layout.fillWidth: true
291 text: qsTr("Show gimbal Azimuth indicator in map")
292 fact: _gimbalControllerSettings.showAzimuthIndicatorOnMap
296 Layout.fillWidth: true
297 text: qsTr("Use Azimuth instead of local yaw on top toolbar indicator")
298 fact: _gimbalControllerSettings.toolbarIndicatorShowAzimuth
302 Layout.fillWidth: true
303 text: qsTr("Show Acquire/Release control button")
304 fact: _gimbalControllerSettings.toolbarIndicatorShowAcquireReleaseControl
311 id: acquirePopupConnection
312 property bool isPopupOpen: false
313 target: gimbalController
314 function onShowAcquireGimbalControlPopup() {
315 if(!acquirePopupConnection.isPopupOpen){
316 acquirePopupConnection.isPopupOpen = true;
317 QGroundControl.showMessageDialog(
319 "Request Gimbal Control?",
320 "Command not sent. Another user has control of the gimbal.",
321 Dialog.Yes | Dialog.No,
322 gimbalController.acquireGimbalControl,
323 function() { acquirePopupConnection.isPopupOpen = false }