Browse Source

Add Frontend UI for GripperAction Feature

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
DieBorr 2 years ago committed by Philipp Borgers
parent
commit
14e9b94b1b
  1. 3
      qgcresources.qrc
  2. 3
      qgroundcontrol.qrc
  3. 20
      resources/Gripper.svg
  4. 27
      resources/GripperGrab.svg
  5. 27
      resources/GripperRelease.svg
  6. 2
      src/FlightDisplay/CMakeLists.txt
  7. 1
      src/FlightDisplay/FlyView.qml
  8. 3
      src/FlightDisplay/FlyViewToolStripActionList.qml
  9. 5
      src/FlightDisplay/FlyViewWidgetLayer.qml
  10. 71
      src/FlightDisplay/GripperMenu.qml
  11. 24
      src/FlightDisplay/GuidedActionGripper.qml
  12. 6
      src/FlightDisplay/GuidedActionList.qml
  13. 15
      src/FlightDisplay/GuidedActionsController.qml
  14. 63
      src/QmlControls/QGCColumnButton.qml
  15. 1
      src/QmlControls/QGroundControl/Controls/qmldir
  16. 2
      src/QmlControls/QGroundControl/FlightDisplay/qmldir

3
qgcresources.qrc

@ -55,6 +55,9 @@ @@ -55,6 +55,9 @@
<file alias="XDelete.svg">resources/XDelete.svg</file>
<file alias="XDeleteBlack.svg">resources/XDeleteBlack.svg</file>
<file alias="waypoint.svg">resources/waypoint.svg</file>
<file alias="Gripper.svg">resources/Gripper.svg</file>
<file alias="GripperRelease.svg">resources/GripperRelease.svg</file>
<file alias="GripperGrab.svg">resources/GripperGrab.svg</file>
<file>resources/icons/qgroundcontrol.ico</file>
</qresource>
<qresource prefix="/res/firmware">

3
qgroundcontrol.qrc

@ -132,6 +132,7 @@ @@ -132,6 +132,7 @@
<file alias="QGroundControl/Controls/PreFlightCheckGroup.qml">src/QmlControls/PreFlightCheckGroup.qml</file>
<file alias="QGroundControl/Controls/PreFlightCheckModel.qml">src/QmlControls/PreFlightCheckModel.qml</file>
<file alias="QGroundControl/Controls/QGCButton.qml">src/QmlControls/QGCButton.qml</file>
<file alias="QGroundControl/Controls/QGCColumnButton.qml">src/QmlControls/QGCColumnButton.qml</file>
<file alias="QGroundControl/Controls/AutotuneUI.qml">src/QmlControls/AutotuneUI.qml</file>
<file alias="QGroundControl/Controls/QGCCheckBox.qml">src/QmlControls/QGCCheckBox.qml</file>
<file alias="QGroundControl/Controls/QGCColoredImage.qml">src/QmlControls/QGCColoredImage.qml</file>
@ -221,6 +222,8 @@ @@ -221,6 +222,8 @@
<file alias="QGroundControl/FlightDisplay/GuidedActionLand.qml">src/FlightDisplay/GuidedActionLand.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedActionList.qml">src/FlightDisplay/GuidedActionList.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedActionTakeoff.qml">src/FlightDisplay/GuidedActionTakeoff.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedActionGripper.qml">src/FlightDisplay/GuidedActionGripper.qml</file>
<file alias="QGroundControl/FlightDisplay/GripperMenu.qml">src/FlightDisplay/GripperMenu.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedActionPause.qml">src/FlightDisplay/GuidedActionPause.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedActionRTL.qml">src/FlightDisplay/GuidedActionRTL.qml</file>
<file alias="QGroundControl/FlightDisplay/GuidedValueSlider.qml">src/FlightDisplay/GuidedValueSlider.qml</file>

20
resources/Gripper.svg

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Capa_2" data-name="Capa 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 79.06 85.47">
<defs>
<style>
.cls-1 {
fill: #fff;
}
</style>
</defs>
<g id="Capa_5" data-name="Capa 5">
<g>
<g>
<path class="cls-1" d="m39.53,16.53c-2.7,0-4.94-1.94-5.41-4.51h-12.45v8.44h8.35l6.04,13.7h6.93l6.04-13.7h8.45v-8.44h-12.55c-.47,2.56-2.71,4.51-5.41,4.51Z"/>
<path class="cls-1" d="m62.53,6.75L52.47.03l-.02-.03h-25.71l-.02.03-10.05,6.72v2.92h17.53c.61-2.38,2.76-4.14,5.32-4.14s4.72,1.76,5.32,4.14h17.68v-2.92Z"/>
</g>
<path class="cls-1" d="m25.16,85.3l.91-3.02c.07-.23,0-.48-.16-.65l-1.72-1.61h0c-.47-.54-.76-1.2-.85-1.91-.16-1.32-.04-2.67.35-3.95l.1-.33c.07-.23,0-.48-.16-.65l-1.17-1.18c-.62-.62-1.05-1.4-1.27-2.25h0c-.21-.85-.19-1.74.06-2.58l.49-1.62c.07-.23,0-.48-.16-.65l-1.2-1.22c-.61-.61-1.03-1.37-1.24-2.21h0c-.21-.83-.18-1.71.06-2.53l.53-1.77c.07-.23,0-.48-.16-.65l-.63-.63c-1.04-1.05-1.77-2.36-2.13-3.79h0c-.12-.49.05-1.01.44-1.33l15.8-12.92-5.06-10.72h-11.39L0,44.88l18.89,39.78c.23.49.73.81,1.28.81h4.93l.06-.17Z"/>
<path class="cls-1" d="m53.9,85.3l-.91-3.02c-.07-.23,0-.48.16-.65l1.72-1.61h0c.47-.54.76-1.2.85-1.91.16-1.32.04-2.67-.35-3.95l-.1-.33c-.07-.23,0-.48.16-.65l1.17-1.18c.62-.62,1.05-1.4,1.27-2.25h0c.21-.85.19-1.74-.06-2.58l-.49-1.62c-.07-.23,0-.48.16-.65l1.2-1.22c.61-.61,1.03-1.37,1.24-2.21h0c.21-.83.18-1.71-.06-2.53l-.53-1.77c-.07-.23,0-.48.16-.65l.63-.63c1.04-1.05,1.77-2.36,2.13-3.79h0c.12-.49-.05-1.01-.44-1.33l-15.8-12.92,5.06-10.72h11.39s16.61,17.78,16.61,17.78l-18.89,39.78c-.23.49-.73.81-1.28.81h-4.93s-.06-.17-.06-.17Z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

27
resources/GripperGrab.svg

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Capa_2" data-name="Capa 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 159 120.12">
<defs>
<style>
.cls-1, .cls-2 {
fill: #fff;
}
.cls-2 {
fill-rule: evenodd;
}
</style>
</defs>
<g id="Capa_5" data-name="Capa 5">
<g>
<g>
<path class="cls-1" d="m79.5,51.32c-2.69,0-4.93-1.94-5.39-4.5h-12.42v8.43h8.33l6.03,13.67h6.91l6.03-13.67h8.43v-8.43h-12.52c-.47,2.56-2.7,4.5-5.39,4.5Z"/>
<path class="cls-1" d="m102.45,41.56l-10.03-6.71-.02-.03h-25.65l-.02.03-10.03,6.71v2.91h17.49c.61-2.37,2.75-4.13,5.31-4.13s4.71,1.76,5.31,4.13h17.64v-2.91Z"/>
</g>
<path class="cls-2" d="m27.66,85.64l27.2-16.66s.04-.09,0-.12l-27.2-16.66s-.1,0-.1.06v9.81s-.03.07-.07.07H.07s-.07.03-.07.07v13.43s.03.07.07.07h27.42s.07.03.07.07v9.81c0,.05.06.09.1.06Z"/>
<path class="cls-1" d="m64.19,114.66c-.47-.53-.76-1.2-.84-1.9-.16-1.32-.04-2.66.34-3.95l.1-.33c.07-.23,0-.48-.16-.65l-1.17-1.18c-.62-.62-1.05-1.4-1.26-2.25-.21-.85-.19-1.74.06-2.57l.49-1.62c.07-.23,0-.48-.16-.65l-1.2-1.21c-.6-.61-1.03-1.37-1.24-2.2-.21-.83-.18-1.7.06-2.52l.53-1.76c.07-.23,0-.48-.16-.65l-.63-.63c-1.04-1.05-1.77-2.35-2.12-3.78-.12-.49.05-1.01.44-1.33l15.77-12.89-5.04-10.7h-11.36l-2.71,2.9,2.49,1.53c.91.55,1.48,1.56,1.48,2.62s-.57,2.07-1.47,2.62l-15.65,9.58,18.13,38.19c.23.49.73.81,1.28.81h4.92l.06-.17.91-3.02c.07-.23,0-.48-.16-.65l-1.72-1.61Z"/>
<path class="cls-2" d="m131.34,85.64l-27.2-16.66s-.04-.09,0-.12l27.2-16.66s.1,0,.1.06v9.81s.03.07.07.07h27.42s.07.03.07.07v13.43s-.03.07-.07.07h-27.42s-.07.03-.07.07v9.81c0,.05-.06.09-.1.06Z"/>
<path class="cls-1" d="m102.59,71.54c-.91-.55-1.48-1.56-1.48-2.62s.57-2.07,1.47-2.62l2.5-1.53-2.71-2.9h-11.36l-5.04,10.7,15.77,12.89c.39.32.56.84.44,1.33-.35,1.43-1.09,2.74-2.12,3.78l-.63.63c-.17.17-.23.42-.16.65l.53,1.76c.25.82.27,1.69.06,2.52-.21.83-.63,1.59-1.24,2.2l-1.2,1.21c-.17.17-.23.42-.16.65l.49,1.62c.25.84.27,1.72.06,2.57-.21.85-.65,1.63-1.26,2.25l-1.17,1.18c-.17.17-.23.42-.16.65l.1.33c.39,1.28.5,2.63.34,3.95-.08.7-.38,1.37-.84,1.9l-1.72,1.61c-.17.17-.23.42-.16.65l.91,3.02.06.17h4.92c.55,0,1.04-.31,1.28-.81l18.13-38.19-15.64-9.58Z"/>
<path class="cls-1" d="m66.75,0v32.48h25.66V0h-25.66Zm18.5,29.28c0,.57-.47,1.04-1.04,1.04h-9.27c-.57,0-1.04-.47-1.04-1.04V3.2c0-.57.47-1.04,1.04-1.04h9.27c.57,0,1.04.47,1.04,1.04v26.07Z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

27
resources/GripperRelease.svg

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Capa_2" data-name="Capa 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 159.34 120.37">
<defs>
<style>
.cls-1, .cls-2 {
fill: #fff;
}
.cls-2 {
fill-rule: evenodd;
}
</style>
</defs>
<g id="Capa_5" data-name="Capa 5">
<g>
<g>
<path class="cls-1" d="m79.67,51.43c-2.7,0-4.94-1.94-5.41-4.51h-12.45v8.44h8.35l6.04,13.7h6.93l6.04-13.7h8.45v-8.44h-12.55c-.47,2.56-2.71,4.51-5.41,4.51Z"/>
<path class="cls-1" d="m102.67,41.65l-10.05-6.72-.02-.03h-25.71l-.02.03-10.05,6.72v2.92h17.53c.61-2.38,2.76-4.14,5.32-4.14s4.72,1.76,5.32,4.14h17.68v-2.92Z"/>
</g>
<path class="cls-2" d="m27.29,52.32L.03,69.01s-.04.09,0,.12l27.26,16.69s.1,0,.1-.06v-9.83s.03-.07.07-.07h27.47s.07-.03.07-.07v-13.45s-.03-.07-.07-.07h-27.47s-.07-.03-.07-.07v-9.83c0-.05-.06-.09-.1-.06Z"/>
<path class="cls-1" d="m64.33,114.91c-.47-.54-.76-1.2-.85-1.91-.16-1.32-.04-2.67.35-3.95l.1-.33c.07-.23,0-.48-.16-.65l-1.17-1.18c-.62-.62-1.05-1.4-1.27-2.25h0c-.21-.85-.19-1.74.06-2.58l.49-1.62c.07-.23,0-.48-.16-.65l-1.2-1.22c-.6-.61-1.03-1.37-1.24-2.21-.21-.83-.18-1.71.06-2.53l.53-1.77c.07-.23,0-.48-.16-.65l-.63-.64c-1.04-1.05-1.77-2.36-2.13-3.79-.12-.49.05-1.01.44-1.33l15.8-12.92-5.06-10.72h-10.17c.01.11.03.22.03.34v13.45c0,1.69-1.38,3.07-3.07,3.07h-13.94l-.86.92,18.89,39.78c.23.49.73.81,1.28.81h4.93l.06-.17.91-3.02c.07-.23,0-.48-.16-.65l-1.72-1.61Z"/>
<path class="cls-2" d="m132.05,52.32l27.26,16.69s.04.09,0,.12l-27.26,16.69s-.1,0-.1-.06v-9.83s-.03-.07-.07-.07h-27.47s-.07-.03-.07-.07v-13.45s.03-.07.07-.07h27.47s.07-.03.07-.07v-9.83c0-.05.06-.09.1-.06Z"/>
<path class="cls-1" d="m104.4,78.86c-1.69,0-3.07-1.38-3.07-3.07v-13.45c0-.12.02-.23.03-.34h-10.17l-5.06,10.72,15.8,12.92c.39.32.56.84.44,1.33-.35,1.43-1.09,2.74-2.13,3.79l-.63.64c-.17.17-.23.42-.16.65l.53,1.77c.25.82.27,1.69.06,2.53-.21.83-.64,1.6-1.24,2.21l-1.2,1.22c-.17.17-.23.42-.16.65l.49,1.62c.25.84.27,1.73.06,2.58h0c-.21.85-.65,1.63-1.27,2.25l-1.17,1.18c-.17.17-.23.42-.16.65l.1.33c.39,1.28.5,2.63.35,3.95-.08.71-.38,1.37-.85,1.91l-1.72,1.61c-.17.17-.23.42-.16.65l.91,3.02.06.17h4.93c.55,0,1.05-.32,1.28-.81l18.89-39.78-.86-.92h-13.94Z"/>
<path class="cls-1" d="m66.89,0v32.55h25.71V0h-25.71Zm18.54,29.34c0,.58-.47,1.04-1.04,1.04h-9.29c-.58,0-1.04-.47-1.04-1.04V3.21c0-.58.47-1.04,1.04-1.04h9.29c.58,0,1.04.47,1.04,1.04v26.13Z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

2
src/FlightDisplay/CMakeLists.txt

@ -26,6 +26,8 @@ add_custom_target(FligthDisplayQml @@ -26,6 +26,8 @@ add_custom_target(FligthDisplayQml
GuidedActionRTL.qml
GuidedActionsController.qml
GuidedActionTakeoff.qml
GuidedActionGripper.qml
GripperMenu.qml
GuidedValueSlider.qml
GuidedToolStripAction.qml
MultiRotorChecklist.qml

1
src/FlightDisplay/FlyView.qml

@ -52,6 +52,7 @@ Item { @@ -52,6 +52,7 @@ Item {
property var _guidedController: guidedActionsController
property var _guidedActionList: guidedActionList
property var _guidedValueSlider: guidedValueSlider
property var _widgetLayer: widgetLayer
property real _toolsMargin: ScreenTools.defaultFontPixelWidth * 0.75
property rect _centerViewport: Qt.rect(0, 0, width, height)
property real _rightPanelWidth: ScreenTools.defaultFontPixelWidth * 30

3
src/FlightDisplay/FlyViewToolStripActionList.qml

@ -28,6 +28,7 @@ ToolStripActionList { @@ -28,6 +28,7 @@ ToolStripActionList {
GuidedActionLand { },
GuidedActionRTL { },
GuidedActionPause { },
GuidedActionActionList { }
GuidedActionActionList { },
GuidedActionGripper { }
]
}

5
src/FlightDisplay/FlyViewWidgetLayer.qml

@ -48,6 +48,7 @@ Item { @@ -48,6 +48,7 @@ Item {
property real _toolsMargin: ScreenTools.defaultFontPixelWidth * 0.75
property rect _centerViewport: Qt.rect(0, 0, width, height)
property real _rightPanelWidth: ScreenTools.defaultFontPixelWidth * 30
property alias _gripperMenu: gripperOptions
QGCToolInsets {
id: _totalToolInsets
@ -258,6 +259,10 @@ Item { @@ -258,6 +259,10 @@ Item {
property real leftInset: x + width
}
GripperMenu {
id: gripperOptions
}
FlyViewAirspaceIndicator {
anchors.top: parent.top
anchors.topMargin: ScreenTools.defaultFontPixelHeight * 0.25

71
src/FlightDisplay/GripperMenu.qml

@ -0,0 +1,71 @@ @@ -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()
}
}
}
}
}

24
src/FlightDisplay/GuidedActionGripper.qml

@ -0,0 +1,24 @@ @@ -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
}

6
src/FlightDisplay/GuidedActionList.qml

@ -69,6 +69,12 @@ Rectangle { @@ -69,6 +69,12 @@ Rectangle {
text: guidedController.changeSpeedMessage,
action: guidedController.actionChangeSpeed,
visible: guidedController.showChangeSpeed
},
{
title: guidedController.gripperTitle,
text: guidedController.gripperMessage,
action: guidedController.actionGripper,
visible: guidedController.showGripper
}
]

15
src/FlightDisplay/GuidedActionsController.qml

@ -39,6 +39,7 @@ Item { @@ -39,6 +39,7 @@ Item {
readonly property string disarmTitle: qsTr("Disarm")
readonly property string rtlTitle: qsTr("Return")
readonly property string takeoffTitle: qsTr("Takeoff")
readonly property string gripperTitle: qsTr("Gripper Function")
readonly property string landTitle: qsTr("Land")
readonly property string startMissionTitle: qsTr("Start Mission")
readonly property string mvStartMissionTitle: qsTr("Start Mission (MV)")
@ -62,6 +63,7 @@ Item { @@ -62,6 +63,7 @@ Item {
readonly property string disarmMessage: qsTr("Disarm the vehicle")
readonly property string emergencyStopMessage: qsTr("WARNING: THIS WILL STOP ALL MOTORS. IF VEHICLE IS CURRENTLY IN THE AIR IT WILL CRASH.")
readonly property string takeoffMessage: qsTr("Takeoff from ground and hold position.")
readonly property string gripperMessage: qsTr("Grab or Release the cargo")
readonly property string startMissionMessage: qsTr("Takeoff from ground and start the current mission.")
readonly property string continueMissionMessage: qsTr("Continue the mission from the current waypoint.")
readonly property string resumeMissionUploadFailMessage: qsTr("Upload of resume mission failed. Confirm to retry upload")
@ -105,6 +107,7 @@ Item { @@ -105,6 +107,7 @@ Item {
readonly property int actionActionList: 23
readonly property int actionForceArm: 24
readonly property int actionChangeSpeed: 25
readonly property int actionGripper: 26
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist.rawValue && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length
@ -113,6 +116,7 @@ Item { @@ -113,6 +116,7 @@ Item {
property bool _canArm: _activeVehicle ? (_checklistPassed && (!_activeVehicle.healthAndArmingCheckReport.supported || _activeVehicle.healthAndArmingCheckReport.canArm)) : false
property bool _canTakeoff: _activeVehicle ? (_checklistPassed && (!_activeVehicle.healthAndArmingCheckReport.supported || _activeVehicle.healthAndArmingCheckReport.canTakeoff)) : false
property bool _canStartMission: _activeVehicle ? (_checklistPassed && (!_activeVehicle.healthAndArmingCheckReport.supported || _activeVehicle.healthAndArmingCheckReport.canStartMission)) : false
property bool _initialConnectComplete: _activeVehicle ? _activeVehicle.initialConnectComplete : false
property bool showEmergenyStop: _guidedActionsEnabled && !_hideEmergenyStop && _vehicleArmed && _vehicleFlying
property bool showArm: _guidedActionsEnabled && !_vehicleArmed && _canArm
@ -131,6 +135,7 @@ Item { @@ -131,6 +135,7 @@ Item {
property bool showLandAbort: _guidedActionsEnabled && _vehicleFlying && _fixedWingOnApproach
property bool showGotoLocation: _guidedActionsEnabled && _vehicleFlying
property bool showActionList: _guidedActionsEnabled && (showStartMission || showResumeMission || showChangeAlt || showLandAbort || actionList.hasCustomActions)
property bool showGripper: _initialConnectComplete ? _activeVehicle.hasGripper : false
property string changeSpeedTitle: _fixedWing ? changeAirspeedTitle : changeCruiseSpeedTitle
property string changeSpeedMessage: _fixedWing ? changeAirspeedMessage : changeCruiseSpeedMessage
@ -163,6 +168,7 @@ Item { @@ -163,6 +168,7 @@ Item {
property bool _fixedWingOnApproach: _activeVehicle ? _activeVehicle.fixedWing && _vehicleLanding : false
property bool _fixedWing: _activeVehicle ? _activeVehicle.fixedWing || _activeVehicle.vtolInFwdFlight : false
property bool _speedLimitsAvailable: _activeVehicle && ((_fixedWing && _activeVehicle.haveFWSpeedLimits) || (!_fixedWing && _activeVehicle.haveMRSpeedLimits))
property var _gripperFunction: undefined
// You can turn on log output for GuidedActionsController by turning on GuidedActionsControllerLog category
property bool __guidedModeSupported: _activeVehicle ? _activeVehicle.guidedModeSupported : false
@ -496,6 +502,12 @@ Item { @@ -496,6 +502,12 @@ Item {
confirmDialog.message = changeSpeedMessage
guidedValueSlider.visible = true
break
case actionGripper:
confirmDialog.hideTrigger = true
confirmDialog.title = gripperTitle
confirmDialog.message = gripperMessage
_widgetLayer._gripperMenu.createObject(mainWindow).open()
break
default:
console.warn("Unknown actionCode", actionCode)
return
@ -585,6 +597,9 @@ Item { @@ -585,6 +597,9 @@ Item {
}
}
break
case actionGripper:
_gripperFunction === undefined ? _activeVehicle.sendGripperAction(Vehicle.Invalid_option) : _activeVehicle.sendGripperAction(_gripperFunction)
break
default:
console.warn(qsTr("Internal error: unknown actionCode"), actionCode)
break

63
src/QmlControls/QGCColumnButton.qml

@ -0,0 +1,63 @@ @@ -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
}
}
}
}
}

1
src/QmlControls/QGroundControl/Controls/qmldir

@ -55,6 +55,7 @@ PreFlightCheckButton 1.0 PreFlightCheckButton.qml @@ -55,6 +55,7 @@ PreFlightCheckButton 1.0 PreFlightCheckButton.qml
PreFlightCheckGroup 1.0 PreFlightCheckGroup.qml
PreFlightCheckModel 1.0 PreFlightCheckModel.qml
QGCButton 1.0 QGCButton.qml
QGCColumnButton 1.0 QGCColumnButton.qml
AutotuneUI 1.0 AutotuneUI.qml
QGCCheckBox 1.0 QGCCheckBox.qml
QGCColoredImage 1.0 QGCColoredImage.qml

2
src/QmlControls/QGroundControl/FlightDisplay/qmldir

@ -21,6 +21,7 @@ GuidedActionPause 1.0 GuidedActionPause.qml @@ -21,6 +21,7 @@ GuidedActionPause 1.0 GuidedActionPause.qml
GuidedActionRTL 1.0 GuidedActionRTL.qml
GuidedValueSlider 1.0 GuidedValueSlider.qml
GuidedActionTakeoff 1.0 GuidedActionTakeoff.qml
GuidedActionGripper 1.0 GuidedActionGripper.qml
GuidedToolStripAction 1.0 GuidedToolStripAction.qml
MultiVehicleList 1.0 MultiVehicleList.qml
PreFlightBatteryCheck 1.0 PreFlightBatteryCheck.qml
@ -36,3 +37,4 @@ VehicleWarnings 1.0 VehicleWarnings.qml @@ -36,3 +37,4 @@ VehicleWarnings 1.0 VehicleWarnings.qml
ObstacleDistanceOverlay 1.0 ObstacleDistanceOverlay.qml
ObstacleDistanceOverlayMap 1.0 ObstacleDistanceOverlayMap.qml
ObstacleDistanceOverlayVideo 1.0 ObstacleDistanceOverlayVideo.qml
GripperMenu 1.0 GripperMenu.qml

Loading…
Cancel
Save