From 49a761e522af108948e4a43472e661bcdc6c0ec3 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 9 May 2016 22:53:21 +0200 Subject: [PATCH 1/5] Clean PX4 autopilot plugin --- src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc | 36 ++------------------------ 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc index 1bc95fb..14b0ea5 100644 --- a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc +++ b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc @@ -35,39 +35,6 @@ /// @brief This is the AutoPilotPlugin implementatin for the MAV_AUTOPILOT_PX4 type. /// @author Don Gagne -enum PX4_CUSTOM_MAIN_MODE { - PX4_CUSTOM_MAIN_MODE_MANUAL = 1, - PX4_CUSTOM_MAIN_MODE_ALTCTL, - PX4_CUSTOM_MAIN_MODE_POSCTL, - PX4_CUSTOM_MAIN_MODE_AUTO, - PX4_CUSTOM_MAIN_MODE_ACRO, - PX4_CUSTOM_MAIN_MODE_OFFBOARD, - PX4_CUSTOM_MAIN_MODE_STABILIZED, - PX4_CUSTOM_MAIN_MODE_RATTITUDE - -}; - -enum PX4_CUSTOM_SUB_MODE_AUTO { - PX4_CUSTOM_SUB_MODE_AUTO_READY = 1, - PX4_CUSTOM_SUB_MODE_AUTO_TAKEOFF, - PX4_CUSTOM_SUB_MODE_AUTO_LOITER, - PX4_CUSTOM_SUB_MODE_AUTO_MISSION, - PX4_CUSTOM_SUB_MODE_AUTO_RTL, - PX4_CUSTOM_SUB_MODE_AUTO_LAND, - PX4_CUSTOM_SUB_MODE_AUTO_RTGS, - PX4_CUSTOM_SUB_MODE_AUTO_FOLLOW_ME -}; - -union px4_custom_mode { - struct { - uint16_t reserved; - uint8_t main_mode; - uint8_t sub_mode; - }; - uint32_t data; - float data_float; -}; - PX4AutoPilotPlugin::PX4AutoPilotPlugin(Vehicle* vehicle, QObject* parent) : AutoPilotPlugin(vehicle, parent), _airframeComponent(NULL), @@ -153,7 +120,8 @@ void PX4AutoPilotPlugin::_parametersReadyPreChecks(bool missingParameters) // Check for older parameter version set // FIXME: Firmware is moving to version stamp parameter set. Once that is complete the version stamp // should be used instead. - if (parameterExists(FactSystem::defaultComponentId, "SENS_GYRO_XOFF")) { + if (parameterExists(FactSystem::defaultComponentId, "SENS_GYRO_XOFF") || + parameterExists(FactSystem::defaultComponentId, "COM_DL_LOSS_EN")) { _incorrectParameterVersion = true; qgcApp()->showMessage("This version of GroundControl can only perform vehicle setup on a newer version of firmware. " "Please perform a Firmware Upgrade if you wish to use Vehicle Setup."); From 0a84814f4b047a37dc8cd72620eee3e38f716a6f Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 9 May 2016 22:54:11 +0200 Subject: [PATCH 2/5] Slider switch: Only accep on sliding --- src/QmlControls/SliderSwitch.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/QmlControls/SliderSwitch.qml b/src/QmlControls/SliderSwitch.qml index 0558081..7ca493e 100644 --- a/src/QmlControls/SliderSwitch.qml +++ b/src/QmlControls/SliderSwitch.qml @@ -55,7 +55,6 @@ Rectangle { MouseArea { id: sliderDragArea anchors.fill: parent - onClicked: _root.accept() drag.target: slider drag.axis: Drag.XAxis drag.minimumX: _border From 064a34c667853ec56b4dcc913b081ea1c45f7979 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 9 May 2016 22:55:17 +0200 Subject: [PATCH 3/5] Firmware plugin: Sequence guided mode correctly, widen modes in which guided support should be available --- src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc b/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc index 712fe70..571bd9c 100644 --- a/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc +++ b/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc @@ -117,8 +117,6 @@ QStringList PX4FirmwarePlugin::flightModes(void) { QStringList flightModes; - // FIXME: fixed-wing/multi-rotor differences? - for (size_t i=0; isetFlightMode(pauseFlightMode); + QGC::SLEEP::msleep(200); + // then tell it to loiter at the current position - // above the takeoff (home) position mavlink_message_t msg; mavlink_command_long_t cmd; @@ -306,19 +303,16 @@ void PX4FirmwarePlugin::guidedModeTakeoff(Vehicle* vehicle, double altitudeRel) return; } - // tell the system first to take off in its internal, - // airframe specific takeoff action - vehicle->setFlightMode(takeoffFlightMode); + MAVLinkProtocol* mavlink = qgcApp()->toolbox()->mavlinkProtocol(); - // then tell it to loiter at the user-selected location - // above the takeoff (home) position + // Set destination altitude mavlink_message_t msg; mavlink_command_long_t cmd; cmd.command = (uint16_t)MAV_CMD_DO_REPOSITION; cmd.confirmation = 0; cmd.param1 = -1.0f; - cmd.param2 = 0.0; + cmd.param2 = 0.0f; cmd.param3 = 0.0f; cmd.param4 = NAN; cmd.param5 = NAN; @@ -327,10 +321,13 @@ void PX4FirmwarePlugin::guidedModeTakeoff(Vehicle* vehicle, double altitudeRel) cmd.target_system = vehicle->id(); cmd.target_component = 0; - MAVLinkProtocol* mavlink = qgcApp()->toolbox()->mavlinkProtocol(); mavlink_msg_command_long_encode(mavlink->getSystemId(), mavlink->getComponentId(), &msg, &cmd); - vehicle->sendMessage(msg); + + QGC::SLEEP::msleep(200); + + // trigger take off + vehicle->setFlightMode(takeoffFlightMode); } void PX4FirmwarePlugin::guidedModeGotoLocation(Vehicle* vehicle, const QGeoCoordinate& gotoCoord) @@ -401,5 +398,6 @@ void PX4FirmwarePlugin::setGuidedMode(Vehicle* vehicle, bool guidedMode) bool PX4FirmwarePlugin::isGuidedMode(const Vehicle* vehicle) const { // Not supported by generic vehicle - return (vehicle->flightMode() == pauseFlightMode); + return (vehicle->flightMode() == pauseFlightMode || vehicle->flightMode() == takeoffFlightMode + || vehicle->flightMode() == landingFlightMode); } From dd940d619b991e4951c1d6a997ed97779aaee891 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 9 May 2016 23:16:03 +0200 Subject: [PATCH 4/5] Readme fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ac22acb..80997a3 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ You need to install Qt like this instead of using packages from say a Linux dist #### Vagrant -A Vagrantfile is provided to build QGroundControl using the [Vagrant](https://www.vagrantup.com/) system. This will produce a native Linux build which can be run in the Vagrant Virtual Machine or on the host machine if it is compatible. +A Vagrantfile is provided to build QGroundControl using the [Vagrant](https://www.vagrantup.com/) system. This will produce a native Linux build which can be run in the Vagrant Virtual Machine or on the host machine if it is compatible. * [Download](https://www.vagrantup.com/downloads.html) Vagrant * [Install](https://www.vagrantup.com/docs/getting-started/) Vagrant From e93bacf0fe38cda08e0238c976c5434ba820b754 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 10 May 2016 08:54:03 +0200 Subject: [PATCH 5/5] Fix unit test --- src/comm/PX4MockLink.params | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/comm/PX4MockLink.params b/src/comm/PX4MockLink.params index a19d5d9..df7aa97 100644 --- a/src/comm/PX4MockLink.params +++ b/src/comm/PX4MockLink.params @@ -98,7 +98,6 @@ 1 50 CBRK_RATE_CTRL 0 6 1 50 CBRK_SUPPLY_CHK 0 6 1 50 COM_DISARM_LAND 0 3 -1 50 COM_DL_LOSS_EN 0 6 1 50 COM_DL_LOSS_T 10 6 1 50 COM_DL_REG_T 0 6 1 50 COM_EF_C2T 5 9 @@ -554,4 +553,4 @@ 1 50 VT_MOT_COUNT 0 6 1 50 VT_POWER_MAX 120 9 1 50 VT_PROP_EFF 0 9 -1 51 COMPONENT_51 51 6 \ No newline at end of file +1 51 COMPONENT_51 51 6