diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc
index 3a3dd070b7199b22b31c2c14fb3748dd04052e53..366817258be621af4112dfb5b2c4aab8ac277cb6 100644
--- a/qgroundcontrol.qrc
+++ b/qgroundcontrol.qrc
@@ -9,6 +9,7 @@
src/ui/toolbar/GPSRTKIndicator.qml
src/ui/toolbar/MessageIndicator.qml
src/ui/toolbar/ModeIndicator.qml
+ src/ui/toolbar/VTOLModeIndicator.qml
src/ui/toolbar/RCRSSIIndicator.qml
src/ui/toolbar/TelemetryRSSIIndicator.qml
src/ui/toolbar/JoystickIndicator.qml
diff --git a/src/FirmwarePlugin/FirmwarePlugin.cc b/src/FirmwarePlugin/FirmwarePlugin.cc
index 879a8c718f188d48737a8197996c4eac565e20a7..f72716de5a20b759bce9a08773c29f2746e782dd 100644
--- a/src/FirmwarePlugin/FirmwarePlugin.cc
+++ b/src/FirmwarePlugin/FirmwarePlugin.cc
@@ -335,6 +335,7 @@ const QVariantList &FirmwarePlugin::toolBarIndicators(const Vehicle* vehicle)
_toolBarIndicatorList.append(QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/RCRSSIIndicator.qml")));
_toolBarIndicatorList.append(QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/BatteryIndicator.qml")));
_toolBarIndicatorList.append(QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/ModeIndicator.qml")));
+ _toolBarIndicatorList.append(QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/VTOLModeIndicator.qml")));
_toolBarIndicatorList.append(QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/ArmedIndicator.qml")));
_toolBarIndicatorList.append(QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/GPSRTKIndicator.qml")));
}
diff --git a/src/FlightDisplay/GuidedActionsController.qml b/src/FlightDisplay/GuidedActionsController.qml
index b704a05799ff44aa5b17a1c652f94b1c85768b79..65a8ad8d518f966752587c460347d73b746c16ea 100644
--- a/src/FlightDisplay/GuidedActionsController.qml
+++ b/src/FlightDisplay/GuidedActionsController.qml
@@ -48,6 +48,7 @@ Item {
readonly property string landAbortTitle: qsTr("Land Abort")
readonly property string setWaypointTitle: qsTr("Set Waypoint")
readonly property string gotoTitle: qsTr("Goto Location")
+ readonly property string vtolTransitionTitle: qsTr("VTOL Transition")
readonly property string armMessage: qsTr("Arm the vehicle.")
readonly property string disarmMessage: qsTr("Disarm the vehicle")
@@ -67,6 +68,8 @@ Item {
readonly property string landAbortMessage: qsTr("Abort the landing sequence.")
readonly property string pauseMessage: qsTr("Pause the vehicle at it's current position.")
readonly property string mvPauseMessage: qsTr("Pause all vehicles at their current position.")
+ readonly property string vtolTransitionFwdMessage: qsTr("Transition VTOL to fixed wing flight.")
+ readonly property string vtolTransitionMRMessage: qsTr("Transition VTOL to multi-rotor flight.")
readonly property int actionRTL: 1
readonly property int actionLand: 2
@@ -87,6 +90,8 @@ Item {
readonly property int actionPause: 17
readonly property int actionMVPause: 18
readonly property int actionMVStartMission: 19
+ readonly property int actionVtolTransitionToFwdFlight: 20
+ readonly property int actionVtolTransitionToMRFlight: 21
property bool showEmergenyStop: !_hideEmergenyStop && _activeVehicle && _vehicleArmed && _vehicleFlying
property bool showArm: _activeVehicle && !_vehicleArmed
@@ -287,6 +292,16 @@ Item {
confirmDialog.message = mvPauseMessage
confirmDialog.hideTrigger = true
break;
+ case actionVtolTransitionToFwdFlight:
+ confirmDialog.title = vtolTransitionTitle
+ confirmDialog.message = vtolTransitionFwdMessage
+ confirmDialog.hideTrigger = true
+ break
+ case actionVtolTransitionToMRFlight:
+ confirmDialog.title = vtolTransitionTitle
+ confirmDialog.message = vtolTransitionMRMessage
+ confirmDialog.hideTrigger = true
+ break
default:
console.warn("Unknown actionCode", actionCode)
return
@@ -359,6 +374,12 @@ Item {
vehicle.pauseVehicle()
}
break
+ case actionVtolTransitionToFwdFlight:
+ _activeVehicle.vtolInFwdFlight = true
+ break
+ case actionVtolTransitionToMRFlight:
+ _activeVehicle.vtolInFwdFlight = false
+ break
default:
console.warn(qsTr("Internal error: unknown actionCode"), actionCode)
break
diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc
index 5786212ab460d3c07497fdc85d05e7d92ea68fd9..41c925eff4fbd7993f2823318cf47b4933598c08 100644
--- a/src/Vehicle/Vehicle.cc
+++ b/src/Vehicle/Vehicle.cc
@@ -108,6 +108,7 @@ Vehicle::Vehicle(LinkInterface* link,
, _autoDisconnect(false)
, _flying(false)
, _landing(false)
+ , _vtolInFwdFlight(false)
, _onboardControlSensorsPresent(0)
, _onboardControlSensorsEnabled(0)
, _onboardControlSensorsHealth(0)
@@ -292,6 +293,7 @@ Vehicle::Vehicle(MAV_AUTOPILOT firmwareType,
, _autoDisconnect(false)
, _flying(false)
, _landing(false)
+ , _vtolInFwdFlight(false)
, _onboardControlSensorsPresent(0)
, _onboardControlSensorsEnabled(0)
, _onboardControlSensorsHealth(0)
@@ -990,6 +992,10 @@ void Vehicle::_handleExtendedSysState(mavlink_message_t& message)
default:
break;
}
+
+ if (vtol()) {
+ setVtolInFwdFlight(extendedState.vtol_state == MAV_VTOL_STATE_FW);
+ }
}
void Vehicle::_handleVibration(mavlink_message_t& message)
@@ -2679,6 +2685,14 @@ void Vehicle::triggerCamera(void)
1.0); // test shot flag
}
+void Vehicle::setVtolInFwdFlight(bool vtolInFwdFlight)
+{
+ if (_vtolInFwdFlight != vtolInFwdFlight) {
+ _vtolInFwdFlight = vtolInFwdFlight;
+ emit vtolInFwdFlightChanged(vtolInFwdFlight);
+ }
+}
+
const char* VehicleGPSFactGroup::_latFactName = "lat";
const char* VehicleGPSFactGroup::_lonFactName = "lon";
const char* VehicleGPSFactGroup::_hdopFactName = "hdop";
diff --git a/src/Vehicle/Vehicle.h b/src/Vehicle/Vehicle.h
index 233f2049f9aadb78ecfd89601f8e44e0abff28b3..61cb4c69b6dc65ff7b96e63a35e766939a2f834f 100644
--- a/src/Vehicle/Vehicle.h
+++ b/src/Vehicle/Vehicle.h
@@ -351,6 +351,7 @@ public:
Q_PROPERTY(QVariantList staticCameraList READ staticCameraList CONSTANT)
Q_PROPERTY(QGCCameraManager* dynamicCameras READ dynamicCameras NOTIFY dynamicCamerasChanged)
Q_PROPERTY(QString hobbsMeter READ hobbsMeter NOTIFY hobbsMeterChanged)
+ Q_PROPERTY(bool vtolInFwdFlight READ vtolInFwdFlight WRITE setVtolInFwdFlight NOTIFY vtolInFwdFlightChanged)
// Vehicle state used for guided control
Q_PROPERTY(bool flying READ flying NOTIFY flyingChanged) ///< Vehicle is flying
@@ -359,7 +360,7 @@ public:
Q_PROPERTY(bool guidedModeSupported READ guidedModeSupported CONSTANT) ///< Guided mode commands are supported by this vehicle
Q_PROPERTY(bool pauseVehicleSupported READ pauseVehicleSupported CONSTANT) ///< Pause vehicle command is supported
Q_PROPERTY(bool orbitModeSupported READ orbitModeSupported CONSTANT) ///< Orbit mode is supported by this vehicle
- Q_PROPERTY(bool takeoffVehicleSupported READ takeoffVehicleSupported CONSTANT) ///< Guided takeoff supported
+ Q_PROPERTY(bool takeoffVehicleSupported READ takeoffVehicleSupported CONSTANT) ///< Guided takeoff supported
Q_PROPERTY(ParameterManager* parameterManager READ parameterManager CONSTANT)
@@ -610,6 +611,7 @@ public:
bool flying () const { return _flying; }
bool landing () const { return _landing; }
bool guidedMode () const;
+ bool vtolInFwdFlight () const { return _vtolInFwdFlight; }
uint8_t baseMode () const { return _base_mode; }
uint32_t customMode () const { return _custom_mode; }
bool isOfflineEditingVehicle () const { return _offlineEditingVehicle; }
@@ -741,6 +743,7 @@ public:
void _setFlying(bool flying);
void _setLanding(bool landing);
+ void setVtolInFwdFlight(bool vtolInFwdFlight);
void _setHomePosition(QGeoCoordinate& homeCoord);
void _setMaxProtoVersion (unsigned version);
@@ -766,6 +769,7 @@ signals:
void flyingChanged(bool flying);
void landingChanged(bool landing);
void guidedModeChanged(bool guidedMode);
+ void vtolInFwdFlightChanged(bool vtolInFwdFlight);
void prearmErrorChanged(const QString& prearmError);
void soloFirmwareChanged(bool soloFirmware);
void unhealthySensorsChanged(void);
@@ -969,6 +973,7 @@ private:
bool _autoDisconnect; ///< true: Automatically disconnect vehicle when last connection goes away or lost heartbeat
bool _flying;
bool _landing;
+ bool _vtolInFwdFlight;
uint32_t _onboardControlSensorsPresent;
uint32_t _onboardControlSensorsEnabled;
uint32_t _onboardControlSensorsHealth;
diff --git a/src/ui/MainWindowInner.qml b/src/ui/MainWindowInner.qml
index f742ab914ce244563805b0b780d7972f574eac85..a344f936996df73adaf391fee2ea8ac015cf262e 100644
--- a/src/ui/MainWindowInner.qml
+++ b/src/ui/MainWindowInner.qml
@@ -292,6 +292,8 @@ Item {
flightView.guidedController.confirmAction(flightView.guidedController.actionDisarm)
}
}
+ onVtolTransitionToFwdFlight: flightView.guidedController.confirmAction(flightView.guidedController.actionVtolTransitionToFwdFlight)
+ onVtolTransitionToMRFlight: flightView.guidedController.confirmAction(flightView.guidedController.actionVtolTransitionToMRFlight)
//-- Entire tool bar area disable on cammand
MouseArea {
diff --git a/src/ui/toolbar/MainToolBar.qml b/src/ui/toolbar/MainToolBar.qml
index 2d2cb219d0819f1877eb71af912b3316b08daf8c..dffaa83e75d05011b7ccd8f091acede2d90cd442 100644
--- a/src/ui/toolbar/MainToolBar.qml
+++ b/src/ui/toolbar/MainToolBar.qml
@@ -34,6 +34,8 @@ Rectangle {
signal showAnalyzeView
signal armVehicle
signal disarmVehicle
+ signal vtolTransitionToFwdFlight
+ signal vtolTransitionToMRFlight
function checkSettingsButton() {
settingsButton.checked = true
diff --git a/src/ui/toolbar/VTOLModeIndicator.qml b/src/ui/toolbar/VTOLModeIndicator.qml
new file mode 100644
index 0000000000000000000000000000000000000000..1e147d36c55dc3a9aab9da64eb45dfe021d1d684
--- /dev/null
+++ b/src/ui/toolbar/VTOLModeIndicator.qml
@@ -0,0 +1,41 @@
+/****************************************************************************
+ *
+ * (c) 2009-2016 QGROUNDCONTROL PROJECT
+ *
+ * QGroundControl is licensed according to the terms in the file
+ * COPYING.md in the root of the source code directory.
+ *
+ ****************************************************************************/
+
+import QtQuick 2.3
+import QtQuick.Controls 1.2
+import QtQuick.Layouts 1.2
+
+import QGroundControl 1.0
+import QGroundControl.Controls 1.0
+import QGroundControl.MultiVehicleManager 1.0
+import QGroundControl.ScreenTools 1.0
+import QGroundControl.Palette 1.0
+
+//-------------------------------------------------------------------------
+//-- VTOL Mode Indicator
+QGCLabel {
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ verticalAlignment: Text.AlignVCenter
+ text: _fwdFlight ? qsTr("VTOL: Fixed Wing") : qsTr("VTOL: Multi-Rotor")
+ font.pointSize: ScreenTools.mediumFontPointSize
+ color: qgcPal.buttonText
+ visible: _activeVehicle ? _activeVehicle.vtol && _activeVehicle.px4Firmware : false
+ width: visible ? implicitWidth : 0
+
+ property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
+ property bool _fwdFlight: _activeVehicle ? _activeVehicle.vtolInFwdFlight : false
+
+ QGCPalette { id: qgcPal }
+
+ QGCMouseArea {
+ fillItem: parent
+ onClicked: _activeVehicle.vtolInFwdFlight ? toolBar.vtolTransitionToMRFlight() : toolBar.vtolTransitionToFwdFlight()
+ }
+}