Browse Source
Now the user can release and grab the gripper while the UAV has motors armed with the action button and also while the motors are disarmed in a specific toolbar option.QGC4.4
16 changed files with 272 additions and 1 deletions
@ -0,0 +1,71 @@ |
|||||||
|
|
||||||
|
import QtQuick 2.3 |
||||||
|
import QtQuick.Controls 1.2 |
||||||
|
import QtQuick.Controls.Styles 1.4 |
||||||
|
import QtQuick.Dialogs 1.2 |
||||||
|
import QtLocation 5.3 |
||||||
|
import QtPositioning 5.3 |
||||||
|
import QtQuick.Layouts 1.2 |
||||||
|
|
||||||
|
import QGroundControl 1.0 |
||||||
|
import QGroundControl.ScreenTools 1.0 |
||||||
|
import QGroundControl.Controls 1.0 |
||||||
|
import QGroundControl.Palette 1.0 |
||||||
|
import QGroundControl.Vehicle 1.0 |
||||||
|
import QGroundControl.FlightMap 1.0 |
||||||
|
|
||||||
|
Component { |
||||||
|
id: messageDialogComponent |
||||||
|
QGCPopupDialog { |
||||||
|
title: "Select one action" |
||||||
|
property var acceptFunction: null |
||||||
|
buttons: StandardButton.Cancel |
||||||
|
|
||||||
|
onRejected:{ |
||||||
|
_guidedController._gripperFunction = Vehicle.Invalid_option |
||||||
|
_guidedController.closeAll() |
||||||
|
close() |
||||||
|
} |
||||||
|
|
||||||
|
onAccepted: { |
||||||
|
if (acceptFunction) { |
||||||
|
_guidedController._gripperFunction = Vehicle.Invalid_option |
||||||
|
close() |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
RowLayout { |
||||||
|
QGCColumnButton { |
||||||
|
id: grabButton |
||||||
|
text: "Grab" |
||||||
|
iconSource: "/res/GripperGrab.svg" |
||||||
|
pointSize: ScreenTools.defaultFontPointSize * 3.5 |
||||||
|
backRadius: width / 40 |
||||||
|
heightFactor: 0.75 |
||||||
|
Layout.preferredHeight: releaseButton.height |
||||||
|
Layout.preferredWidth: releaseButton.width |
||||||
|
|
||||||
|
onClicked: { |
||||||
|
_guidedController._gripperFunction = Vehicle.Gripper_grab |
||||||
|
close() |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
QGCColumnButton { |
||||||
|
id: releaseButton |
||||||
|
text: "Release" |
||||||
|
iconSource: "/res/GripperRelease.svg" |
||||||
|
pointSize: ScreenTools.defaultFontPointSize * 3.5 |
||||||
|
backRadius: width / 40 |
||||||
|
heightFactor: 0.75 |
||||||
|
Layout.preferredWidth: ScreenTools.defaultFontPixelWidth * 27 |
||||||
|
Layout.preferredHeight: Layout.preferredWidth / 1.20 |
||||||
|
|
||||||
|
onClicked: { |
||||||
|
_guidedController._gripperFunction = Vehicle.Gripper_release |
||||||
|
close() |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,24 @@ |
|||||||
|
/**************************************************************************** |
||||||
|
* |
||||||
|
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> |
||||||
|
* |
||||||
|
* QGroundControl is licensed according to the terms in the file |
||||||
|
* COPYING.md in the root of the source code directory. |
||||||
|
* |
||||||
|
****************************************************************************/ |
||||||
|
|
||||||
|
import QGroundControl.FlightDisplay 1.0 |
||||||
|
import QGroundControl 1.0 |
||||||
|
|
||||||
|
GuidedToolStripAction { |
||||||
|
property var activeVehicle: QGroundControl.multiVehicleManager.activeVehicle |
||||||
|
property bool _initialConnectComplete: activeVehicle ? activeVehicle.initialConnectComplete : false |
||||||
|
property bool _grip_enable: _initialConnectComplete ? activeVehicle.hasGripper : false |
||||||
|
property bool _isVehicleArmed: _initialConnectComplete ? activeVehicle.armed : false |
||||||
|
|
||||||
|
text: "Gripper" |
||||||
|
iconSource: "/res/Gripper.svg" |
||||||
|
visible: !_isVehicleArmed && _grip_enable // in this way if the pilot it's on the ground can release the cargo without actions tool |
||||||
|
enabled: _grip_enable |
||||||
|
actionID: _guidedController.actionGripper |
||||||
|
} |
@ -0,0 +1,63 @@ |
|||||||
|
import QtQuick 2.5 |
||||||
|
import QtQuick.Controls 2.12 |
||||||
|
import QtQuick.Controls.Styles 1.4 |
||||||
|
import QtQuick.Layouts 1.2 |
||||||
|
|
||||||
|
import QGroundControl.Palette 1.0 |
||||||
|
import QGroundControl.ScreenTools 1.0 |
||||||
|
|
||||||
|
QGCButton { |
||||||
|
id: control //This is a button rework from DonLakeFlyer's QGCButton that allows to contain a text and an Icon with a column look and the same capabilites |
||||||
|
|
||||||
|
background: Rectangle { |
||||||
|
id: backRect |
||||||
|
width: control.width |
||||||
|
height: control.height |
||||||
|
radius: backRadius |
||||||
|
border.width: showBorder ? 1 : 0 |
||||||
|
border.color: qgcPal.buttonText |
||||||
|
color: _showHighlight ? |
||||||
|
qgcPal.buttonHighlight : |
||||||
|
(primary ? qgcPal.primaryButton : qgcPal.button) |
||||||
|
} |
||||||
|
|
||||||
|
contentItem: Item { |
||||||
|
id: contItem |
||||||
|
implicitWidth: Math.max(textLabel.implicitWidth , icon.implicitWidth ) * 1.1 |
||||||
|
implicitHeight: iconSource === "" ? textLabel.implicitHeight : textLabel.implicitHeight * 2.5 |
||||||
|
ColumnLayout { |
||||||
|
anchors.fill: parent |
||||||
|
QGCColoredImage { |
||||||
|
id: icon |
||||||
|
Layout.fillWidth: true |
||||||
|
Layout.fillHeight: true |
||||||
|
Layout.maximumHeight: parent.height - textLabelContainer.height |
||||||
|
Layout.alignment: control.text !== "" ? Qt.AlignTop : Qt.AlignHCenter | Qt.AlignVCenter |
||||||
|
source: control.iconSource |
||||||
|
color: qgcPal.text |
||||||
|
fillMode: Image.PreserveAspectFit |
||||||
|
sourceSize.height: height |
||||||
|
sourceSize.width: width |
||||||
|
visible: control.iconSource !== "" ? true : false |
||||||
|
} |
||||||
|
|
||||||
|
Item { |
||||||
|
id: textLabelContainer |
||||||
|
Layout.alignment: icon.visible ? Qt.AlignBottom | Qt.AlignHCenter : Qt.AlignCenter |
||||||
|
visible: control.text !== "" ? true : false |
||||||
|
Layout.preferredWidth: parent.width |
||||||
|
Layout.preferredHeight: textLabel.baselineOffset |
||||||
|
QGCLabel { |
||||||
|
id: textLabel |
||||||
|
text: control.text |
||||||
|
font.family: ScreenTools.normalFontFamily |
||||||
|
font.pointSize: control.pointSize |
||||||
|
color: _showHighlight ? qgcPal.buttonHighlightText : (primary ? qgcPal.primaryButtonText : qgcPal.buttonText) |
||||||
|
anchors.baseline: iconSource !== "" ? parent.bottom : undefined |
||||||
|
anchors.centerIn: iconSource === "" ? parent : undefined |
||||||
|
anchors.horizontalCenter: parent.horizontalCenter |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue