diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index 501c285c9daecd5cd73d644bf3ea98603eef5588..fca17bab7ba8c0ed1d40ab33be8c0c29a17bd81d 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -337,8 +337,6 @@ FORMS += \ src/ui/configuration/terminalconsole.ui \ src/ui/configuration/SerialSettingsDialog.ui \ src/ui/px4_configuration/QGCPX4AirframeConfig.ui \ - src/ui/px4_configuration/QGCPX4MulticopterConfig.ui \ - src/ui/px4_configuration/QGCPX4SensorCalibration.ui \ src/ui/px4_configuration/PX4RCCalibration.ui \ src/ui/QGCUASFileView.ui \ src/QGCQmlWidgetHolder.ui \ @@ -472,8 +470,6 @@ HEADERS += \ src/ui/QGCPendingParamWidget.h \ src/ui/px4_configuration/QGCPX4AirframeConfig.h \ src/ui/QGCBaseParamWidget.h \ - src/ui/px4_configuration/QGCPX4MulticopterConfig.h \ - src/ui/px4_configuration/QGCPX4SensorCalibration.h \ src/ui/px4_configuration/PX4RCCalibration.h \ src/ui/px4_configuration/RCValueWidget.h \ src/uas/UASManagerInterface.h \ @@ -617,8 +613,6 @@ SOURCES += \ src/ui/QGCPendingParamWidget.cc \ src/ui/px4_configuration/QGCPX4AirframeConfig.cc \ src/ui/QGCBaseParamWidget.cc \ - src/ui/px4_configuration/QGCPX4MulticopterConfig.cc \ - src/ui/px4_configuration/QGCPX4SensorCalibration.cc \ src/ui/px4_configuration/PX4RCCalibration.cc \ src/ui/px4_configuration/RCValueWidget.cc \ src/uas/QGCUASFileManager.cc \ @@ -743,6 +737,7 @@ HEADERS+= \ src/AutoPilotPlugins/PX4/FlightModeConfig.h \ src/AutoPilotPlugins/PX4/AirframeComponent.h \ src/AutoPilotPlugins/PX4/SensorsComponent.h \ + src/AutoPilotPlugins/PX4/SensorsComponentController.h \ src/AutoPilotPlugins/PX4/SafetyComponent.h \ src/AutoPilotPlugins/PX4/PX4ParameterFacts.h \ @@ -754,6 +749,7 @@ SOURCES += \ src/VehicleSetup/PX4Bootloader.cc \ src/VehicleSetup/PX4FirmwareUpgradeThread.cc \ src/AutoPilotPlugins/AutoPilotPluginManager.cc \ + src/AutoPilotPlugins/AutoPilotPlugin.cc \ src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.cc \ src/AutoPilotPlugins/Generic/GenericParameterFacts.cc \ src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc \ @@ -763,6 +759,7 @@ SOURCES += \ src/AutoPilotPlugins/PX4/FlightModeConfig.cc \ src/AutoPilotPlugins/PX4/AirframeComponent.cc \ src/AutoPilotPlugins/PX4/SensorsComponent.cc \ + src/AutoPilotPlugins/PX4/SensorsComponentController.cc \ src/AutoPilotPlugins/PX4/SafetyComponent.cc \ src/AutoPilotPlugins/PX4/PX4ParameterFacts.cc \ diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index 7b070e463feca9a80c9aea92372072c96cbb56d0..c9f460b0524ff54ee64bf259358c474cb3d32b2a 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -245,9 +245,11 @@ src/FactSystem/FactControls/FactLabel.qml src/FactSystem/FactControls/FactTextField.qml src/FactSystem/FactControls/FactCheckBox.qml + src/FactSystem/FactControls/FactComboBox.qml src/QmlControls/qmldir src/QmlControls/SubMenuButton.qml + src/QmlControls/IndicatorButton.qml src/QmlControls/QGCButton.qml src/QmlControls/QGCRadioButton.qml src/QmlControls/QGCCheckBox.qml @@ -266,6 +268,7 @@ src/VehicleSetup/FirmwareUpgrade.qml src/AutoPilotPlugins/PX4/SafetyComponent.qml + src/AutoPilotPlugins/PX4/SensorsComponent.qml src/AutoPilotPlugins/PX4/SafetyComponentSummary.qml src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml diff --git a/src/AutoPilotPlugins/AutoPilotPlugin.cc b/src/AutoPilotPlugins/AutoPilotPlugin.cc new file mode 100644 index 0000000000000000000000000000000000000000..3a0840619a64815ae24e544fc7de33a2ece158d7 --- /dev/null +++ b/src/AutoPilotPlugins/AutoPilotPlugin.cc @@ -0,0 +1,64 @@ +/*===================================================================== + + QGroundControl Open Source Ground Control Station + + (c) 2009 - 2015 QGROUNDCONTROL PROJECT + + This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + + ======================================================================*/ + +/// @file +/// @author Don Gagne + +#include "AutoPilotPlugin.h" + +AutoPilotPlugin::AutoPilotPlugin(UASInterface* uas, QObject* parent) : + QObject(parent), + _uas(uas) +{ + Q_ASSERT(_uas); +} + +void AutoPilotPlugin::refreshAllParameters(void) +{ + Q_ASSERT(_uas); + QGCUASParamManagerInterface* paramMgr = _uas->getParamManager(); + Q_ASSERT(paramMgr); + paramMgr->requestParameterList(); +} + +void AutoPilotPlugin::refreshParameter(const QString& param) +{ + Q_ASSERT(_uas); + QGCUASParamManagerInterface* paramMgr = _uas->getParamManager(); + Q_ASSERT(paramMgr); + + QList compIdList = paramMgr->getComponentForParam(param); + Q_ASSERT(compIdList.count() > 0); + paramMgr->requestParameterUpdate(compIdList[0], param); +} + +void AutoPilotPlugin::refreshParametersPrefix(const QString& paramPrefix) +{ + foreach(QVariant varFact, parameters()) { + Fact* fact = qvariant_cast(varFact); + Q_ASSERT(fact); + if (fact->name().startsWith(paramPrefix)) { + refreshParameter(fact->name()); + } + } +} diff --git a/src/AutoPilotPlugins/AutoPilotPlugin.h b/src/AutoPilotPlugins/AutoPilotPlugin.h index 0fd2e7c196c030b3caf16822bfa324fc58369c53..e0b4a84ddaa1b54aa2a3b5b5b6eb06e8a335e002 100644 --- a/src/AutoPilotPlugins/AutoPilotPlugin.h +++ b/src/AutoPilotPlugins/AutoPilotPlugin.h @@ -48,10 +48,21 @@ class AutoPilotPlugin : public QObject Q_OBJECT public: + AutoPilotPlugin(UASInterface* uas, QObject* parent); + Q_PROPERTY(QVariantMap parameters READ parameters CONSTANT) Q_PROPERTY(QVariantList components READ components CONSTANT) Q_PROPERTY(QUrl setupBackgroundImage READ setupBackgroundImage CONSTANT) + /// Re-request the full set of parameters from the autopilot + Q_INVOKABLE void refreshAllParameters(void); + + /// Request a refresh on the specific parameter + Q_INVOKABLE void refreshParameter(const QString& param); + + // Request a refresh on all parameters that begin with the specified prefix + Q_INVOKABLE void refreshParametersPrefix(const QString& paramPrefix); + // Property accessors virtual const QVariantList& components(void) = 0; virtual const QVariantMap& parameters(void) = 0; @@ -63,6 +74,8 @@ public: /// FIXME: Kind of hacky static void clearStaticData(void); + UASInterface* uas(void) { return _uas; } + signals: /// Signalled when plugin is ready for use void pluginReady(void); @@ -71,6 +84,7 @@ protected: /// All access to AutoPilotPugin objects is through getInstanceForAutoPilotPlugin AutoPilotPlugin(QObject* parent = NULL) : QObject(parent) { } + UASInterface* _uas; }; #endif diff --git a/src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.cc b/src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.cc index 03ebb8e1219f3bdb09a92a830cd90cd32fc9f900..bdd97ef10c27188f1edb18ba81cda7998b89f831 100644 --- a/src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.cc +++ b/src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.cc @@ -27,9 +27,9 @@ #include "GenericAutoPilotPlugin.h" GenericAutoPilotPlugin::GenericAutoPilotPlugin(UASInterface* uas, QObject* parent) : - AutoPilotPlugin(parent) + AutoPilotPlugin(uas, parent) { - Q_UNUSED(uas); + Q_ASSERT(uas); _parameterFacts = new GenericParameterFacts(uas, this); Q_CHECK_PTR(_parameterFacts); diff --git a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc index 183af85137c6aa139fc7902a0560f1f74b467ecf..c5aded6dea2a19a791bbd5c3913621acb31cc65b 100644 --- a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc +++ b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc @@ -26,6 +26,8 @@ #include "UASManager.h" #include "QGCUASParamManagerInterface.h" #include "PX4ParameterFacts.h" +#include "SensorsComponentController.h" +#include "QGCMessageBox.h" /// @file /// @brief This is the AutoPilotPlugin implementatin for the MAV_AUTOPILOT_PX4 type. @@ -61,21 +63,21 @@ union px4_custom_mode { }; PX4AutoPilotPlugin::PX4AutoPilotPlugin(UASInterface* uas, QObject* parent) : - AutoPilotPlugin(parent), - _uas(uas), + AutoPilotPlugin(uas, parent), _parameterFacts(NULL), _airframeComponent(NULL), _radioComponent(NULL), _flightModesComponent(NULL), _sensorsComponent(NULL), - _safetyComponent(NULL) + _safetyComponent(NULL), + _incorrectParameterVersion(false) { Q_ASSERT(uas); _parameterFacts = new PX4ParameterFacts(uas, this); Q_CHECK_PTR(_parameterFacts); - connect(_parameterFacts, &PX4ParameterFacts::factsReady, this, &PX4AutoPilotPlugin::pluginReady); + connect(_parameterFacts, &PX4ParameterFacts::factsReady, this, &PX4AutoPilotPlugin::_checkForIncorrectParameterVersion); PX4ParameterFacts::loadParameterFactMetaData(); } @@ -191,7 +193,7 @@ bool PX4AutoPilotPlugin::pluginIsReady(void) const const QVariantList& PX4AutoPilotPlugin::components(void) { - if (_components.count() == 0) { + if (_components.count() == 0 && !_incorrectParameterVersion) { Q_ASSERT(_uas); _airframeComponent = new AirframeComponent(_uas, this); @@ -227,3 +229,13 @@ QUrl PX4AutoPilotPlugin::setupBackgroundImage(void) { return QUrl::fromUserInput("qrc:/qml/px4fmu_2.x.png"); } + +void PX4AutoPilotPlugin::_checkForIncorrectParameterVersion(void) +{ + if (parameters().contains("SENS_GYRO_XOFF")) { + _incorrectParameterVersion = true; + QGCMessageBox::warning(tr("Setup"), tr("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.")); + } + emit pluginReady(); +} diff --git a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h index 83f571b9ccee9e346b3692d4b48ddd90018cb110..92e1499c033d6e8f18606bf9e1c2f90ea1cc521c 100644 --- a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h +++ b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h @@ -65,8 +65,10 @@ public: SensorsComponent* sensorsComponent(void) { return _sensorsComponent; } SafetyComponent* safetyComponent(void) { return _safetyComponent; } +private slots: + void _checkForIncorrectParameterVersion(void); + private: - UASInterface* _uas; PX4ParameterFacts* _parameterFacts; QVariantList _components; AirframeComponent* _airframeComponent; @@ -74,6 +76,7 @@ private: FlightModesComponent* _flightModesComponent; SensorsComponent* _sensorsComponent; SafetyComponent* _safetyComponent; + bool _incorrectParameterVersion; ///< true: parameter version incorrect, setup not allowed }; #endif diff --git a/src/AutoPilotPlugins/PX4/SensorsComponent.cc b/src/AutoPilotPlugins/PX4/SensorsComponent.cc index 1f2088fa4e5fc628ba69696876f1c0de1f9f3ec9..e11b0222997e8f48ced3c599e69866452df0477f 100644 --- a/src/AutoPilotPlugins/PX4/SensorsComponent.cc +++ b/src/AutoPilotPlugins/PX4/SensorsComponent.cc @@ -25,25 +25,21 @@ /// @author Don Gagne #include "SensorsComponent.h" -#include "QGCPX4SensorCalibration.h" #include "PX4AutoPilotPlugin.h" +#include "QGCQmlWidgetHolder.h" +#include "SensorsComponentController.h" // These two list must be kept in sync /// @brief Parameters which signal a change in setupComplete state -static const char* triggerParamsV1[] = { "SENS_MAG_XOFF", "SENS_GYRO_XOFF", "SENS_ACC_XOFF", NULL }; -static const char* triggerParamsV2[] = { "CAL_MAG0_ID", "CAL_GYRO0_ID", "CAL_ACC0_ID", NULL }; -static const char* triggerParamsV1FixedWing[] = { "SENS_MAG_XOFF", "SENS_GYRO_XOFF", "SENS_ACC_XOFF", "SENS_DPRES_OFF", NULL }; -static const char* triggerParamsV2FixedWing[] = { "CAL_MAG0_ID", "CAL_GYRO0_ID", "CAL_ACC0_ID", "SENS_DPRES_OFF", NULL }; +static const char* triggerParams[] = { "CAL_MAG0_ID", "CAL_GYRO0_ID", "CAL_ACC0_ID", NULL }; +static const char* triggerParamsFixedWing[] = { "CAL_MAG0_ID", "CAL_GYRO0_ID", "CAL_ACC0_ID", "SENS_DPRES_OFF", NULL }; SensorsComponent::SensorsComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) : PX4Component(uas, autopilot, parent), _name(tr("Sensors")) { - // Determine what set of parameters are available. This is a temporary hack for now. Will need real parameter - // mapping in the future. - QVariant value; - _paramsV1 = _paramMgr->getParameterValue(_paramMgr->getDefaultComponentId(), "SENS_MAG_XOFF", value); + } QString SensorsComponent::name(void) const @@ -104,29 +100,31 @@ QString SensorsComponent::setupStateDescription(void) const const char** SensorsComponent::setupCompleteChangedTriggerList(void) const { - if (_uas->getSystemType() == MAV_TYPE_FIXED_WING) { - return _paramsV1 ? triggerParamsV1FixedWing : triggerParamsV2FixedWing; - } else { - return _paramsV1 ? triggerParamsV1 : triggerParamsV2; - } + return _uas->getSystemType() == MAV_TYPE_FIXED_WING ? triggerParamsFixedWing : triggerParams; } QStringList SensorsComponent::paramFilterList(void) const { QStringList list; - if (_paramsV1) { - list << "SENS_*"; - } else { - list << "CAL_*"; - } + list << "SENS_*" << "CAL_*"; return list; } QWidget* SensorsComponent::setupWidget(void) const { - return new QGCPX4SensorCalibration; + QGCQmlWidgetHolder* holder = new QGCQmlWidgetHolder(); + Q_CHECK_PTR(holder); + + holder->setAutoPilot(_autopilot); + + SensorsComponentController* controller = new SensorsComponentController(_autopilot, holder); + holder->setContextPropertyObject("controller", controller); + + holder->setSource(QUrl::fromUserInput("qrc:/qml/SensorsComponent.qml")); + + return holder; } QUrl SensorsComponent::summaryQmlSource(void) const diff --git a/src/AutoPilotPlugins/PX4/SensorsComponent.h b/src/AutoPilotPlugins/PX4/SensorsComponent.h index 87f8e4d101075f7b730fbbbe5f0c460e20e21b3b..00b0d6e97f2a6c34649f7087d0af161bcd92216a 100644 --- a/src/AutoPilotPlugins/PX4/SensorsComponent.h +++ b/src/AutoPilotPlugins/PX4/SensorsComponent.h @@ -55,7 +55,6 @@ public: private: const QString _name; QVariantList _summaryItems; - bool _paramsV1; }; #endif diff --git a/src/AutoPilotPlugins/PX4/SensorsComponent.qml b/src/AutoPilotPlugins/PX4/SensorsComponent.qml new file mode 100644 index 0000000000000000000000000000000000000000..088927f4ba637ac467603d202e749b1c64eecc62 --- /dev/null +++ b/src/AutoPilotPlugins/PX4/SensorsComponent.qml @@ -0,0 +1,203 @@ +import QtQuick 2.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 + +import QGroundControl.FactSystem 1.0 +import QGroundControl.FactControls 1.0 +import QGroundControl.Palette 1.0 +import QGroundControl.Controls 1.0 + +Rectangle { + property QGCPalette qgcPal: QGCPalette { colorGroupEnabled: true } + + readonly property int rotationColumnWidth: 200 + readonly property var rotations: [ + "ROTATION_NONE", + "ROTATION_YAW_45", + "ROTATION_YAW_90", + "ROTATION_YAW_135", + "ROTATION_YAW_180", + "ROTATION_YAW_225", + "ROTATION_YAW_270", + "ROTATION_YAW_315", + "ROTATION_ROLL_180", + "ROTATION_ROLL_180_YAW_45", + "ROTATION_ROLL_180_YAW_90", + "ROTATION_ROLL_180_YAW_135", + "ROTATION_PITCH_180", + "ROTATION_ROLL_180_YAW_225", + "ROTATION_ROLL_180_YAW_270", + "ROTATION_ROLL_180_YAW_315", + "ROTATION_ROLL_90", + "ROTATION_ROLL_90_YAW_45", + "ROTATION_ROLL_90_YAW_90", + "ROTATION_ROLL_90_YAW_135", + "ROTATION_ROLL_270", + "ROTATION_ROLL_270_YAW_45", + "ROTATION_ROLL_270_YAW_90", + "ROTATION_ROLL_270_YAW_135", + "ROTATION_PITCH_90", + "ROTATION_PITCH_270", + "ROTATION_ROLL_270_YAW_270" + ] + + width: 600 + height: 600 + color: qgcPal.window + + // We use this bogus loader just so we can get an onLoaded signal to hook to in order to + // finish controller initialization. + Component { + id: loadSignal; + Item { } + } + Loader { + sourceComponent: loadSignal + onLoaded: controller.statusLog = statusTextArea + } + + Column { + anchors.fill: parent + + QGCLabel { + text: "SENSORS CONFIG" + font.pointSize: 20 + } + + Item { height: 20; width: 10 } // spacer + + Item { + readonly property int calibrationAreaHeight: 300 + + width: parent.width + height: calibrationAreaHeight + + TextArea { + id: statusTextArea + width: parent.width - rotationColumnWidth + height: parent.height + readOnly: true + frameVisible: false + text: qsTr("Sensor config is a work in progress which currently supports textual instructions only. Updated visuals coming soon.") + + style: TextAreaStyle { + textColor: qgcPal.text + backgroundColor: qgcPal.windowShade + } + } + + Column { + // Compass rotation parameter < 0 indicates either internal compass, or no compass. So in + // both those cases we do not show a rotation combo. + property bool showCompass0: autopilot.parameters["CAL_MAG0_ROT"].value >= 0 + property bool showCompass1: autopilot.parameters["CAL_MAG1_ROT"].value >= 0 + property bool showCompass2: autopilot.parameters["CAL_MAG2_ROT"].value >= 0 + + x: parent.width - rotationColumnWidth + + QGCLabel { text: "Autpilot Orientation" } + + FactComboBox { + width: rotationColumnWidth; + model: rotations + fact: autopilot.parameters["SENS_BOARD_ROT"] + } + + // Compass 0 rotation + Component { + id: compass0ComponentLabel + + QGCLabel { text: "Compass Orientation" } + } + Component { + id: compass0ComponentCombo + + FactComboBox { + width: rotationColumnWidth + model: rotations + fact: autopilot.parameters["CAL_MAG0_ROT"] + } + } + Loader { sourceComponent: parent.showCompass0 ? compass0ComponentLabel : null } + Loader { sourceComponent: parent.showCompass0 ? compass0ComponentCombo : null } + + // Compass 1 rotation + Component { + id: compass1ComponentLabel + + QGCLabel { text: "Compass 1 Orientation" } + } + Component { + id: compass1ComponentCombo + + FactComboBox { + width: rotationColumnWidth + model: rotations + fact: autopilot.parameters["CAL_MAG1_ROT"] + } + } + Loader { sourceComponent: parent.showCompass1 ? compass1ComponentLabel : null } + Loader { sourceComponent: parent.showCompass1 ? compass1ComponentCombo : null } + + // Compass 2 rotation + Component { + id: compass2ComponentLabel + + QGCLabel { text: "Compass 2 Orientation" } + } + Component { + id: compass2ComponentCombo + + FactComboBox { + width: rotationColumnWidth + model: rotations + fact: autopilot.parameters["CAL_MAG2_ROT"] + } + } + Loader { sourceComponent: parent.showCompass2 ? compass2ComponentLabel : null } + Loader { sourceComponent: parent.showCompass2 ? compass2ComponentCombo : null } + } + } + + Item { height: 20; width: 10 } // spacer + + Row { + readonly property int buttonWidth: 120 + + spacing: 20 + + QGCLabel { text: "Calibrate:"; anchors.baseline: firstButton.baseline } + + IndicatorButton { + id: firstButton + width: parent.buttonWidth + text: "Compass" + indicatorGreen: autopilot.parameters["CAL_MAG0_ID"].value != 0 + onClicked: controller.calibrateCompass() + } + + IndicatorButton { + width: parent.buttonWidth + text: "Gyroscope" + indicatorGreen: autopilot.parameters["CAL_GYRO0_ID"].value != 0 + onClicked: controller.calibrateGyro() + } + + IndicatorButton { + width: parent.buttonWidth + text: "Acceleromter" + indicatorGreen: autopilot.parameters["CAL_ACC0_ID"].value != 0 + onClicked: controller.calibrateAccel() + } + + IndicatorButton { + width: parent.buttonWidth + text: "Airspeed" + visible: controller.fixedWing + indicatorGreen: autopilot.parameters["SENS_DPRES_OFF"].value != 0 + onClicked: controller.calibrateAirspeed() + } + } + } +} + diff --git a/src/AutoPilotPlugins/PX4/SensorsComponentController.cc b/src/AutoPilotPlugins/PX4/SensorsComponentController.cc new file mode 100644 index 0000000000000000000000000000000000000000..c887bbd516f7885038d5a4dd9d7d5fe34acafbf6 --- /dev/null +++ b/src/AutoPilotPlugins/PX4/SensorsComponentController.cc @@ -0,0 +1,141 @@ +/*===================================================================== + + QGroundControl Open Source Ground Control Station + + (c) 2009, 2015 QGROUNDCONTROL PROJECT + + This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + + ======================================================================*/ + +/// @file +/// @author Don Gagne + +#include "SensorsComponentController.h" +#include "QGCMAVLink.h" +#include "UASManager.h" + +#include +#include + +SensorsComponentController::SensorsComponentController(AutoPilotPlugin* autopilot, QObject* parent) : + QObject(parent), + _autopilot(autopilot) +{ + Q_ASSERT(autopilot); +} + +/// Appends the specified text to the status log area in the ui +void SensorsComponentController::_appendStatusLog(const QString& text) +{ + Q_ASSERT(_statusLog); + + QVariant returnedValue; + QVariant varText = text; + QMetaObject::invokeMethod(_statusLog, + "append", + Q_RETURN_ARG(QVariant, returnedValue), + Q_ARG(QVariant, varText)); +} + +void SensorsComponentController::calibrateGyro(void) +{ + _beginTextLogging(); + + UASInterface* uas = _autopilot->uas(); + Q_ASSERT(uas); + uas->executeCommand(MAV_CMD_PREFLIGHT_CALIBRATION, 1, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0); +} + +void SensorsComponentController::calibrateCompass(void) +{ + _beginTextLogging(); + + UASInterface* uas = _autopilot->uas(); + Q_ASSERT(uas); + uas->executeCommand(MAV_CMD_PREFLIGHT_CALIBRATION, 1, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0); +} + +void SensorsComponentController::calibrateAccel(void) +{ + _beginTextLogging(); + + UASInterface* uas = _autopilot->uas(); + Q_ASSERT(uas); + uas->executeCommand(MAV_CMD_PREFLIGHT_CALIBRATION, 1, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0); +} + +void SensorsComponentController::calibrateAirspeed(void) +{ + _beginTextLogging(); + + UASInterface* uas = _autopilot->uas(); + Q_ASSERT(uas); + uas->executeCommand(MAV_CMD_PREFLIGHT_CALIBRATION, 1, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0); +} + +void SensorsComponentController::_beginTextLogging(void) +{ + UASInterface* uas = _autopilot->uas(); + Q_ASSERT(uas); + connect(uas, &UASInterface::textMessageReceived, this, &SensorsComponentController::_handleUASTextMessage); +} + +void SensorsComponentController::_handleUASTextMessage(int uasId, int compId, int severity, QString text) +{ + Q_UNUSED(compId); + Q_UNUSED(severity); + + UASInterface* uas = _autopilot->uas(); + Q_ASSERT(uas); + if (uasId != uas->getUASID()) { + return; + } + + QStringList ignorePrefixList; + ignorePrefixList << "[cmd]" << "[mavlink pm]" << "[ekf check]"; + foreach (QString ignorePrefix, ignorePrefixList) { + if (text.startsWith(ignorePrefix)) { + return; + } + } + + _appendStatusLog(text); + + if (text.endsWith(" calibration: done") || text.endsWith(" calibration: failed")) { + _refreshParams(); + } +} + +void SensorsComponentController::_refreshParams(void) +{ +#if 0 + // FIXME: Not sure if firmware issue yet + _autopilot->refreshParametersPrefix("CAL_"); + _autopilot->refreshParametersPrefix("SENS_"); +#else + // Sending too many parameter requests like above doesn't seem to work. So for now, + // ask for everything back + _autopilot->refreshAllParameters(); +#endif +} + +bool SensorsComponentController::fixedWing(void) +{ + UASInterface* uas = _autopilot->uas(); + Q_ASSERT(uas); + return uas->getSystemType() == MAV_TYPE_FIXED_WING; +} diff --git a/src/AutoPilotPlugins/PX4/SensorsComponentController.h b/src/AutoPilotPlugins/PX4/SensorsComponentController.h new file mode 100644 index 0000000000000000000000000000000000000000..962735bef6072a90abaef151d51093f93ef36107 --- /dev/null +++ b/src/AutoPilotPlugins/PX4/SensorsComponentController.h @@ -0,0 +1,71 @@ +/*===================================================================== + + QGroundControl Open Source Ground Control Station + + (c) 2009, 2015 QGROUNDCONTROL PROJECT + + This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + + ======================================================================*/ + +/// @file +/// @author Don Gagne + +#ifndef SENSORSCOMPONENTCONTROLLER_H +#define SENSORSCOMPONENTCONTROLLER_H + +#include +#include + +#include "UASInterface.h" +#include "AutoPilotPlugin.h" + +/// Sensors Component MVC Controller for SensorsComponent.qml. +class SensorsComponentController : public QObject +{ + Q_OBJECT + +public: + SensorsComponentController(AutoPilotPlugin* autopilot, QObject* parent = NULL); + + Q_PROPERTY(bool fixedWing READ fixedWing CONSTANT) + + /// TextArea for log output + Q_PROPERTY(QQuickItem* statusLog MEMBER _statusLog) + + Q_INVOKABLE void calibrateCompass(void); + Q_INVOKABLE void calibrateGyro(void); + Q_INVOKABLE void calibrateAccel(void); + Q_INVOKABLE void calibrateAirspeed(void); + + bool fixedWing(void); + +signals: + void bogusNotify(void); + +private slots: + void _handleUASTextMessage(int uasId, int compId, int severity, QString text); + +private: + void _beginTextLogging(void); + void _appendStatusLog(const QString& text); + void _refreshParams(void); + + QQuickItem* _statusLog; ///< Status log TextArea Qml control + AutoPilotPlugin* _autopilot; +}; + +#endif diff --git a/src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml b/src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml index 2c1f31420f2e88c3e650709b3c62fd163b6f157c..5148b38c8fdd7955b40f5cd5bac57fa568d21bd3 100644 --- a/src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml +++ b/src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml @@ -20,8 +20,7 @@ Column { QGCLabel { horizontalAlignment: Text.AlignRight; width: parent.width - compass.contentWidth; - property bool setupRequiredValue: autopilot.parameters["SENS_MAG_XOFF"] ? autopilot.parameters["SENS_MAG_XOFF"].value : autopilot.parameters["CAL_MAG0_ID"].value - text: setupRequiredValue == 0 ? "Setup required" : "Ready" + text: autopilot.parameters["CAL_MAG0_ID"].value == 0 ? "Setup required" : "Ready" } } @@ -32,8 +31,7 @@ Column { QGCLabel { horizontalAlignment: Text.AlignRight; width: parent.width - gyro.contentWidth; - property bool setupRequiredValue: autopilot.parameters["SENS_GYRO_XOFF"] ? autopilot.parameters["SENS_GYRO_XOFF"].value : autopilot.parameters["CAL_GYRO0_ID"].value - text: setupRequiredValue == 0 ? "Setup required" : "Ready" + text: autopilot.parameters["CAL_GYRO0_ID"].value == 0 ? "Setup required" : "Ready" } } @@ -44,8 +42,7 @@ Column { QGCLabel { horizontalAlignment: Text.AlignRight; width: parent.width - accel.contentWidth; - property bool setupRequiredValue: autopilot.parameters["SENS_ACC_XOFF"] ? autopilot.parameters["SENS_ACC_XOFF"].value : autopilot.parameters["CAL_ACC0_ID"].value - text: setupRequiredValue == 0 ? "Setup required" : "Ready" + text: autopilot.parameters["CAL_ACC0_ID"].value == 0 ? "Setup required" : "Ready" } } } diff --git a/src/AutoPilotPlugins/PX4/SensorsComponentSummaryFixedWing.qml b/src/AutoPilotPlugins/PX4/SensorsComponentSummaryFixedWing.qml index 624e5e9f9506bf049f1e0292f31d5e597c62051c..77a6c53d05c268d139f35f6f3be3037aa45d695c 100644 --- a/src/AutoPilotPlugins/PX4/SensorsComponentSummaryFixedWing.qml +++ b/src/AutoPilotPlugins/PX4/SensorsComponentSummaryFixedWing.qml @@ -20,8 +20,7 @@ Column { QGCLabel { horizontalAlignment: Text.AlignRight; width: parent.width - compass.contentWidth; - property bool setupRequiredValue: autopilot.parameters["SENS_MAG_XOFF"] ? autopilot.parameters["SENS_MAG_XOFF"].value : autopilot.parameters["CAL_MAG0_ID"].value - text: setupRequiredValue == 0 ? "Setup required" : "Ready" + text: autopilot.parameters["CAL_MAG0_ID"].value == 0 ? "Setup required" : "Ready" } } @@ -32,8 +31,7 @@ Column { QGCLabel { horizontalAlignment: Text.AlignRight; width: parent.width - gyro.contentWidth; - property bool setupRequiredValue: autopilot.parameters["SENS_GYRO_XOFF"] ? autopilot.parameters["SENS_GYRO_XOFF"].value : autopilot.parameters["CAL_GYRO0_ID"].value - text: setupRequiredValue == 0 ? "Setup required" : "Ready" + text: autopilot.parameters["CAL_GYRO0_ID"].value == 0 ? "Setup required" : "Ready" } } @@ -44,8 +42,7 @@ Column { QGCLabel { horizontalAlignment: Text.AlignRight; width: parent.width - accel.contentWidth; - property bool setupRequiredValue: autopilot.parameters["SENS_ACC_XOFF"] ? autopilot.parameters["SENS_ACC_XOFF"].value : autopilot.parameters["CAL_ACC0_ID"].value - text: setupRequiredValue == 0 ? "Setup required" : "Ready" + text: autopilot.parameters["CAL_ACC0_ID"].value == 0 ? "Setup required" : "Ready" } } diff --git a/src/FactSystem/Fact.cc b/src/FactSystem/Fact.cc index b4de94768681ef2d271269a69bf5bad343342b7e..860fd1c5ee72f38390e93b833522ae4b08d9d675 100644 --- a/src/FactSystem/Fact.cc +++ b/src/FactSystem/Fact.cc @@ -28,12 +28,13 @@ #include -Fact::Fact(QString name, QObject* parent) : +Fact::Fact(QString name, FactMetaData::ValueType_t type, QObject* parent) : QObject(parent), _name(name), + _type(type), _metaData(NULL) { - _value = ""; + _value = 0; } void Fact::setValue(const QVariant& value) @@ -72,8 +73,7 @@ QVariant Fact::defaultValue(void) FactMetaData::ValueType_t Fact::type(void) { - Q_ASSERT(_metaData); - return _metaData->type; + return _type; } QString Fact::shortDescription(void) diff --git a/src/FactSystem/Fact.h b/src/FactSystem/Fact.h index 7d601a639a859741a80d9062973560e63648b18e..7d1f6943be286693564269e86ae3d8e5536a8516 100644 --- a/src/FactSystem/Fact.h +++ b/src/FactSystem/Fact.h @@ -57,7 +57,7 @@ class Fact : public QObject Q_ENUMS(FactMetaData::ValueType_t) public: - Fact(QString name = "", QObject* parent = NULL); + Fact(QString name = "", FactMetaData::ValueType_t type = FactMetaData::valueTypeInt32, QObject* parent = NULL); // Property system methods @@ -111,9 +111,10 @@ signals: void _containerValueChanged(QVariant& value); private: - QString _name; ///< Fact name - QVariant _value; ///< Fact value - FactMetaData* _metaData; ///< FactMetaData object for Fact + QString _name; + QVariant _value; + FactMetaData::ValueType_t _type; + FactMetaData* _metaData; }; #endif \ No newline at end of file diff --git a/src/FactSystem/FactControls/FactComboBox.qml b/src/FactSystem/FactControls/FactComboBox.qml new file mode 100644 index 0000000000000000000000000000000000000000..77ed1eb98685b4760d79f04a392f6c33362288d4 --- /dev/null +++ b/src/FactSystem/FactControls/FactComboBox.qml @@ -0,0 +1,13 @@ +import QtQuick 2.2 +import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.2 + +import QGroundControl.FactSystem 1.0 +import QGroundControl.Palette 1.0 +import QGroundControl.Controls 1.0 + +QGCComboBox { + property Fact fact: Fact { value: 0 } + currentIndex: fact.value + onActivated: fact.value = index +} diff --git a/src/FactSystem/FactControls/qmldir b/src/FactSystem/FactControls/qmldir index 2b43b1fedae1d92d1d46c0b0a0b3281b142dc6dc..9a6de26b5864ea5843239ab83e9b11f3bb12adf6 100644 --- a/src/FactSystem/FactControls/qmldir +++ b/src/FactSystem/FactControls/qmldir @@ -1,4 +1,6 @@ Module QGroundControl.FactControls + FactLabel 1.0 FactLabel.qml FactTextField 1.0 FactTextField.qml -FactCheckBox 1.0 FactCheckBox.qml \ No newline at end of file +FactCheckBox 1.0 FactCheckBox.qml +FactComboBox 1.0 FactComboBox.qml \ No newline at end of file diff --git a/src/FactSystem/FactLoader.cc b/src/FactSystem/FactLoader.cc index f13156b30bddcdaad1f883d422234b3f6e23bc2e..903fb44a903be29ce452c65cf738c508a902a55f 100644 --- a/src/FactSystem/FactLoader.cc +++ b/src/FactSystem/FactLoader.cc @@ -51,9 +51,8 @@ FactLoader::FactLoader(UASInterface* uas, QObject* parent) : // We need to know when the param mgr is done sending the initial set of paramters connect(_paramMgr, SIGNAL(parameterListUpToDate()), this, SLOT(_paramMgrParameterListUpToDate())); - // We track parameters changes to keep Facts up to date. UASInterface::parameterChanged has multiple overrides so we need to - // use SIGNAL/SLOT style connect - connect(uas, SIGNAL(parameterChanged(int, int, QString, QVariant)), this, SLOT(_parameterChanged(int, int, QString, QVariant))); + // We track parameters changes to keep Facts up to date. + connect(uas, &UASInterface::parameterUpdate, this, &FactLoader::_parameterUpdate); } FactLoader::~FactLoader() @@ -65,10 +64,8 @@ FactLoader::~FactLoader() _mapFact2ParameterName.clear(); } -/// Connected to QGCUASParmManager::parameterChanged -/// -/// When a new parameter is seen it is added to the system. If the parameter is already known it is updated. -void FactLoader::_parameterChanged(int uas, int component, QString parameterName, QVariant value) +/// Called whenever a parameter is updated or first seen. +void FactLoader::_parameterUpdate(int uas, int component, QString parameterName, int mavType, QVariant value) { // Is this for our uas? if (uas != _uasId) { @@ -86,7 +83,39 @@ void FactLoader::_parameterChanged(int uas, int component, QString parameterName if (!_mapParameterName2Variant.contains(parameterName)) { qCDebug(FactLoaderLog) << "Adding new fact" << parameterName; - Fact* fact = new Fact(parameterName, this); + FactMetaData::ValueType_t factType; + switch (mavType) { + case MAV_PARAM_TYPE_UINT8: + factType = FactMetaData::valueTypeUint8; + break; + case MAV_PARAM_TYPE_INT8: + factType = FactMetaData::valueTypeUint8; + break; + case MAV_PARAM_TYPE_UINT16: + factType = FactMetaData::valueTypeUint16; + break; + case MAV_PARAM_TYPE_INT16: + factType = FactMetaData::valueTypeInt16; + break; + case MAV_PARAM_TYPE_UINT32: + factType = FactMetaData::valueTypeUint32; + break; + case MAV_PARAM_TYPE_INT32: + factType = FactMetaData::valueTypeInt32; + break; + case MAV_PARAM_TYPE_REAL32: + factType = FactMetaData::valueTypeFloat; + break; + case MAV_PARAM_TYPE_REAL64: + factType = FactMetaData::valueTypeDouble; + break; + default: + factType = FactMetaData::valueTypeInt32; + qCritical() << "Unsupported fact type" << mavType; + break; + } + + Fact* fact = new Fact(parameterName, factType, this); setMetaData = true; _mapParameterName2Variant[parameterName] = QVariant::fromValue(fact); @@ -169,39 +198,6 @@ void FactLoader::_paramMgrParameterListUpToDate(void) void FactLoader::_addMetaDataToFact(Fact* fact) { - // Create generic meta data based on value variant type - - FactMetaData::ValueType_t factType = FactMetaData::valueTypeInt32; // init to in32 to silence compiler warning - - switch ((QMetaType::Type)fact->value().type()) { - case QMetaType::Int: - factType = FactMetaData::valueTypeInt32; - break; - - case QMetaType::UInt: - factType = FactMetaData::valueTypeUint32; - break; - - case QMetaType::Double: - factType = FactMetaData::valueTypeDouble; - - case QMetaType::Short: - factType = FactMetaData::valueTypeInt16; - break; - - case QMetaType::UShort: - factType = FactMetaData::valueTypeUint16; - break; - - case QMetaType::Float: - factType = FactMetaData::valueTypeFloat; - break; - - default: - qWarning() << fact->name() << "Invalid variant type" << fact->value().type(); - break; - } - FactMetaData* metaData = new FactMetaData(this); - metaData->initFromTypeOnly(factType); + metaData->initFromTypeOnly(fact->type()); } diff --git a/src/FactSystem/FactLoader.h b/src/FactSystem/FactLoader.h index 699a1fbe0636c158904234d971783c97f73b201f..851035a9186649f1a546aff82872c5783c1dedc0 100644 --- a/src/FactSystem/FactLoader.h +++ b/src/FactSystem/FactLoader.h @@ -72,7 +72,7 @@ protected: virtual void _addMetaDataToFact(Fact* fact); private slots: - void _parameterChanged(int uas, int component, QString parameterName, QVariant value); + void _parameterUpdate(int uas, int component, QString parameterName, int mavType, QVariant value); void _valueUpdated(QVariant value); void _paramMgrParameterListUpToDate(void); diff --git a/src/FactSystem/FactMetaData.cc b/src/FactSystem/FactMetaData.cc index 1b4de8954b025362f1e1d6e40fa7de8562dc0d50..5de76f6a68a1ed4b8421b29bb2f55c8ac9e76fc4 100644 --- a/src/FactSystem/FactMetaData.cc +++ b/src/FactSystem/FactMetaData.cc @@ -37,6 +37,4 @@ FactMetaData::FactMetaData(QObject* parent) : void FactMetaData::initFromTypeOnly(ValueType_t initType) { type = initType; - - // FIXME: NYI } diff --git a/src/QGCQmlWidgetHolder.cpp b/src/QGCQmlWidgetHolder.cpp index 844ac51328c963a011ef8c127ccd0a81d6c51327..a73ad18f8149710cb6c619f95829d47db69d576b 100644 --- a/src/QGCQmlWidgetHolder.cpp +++ b/src/QGCQmlWidgetHolder.cpp @@ -40,10 +40,15 @@ QGCQmlWidgetHolder::~QGCQmlWidgetHolder() void QGCQmlWidgetHolder::setAutoPilot(AutoPilotPlugin* autoPilot) { - _ui.qmlWidget->rootContext()->setContextProperty("autopilot", autoPilot); + setContextPropertyObject("autopilot", autoPilot); } bool QGCQmlWidgetHolder::setSource(const QUrl& qmlUrl) { return _ui.qmlWidget->setSource(qmlUrl); } + +void QGCQmlWidgetHolder::setContextPropertyObject(const QString& name, QObject* object) +{ + _ui.qmlWidget->rootContext()->setContextProperty(name, object); +} diff --git a/src/QGCQmlWidgetHolder.h b/src/QGCQmlWidgetHolder.h index 378e501994399ec0bc2953d2b95c0661bf075243..49dbe63c05028db1bf7e9143f3c5401d824b6646 100644 --- a/src/QGCQmlWidgetHolder.h +++ b/src/QGCQmlWidgetHolder.h @@ -52,6 +52,8 @@ public: /// Sets the QML into the control. Will display errors message box if error occurs loading source. /// @return true: source loaded, false: source not loaded, errors occured bool setSource(const QUrl& qmlUrl); + + void setContextPropertyObject(const QString& name, QObject* object); private: Ui::QGCQmlWidgetHolder _ui; diff --git a/src/QmlControls/IndicatorButton.qml b/src/QmlControls/IndicatorButton.qml new file mode 100644 index 0000000000000000000000000000000000000000..f54b7bd0a79d52f221aaed8f471fabdc6941e9bf --- /dev/null +++ b/src/QmlControls/IndicatorButton.qml @@ -0,0 +1,24 @@ +import QtQuick 2.2 +import QtQuick.Controls 1.2 + +import QGroundControl.Controls 1.0 +import QGroundControl.Palette 1.0 + +// An IndicatorButton works just like q QGCButton with the additional support or a red/green +// indicator on the right edge. + +QGCButton { + property bool indicatorGreen: false + + Rectangle { + readonly property real indicatorRadius: 4 + + x: parent.width - (indicatorRadius * 2) - 5 + y: (parent.height - (indicatorRadius * 2)) / 2 + width: indicatorRadius * 2 + height: indicatorRadius * 2 + + radius: indicatorRadius + color: indicatorGreen ? "#00d932" : "red" + } +} diff --git a/src/QmlControls/qmldir b/src/QmlControls/qmldir index 2cde65c1b63f9e733d986b044ec7bb418b8fe4a8..e8044b4d53567ba87ffa028a890dd7028a0dc6e9 100644 --- a/src/QmlControls/qmldir +++ b/src/QmlControls/qmldir @@ -1,5 +1,5 @@ Module QGroundControl.Controls -SubMenuButton 1.0 SubMenuButton.qml + QGCLabel 1.0 QGCLabel.qml QGCButton 1.0 QGCButton.qml QGCRadioButton 1.0 QGCRadioButton.qml @@ -7,3 +7,7 @@ QGCCheckBox 1.0 QGCCheckBox.qml QGCTextField 1.0 QGCTextField.qml QGCComboBox 1.0 QGCComboBox.qml QGCColoredImage 1.0 QGCColoredImage.qml + +SubMenuButton 1.0 SubMenuButton.qml +IndicatorButton 1.0 IndicatorButton.qml + diff --git a/src/VehicleSetup/FirmwareUpgradeController.cc b/src/VehicleSetup/FirmwareUpgradeController.cc index b8216f0174dc4ac23fa40f7d8bed77beaf259167..763bc3f50d44b0d6cca52e5f949f4c093cbd3c97 100644 --- a/src/VehicleSetup/FirmwareUpgradeController.cc +++ b/src/VehicleSetup/FirmwareUpgradeController.cc @@ -619,4 +619,4 @@ void FirmwareUpgradeController::_appendStatusLog(const QString& text) "append", Q_RETURN_ARG(QVariant, returnedValue), Q_ARG(QVariant, varText)); -} \ No newline at end of file +} diff --git a/src/qgcunittest/MockLink.param b/src/qgcunittest/MockLink.param index ecceac1916c3ab84daac1bc0c203e58f6a6e4340..349d7d42c491c4ae16da0b674e6908fd411f1cc7 100644 --- a/src/qgcunittest/MockLink.param +++ b/src/qgcunittest/MockLink.param @@ -2,6 +2,10 @@ # # MAV ID COMPONENT ID PARAM NAME VALUE (FLOAT) 1 50 ATT_ACC_COMP 2 6 +1 50 ATT_J11 0.0018 9 +1 50 ATT_J22 0.0018 9 +1 50 ATT_J33 0.0037 9 +1 50 ATT_J_EN 0 6 1 50 ATT_MAG_DECL 0 9 1 50 BAT_CAPACITY -1 9 1 50 BAT_C_SCALING 0.0124 9 @@ -10,17 +14,83 @@ 1 50 BAT_V_EMPTY 3.4 9 1 50 BAT_V_LOAD_DROP 0.07 9 1 50 BAT_V_SCALE_IO 10000 6 -1 50 BAT_V_SCALING 0.0082 9 +1 50 BAT_V_SCALING 0.00989 9 1 50 BD_GPROPERTIES 0.03 9 1 50 BD_OBJ_CD 0.1 9 1 50 BD_OBJ_MASS 0.6 9 1 50 BD_OBJ_SURFACE 0.00311725 9 1 50 BD_PRECISION 30 9 1 50 BD_TURNRADIUS 120 9 +1 50 CAL_ACC0_ID 0 6 +1 50 CAL_ACC0_XOFF 0 9 +1 50 CAL_ACC0_XSCALE 1 9 +1 50 CAL_ACC0_YOFF 0 9 +1 50 CAL_ACC0_YSCALE 1 9 +1 50 CAL_ACC0_ZOFF 0 9 +1 50 CAL_ACC0_ZSCALE 1 9 +1 50 CAL_ACC1_ID 0 6 +1 50 CAL_ACC1_XOFF 0 9 +1 50 CAL_ACC1_XSCALE 1 9 +1 50 CAL_ACC1_YOFF 0 9 +1 50 CAL_ACC1_YSCALE 1 9 +1 50 CAL_ACC1_ZOFF 0 9 +1 50 CAL_ACC1_ZSCALE 1 9 +1 50 CAL_ACC2_ID 0 6 +1 50 CAL_ACC2_XOFF 0 9 +1 50 CAL_ACC2_XSCALE 1 9 +1 50 CAL_ACC2_YOFF 0 9 +1 50 CAL_ACC2_YSCALE 1 9 +1 50 CAL_ACC2_ZOFF 0 9 +1 50 CAL_ACC2_ZSCALE 1 9 +1 50 CAL_BOARD_ID 0 6 +1 50 CAL_GYRO0_ID 0 6 +1 50 CAL_GYRO0_XOFF 0 9 +1 50 CAL_GYRO0_XSCALE 1 9 +1 50 CAL_GYRO0_YOFF 0 9 +1 50 CAL_GYRO0_YSCALE 1 9 +1 50 CAL_GYRO0_ZOFF 0 9 +1 50 CAL_GYRO0_ZSCALE 1 9 +1 50 CAL_GYRO1_ID 0 6 +1 50 CAL_GYRO1_XOFF 0 9 +1 50 CAL_GYRO1_XSCALE 1 9 +1 50 CAL_GYRO1_YOFF 0 9 +1 50 CAL_GYRO1_YSCALE 1 9 +1 50 CAL_GYRO1_ZOFF 0 9 +1 50 CAL_GYRO1_ZSCALE 1 9 +1 50 CAL_GYRO2_ID 0 6 +1 50 CAL_GYRO2_XOFF 0 9 +1 50 CAL_GYRO2_XSCALE 1 9 +1 50 CAL_GYRO2_YOFF 0 9 +1 50 CAL_GYRO2_YSCALE 1 9 +1 50 CAL_GYRO2_ZOFF 0 9 +1 50 CAL_GYRO2_ZSCALE 1 9 +1 50 CAL_MAG0_ID 0 6 +1 50 CAL_MAG0_ROT -1 6 +1 50 CAL_MAG0_XOFF 0 9 +1 50 CAL_MAG0_XSCALE 1 9 +1 50 CAL_MAG0_YOFF 0 9 +1 50 CAL_MAG0_YSCALE 1 9 +1 50 CAL_MAG0_ZOFF 0 9 +1 50 CAL_MAG0_ZSCALE 1 9 +1 50 CAL_MAG1_ID 0 6 +1 50 CAL_MAG1_ROT -1 6 +1 50 CAL_MAG1_XOFF 0 9 +1 50 CAL_MAG1_XSCALE 1 9 +1 50 CAL_MAG1_YOFF 0 9 +1 50 CAL_MAG1_YSCALE 1 9 +1 50 CAL_MAG1_ZOFF 0 9 +1 50 CAL_MAG1_ZSCALE 1 9 +1 50 CAL_MAG2_ID 0 6 +1 50 CAL_MAG2_ROT -1 6 +1 50 CAL_MAG2_XOFF 0 9 +1 50 CAL_MAG2_XSCALE 1 9 +1 50 CAL_MAG2_YOFF 0 9 +1 50 CAL_MAG2_YSCALE 1 9 +1 50 CAL_MAG2_ZOFF 0 9 +1 50 CAL_MAG2_ZSCALE 1 9 1 50 CBRK_AIRSPD_CHK 0 6 1 50 CBRK_ENGINEFAIL 284953 6 1 50 CBRK_FLIGHTTERM 121212 6 -1 50 CBRK_GPSFAIL 240024 6 1 50 CBRK_IO_SAFETY 0 6 1 50 CBRK_NO_VISION 0 6 1 50 CBRK_RATE_CTRL 0 6 @@ -36,18 +106,16 @@ 1 50 EKF_ATT_V3_Q1 0.08 9 1 50 EKF_ATT_V3_Q2 0.009 9 1 50 EKF_ATT_V3_Q3 0.005 9 -1 50 EKF_ATT_V3_Q4 0 9 1 50 EKF_ATT_V4_R0 0.0008 9 1 50 EKF_ATT_V4_R1 10000 9 1 50 EKF_ATT_V4_R2 100 9 -1 50 EKF_ATT_V4_R3 0 9 1 50 FPE_DEBUG 0 6 1 50 FPE_LO_THRUST 0.4 9 1 50 FPE_SONAR_LP_L 0.2 9 1 50 FPE_SONAR_LP_U 0.5 9 -1 50 FW_AIRSPD_MAX 50 9 -1 50 FW_AIRSPD_MIN 13 9 -1 50 FW_AIRSPD_TRIM 20 9 +1 50 FW_AIRSPD_MAX 20 9 +1 50 FW_AIRSPD_MIN 10 9 +1 50 FW_AIRSPD_TRIM 15 9 1 50 FW_ATT_TC 0.5 9 1 50 FW_CLMBOUT_DIFF 25 9 1 50 FW_FLARE_PMAX 15 9 @@ -100,6 +168,7 @@ 1 50 FW_T_THR_DAMP 0.5 9 1 50 FW_T_TIME_CONST 5 9 1 50 FW_T_VERT_ACC 7 9 +1 50 FW_YCO_METHOD 0 6 1 50 FW_YCO_VMIN 1000 9 1 50 FW_YR_FF 0.3 9 1 50 FW_YR_I 0 9 @@ -124,10 +193,11 @@ 1 50 INAV_W_XY_GPS_P 1 9 1 50 INAV_W_XY_GPS_V 2 9 1 50 INAV_W_XY_RES_V 0.5 9 -1 50 INAV_W_XY_VIS_P 5 9 +1 50 INAV_W_XY_VIS_P 7 9 1 50 INAV_W_XY_VIS_V 0 9 1 50 INAV_W_Z_BARO 0.5 9 1 50 INAV_W_Z_GPS_P 0.005 9 +1 50 INAV_W_Z_GPS_V 0 9 1 50 INAV_W_Z_SONAR 3 9 1 50 INAV_W_Z_VIS_P 0.5 9 1 50 LAUN_ALL_ON 0 6 @@ -136,36 +206,45 @@ 1 50 LAUN_CAT_PMAX 30 9 1 50 LAUN_CAT_T 0.05 9 1 50 LAUN_THR_PRE 0 9 +1 50 LNDFW_AIRSPD_MAX 10 9 +1 50 LNDFW_VEL_XY_MAX 0.2 9 +1 50 LNDFW_VEL_Z_MAX 10 9 +1 50 LNDMC_ROT_MAX 20 9 +1 50 LNDMC_THR_MAX 0.2 9 +1 50 LNDMC_XY_VEL_MAX 1 9 +1 50 LNDMC_Z_VEL_MAX 0.3 9 1 50 MAV_COMP_ID 50 6 1 50 MAV_FWDEXTSP 1 6 -1 50 MAV_SYS_ID 128 6 +1 50 MAV_SYS_ID 1 6 1 50 MAV_TYPE 2 6 1 50 MAV_USEHILGPS 0 6 1 50 MC_ACRO_P_MAX 90 9 1 50 MC_ACRO_R_MAX 90 9 1 50 MC_ACRO_Y_MAX 120 9 -1 50 MC_MAN_P_MAX 35 9 -1 50 MC_MAN_R_MAX 35 9 -1 50 MC_MAN_Y_MAX 120 9 -1 50 MC_PITCHRATE_D 0.003 9 +1 50 MC_PITCHRATE_D 0.004 9 1 50 MC_PITCHRATE_I 0 9 -1 50 MC_PITCHRATE_P 0.1 9 +1 50 MC_PITCHRATE_P 0.13 9 1 50 MC_PITCH_P 7 9 -1 50 MC_ROLLRATE_D 0.003 9 +1 50 MC_ROLLRATE_D 0.004 9 1 50 MC_ROLLRATE_I 0 9 -1 50 MC_ROLLRATE_P 0.1 9 +1 50 MC_ROLLRATE_P 0.13 9 1 50 MC_ROLL_P 7 9 1 50 MC_YAWRATE_D 0 9 -1 50 MC_YAWRATE_I 0.1 9 +1 50 MC_YAWRATE_I 0.25 9 1 50 MC_YAWRATE_MAX 120 9 -1 50 MC_YAWRATE_P 0.2 9 +1 50 MC_YAWRATE_P 0.25 9 1 50 MC_YAW_FF 0.5 9 -1 50 MC_YAW_P 2.8 9 +1 50 MC_YAW_P 2.5 9 1 50 MIS_ALTMODE 0 6 1 50 MIS_DIST_1WP 500 9 1 50 MIS_ONBOARD_EN 1 6 1 50 MIS_TAKEOFF_ALT 10 9 +1 50 MIS_YAWMODE 0 6 +1 50 MKBLCTRL_TEST 0 6 1 50 MPC_LAND_SPEED 1 9 +1 50 MPC_MAN_P_MAX 35 9 +1 50 MPC_MAN_R_MAX 35 9 +1 50 MPC_MAN_Y_MAX 120 9 1 50 MPC_THR_MAX 1 9 1 50 MPC_THR_MIN 0.1 9 1 50 MPC_TILTMAX_AIR 45 9 @@ -223,7 +302,7 @@ 1 50 MT_USP_PIT_MIN -45 9 1 50 MT_USP_THR_MAX 1 9 1 50 MT_USP_THR_MIN 1 9 -1 50 NAV_ACC_RAD 25 9 +1 50 NAV_ACC_RAD 2 9 1 50 NAV_AH_ALT 600 9 1 50 NAV_AH_LAT -265847810 6 1 50 NAV_AH_LON 1518423250 6 @@ -307,43 +386,43 @@ 1 50 RC18_REV 1 9 1 50 RC18_TRIM 1500 9 1 50 RC1_DZ 10 9 -1 50 RC1_MAX 1900 9 -1 50 RC1_MIN 1100 9 -1 50 RC1_REV -1 9 -1 50 RC1_TRIM 1490 9 +1 50 RC1_MAX 2000 9 +1 50 RC1_MIN 1000 9 +1 50 RC1_REV 1 9 +1 50 RC1_TRIM 1500 9 1 50 RC2_DZ 10 9 -1 50 RC2_MAX 1900 9 -1 50 RC2_MIN 1100 9 +1 50 RC2_MAX 2000 9 +1 50 RC2_MIN 1000 9 1 50 RC2_REV 1 9 -1 50 RC2_TRIM 1483 9 +1 50 RC2_TRIM 1500 9 1 50 RC3_DZ 10 9 -1 50 RC3_MAX 1901 9 -1 50 RC3_MIN 1099 9 +1 50 RC3_MAX 2000 9 +1 50 RC3_MIN 1000 9 1 50 RC3_REV 1 9 -1 50 RC3_TRIM 1099 9 +1 50 RC3_TRIM 1500 9 1 50 RC4_DZ 10 9 -1 50 RC4_MAX 1900 9 -1 50 RC4_MIN 1100 9 -1 50 RC4_REV -1 9 +1 50 RC4_MAX 2000 9 +1 50 RC4_MIN 1000 9 +1 50 RC4_REV 1 9 1 50 RC4_TRIM 1500 9 1 50 RC5_DZ 10 9 -1 50 RC5_MAX 1901 9 -1 50 RC5_MIN 1099 9 +1 50 RC5_MAX 2000 9 +1 50 RC5_MIN 1000 9 1 50 RC5_REV 1 9 1 50 RC5_TRIM 1500 9 1 50 RC6_DZ 10 9 -1 50 RC6_MAX 1901 9 -1 50 RC6_MIN 1099 9 +1 50 RC6_MAX 2000 9 +1 50 RC6_MIN 1000 9 1 50 RC6_REV 1 9 1 50 RC6_TRIM 1500 9 1 50 RC7_DZ 10 9 -1 50 RC7_MAX 1901 9 -1 50 RC7_MIN 1099 9 +1 50 RC7_MAX 2000 9 +1 50 RC7_MIN 1000 9 1 50 RC7_REV 1 9 1 50 RC7_TRIM 1500 9 1 50 RC8_DZ 10 9 -1 50 RC8_MAX 1901 9 -1 50 RC8_MIN 1099 9 +1 50 RC8_MAX 2000 9 +1 50 RC8_MIN 1000 9 1 50 RC8_REV 1 9 1 50 RC8_TRIM 1500 9 1 50 RC9_DZ 0 9 @@ -366,6 +445,9 @@ 1 50 RC_MAP_LOITER_SW 0 6 1 50 RC_MAP_MODE_SW 0 6 1 50 RC_MAP_OFFB_SW 0 6 +1 50 RC_MAP_PARAM1 0 6 +1 50 RC_MAP_PARAM2 0 6 +1 50 RC_MAP_PARAM3 0 6 1 50 RC_MAP_PITCH 2 6 1 50 RC_MAP_POSCTL_SW 0 6 1 50 RC_MAP_RETURN_SW 0 6 @@ -375,18 +457,13 @@ 1 50 RC_OFFB_TH 0.5 9 1 50 RC_POSCTL_TH 0.5 9 1 50 RC_RETURN_TH 0.5 9 -1 50 RTL_DESCEND_ALT 20 9 +1 50 RTL_DESCEND_ALT 10 9 1 50 RTL_LAND_DELAY -1 9 1 50 RTL_LOITER_RAD 50 9 -1 50 RTL_RETURN_ALT 100 9 +1 50 RTL_RETURN_ALT 30 9 +1 50 RV_YAW_P 0.1 9 1 50 SDLOG_EXT -1 6 1 50 SDLOG_RATE -1 6 -1 50 SENS_ACC_XOFF 1 9 -1 50 SENS_ACC_XSCALE 1 9 -1 50 SENS_ACC_YOFF 0 9 -1 50 SENS_ACC_YSCALE 1 9 -1 50 SENS_ACC_ZOFF 0 9 -1 50 SENS_ACC_ZSCALE 1 9 1 50 SENS_BARO_QNH 1013.25 9 1 50 SENS_BOARD_ROT 0 6 1 50 SENS_BOARD_X_OFF 0 9 @@ -396,25 +473,10 @@ 1 50 SENS_DPRES_OFF 0 9 1 50 SENS_EXT_MAG 0 6 1 50 SENS_EXT_MAG_ROT 0 6 -1 50 SENS_GYRO_XOFF 1 9 -1 50 SENS_GYRO_XSCALE 1 9 -1 50 SENS_GYRO_YOFF 0 9 -1 50 SENS_GYRO_YSCALE 1 9 -1 50 SENS_GYRO_ZOFF 0 9 -1 50 SENS_GYRO_ZSCALE 1 9 -1 50 SENS_MAG_XOFF 1 9 -1 50 SENS_MAG_XSCALE 1 9 -1 50 SENS_MAG_YOFF 0 9 -1 50 SENS_MAG_YSCALE 1 9 -1 50 SENS_MAG_ZOFF 0 9 -1 50 SENS_MAG_ZSCALE 1 9 -1 50 SO3_COMP_KI 0.05 9 -1 50 SO3_COMP_KP 1 9 -1 50 SO3_PITCH_OFFS 0 9 -1 50 SO3_ROLL_OFFS 0 9 -1 50 SO3_YAW_OFFS 0 9 +1 50 SENS_FLOW_ROT 0 6 1 50 SYS_AUTOCONFIG 0 6 -1 50 SYS_AUTOSTART 4010 6 +1 50 SYS_AUTOSTART 10016 6 +1 50 SYS_COMPANION 0 6 1 50 SYS_RESTART_TYPE 0 6 1 50 SYS_USE_IO 1 6 1 50 TEST_D 0.01 9 @@ -435,4 +497,13 @@ 1 50 UAVCAN_BITRATE 1000000 6 1 50 UAVCAN_ENABLE 0 6 1 50 UAVCAN_NODE_ID 1 6 -1 50 test 305419896 6 +1 50 VT_ARSP_LP_GAIN 0.3 9 +1 50 VT_FW_PERM_STAB 0 6 +1 50 VT_FW_PITCH_TRIM 0 9 +1 50 VT_IDLE_PWM_MC 900 6 +1 50 VT_MC_ARSPD_MAX 30 9 +1 50 VT_MC_ARSPD_MIN 10 9 +1 50 VT_MC_ARSPD_TRIM 10 9 +1 50 VT_MOT_COUNT 0 6 +1 50 VT_POWER_MAX 120 9 +1 50 VT_PROP_EFF 0 9 diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index 20312d9afe7ab491ec993d12a61eca3d01f233b9..ce8088c43de79435512ac4dec77d6aabde685e9d 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -2414,6 +2414,7 @@ void UAS::processParamValueMsg(mavlink_message_t& msg, const QString& paramName, parameters.value(compId)->insert(paramName, paramValue); emit parameterChanged(uasId, compId, paramName, paramValue); + emit parameterUpdate(uasId, compId, paramName, rawValue.param_type, paramValue); emit parameterChanged(uasId, compId, rawValue.param_count, rawValue.param_index, paramName, paramValue); } diff --git a/src/uas/UASInterface.h b/src/uas/UASInterface.h index 9aeca95253e818b42940f6a997ec8d12bdcbda92..c61c81e1e6f7df2f95124fef23b5ad83690d3156 100644 --- a/src/uas/UASInterface.h +++ b/src/uas/UASInterface.h @@ -507,6 +507,7 @@ signals: void autoModeChanged(bool autoMode); void parameterChanged(int uas, int component, QString parameterName, QVariant value); void parameterChanged(int uas, int component, int parameterCount, int parameterId, QString parameterName, QVariant value); + void parameterUpdate(int uas, int component, QString parameterName, int type, QVariant value); void patternDetected(int uasId, QString patternPath, float confidence, bool detected); void letterDetected(int uasId, QString letter, float confidence, bool detected); /** diff --git a/src/uas/UASParameterCommsMgr.cc b/src/uas/UASParameterCommsMgr.cc index e355a690c2cd9c47756e835aec2c49aa5e6b910c..83ee8950f81ad4a8923c637de06991c25f836e6e 100644 --- a/src/uas/UASParameterCommsMgr.cc +++ b/src/uas/UASParameterCommsMgr.cc @@ -285,6 +285,7 @@ void UASParameterCommsMgr::requestParameterUpdate(int compId, const QString& par { if (mav) { mav->requestParameter(compId, paramName); + qCDebug(UASParameterCommsMgrLog) << "Requested update for" << compId << paramName; //TODO track these read requests with a paramName but no param ID : use index in getOnboardParamsForComponent? //ensure we keep track of every single read request } diff --git a/src/ui/px4_configuration/QGCPX4MulticopterConfig.cc b/src/ui/px4_configuration/QGCPX4MulticopterConfig.cc deleted file mode 100644 index 920d708364d93c014b4df2cdf0c00d073968dd85..0000000000000000000000000000000000000000 --- a/src/ui/px4_configuration/QGCPX4MulticopterConfig.cc +++ /dev/null @@ -1,14 +0,0 @@ -#include "QGCPX4MulticopterConfig.h" -#include "ui_QGCPX4MulticopterConfig.h" - -QGCPX4MulticopterConfig::QGCPX4MulticopterConfig(QWidget *parent) : - QWidget(parent), - ui(new Ui::QGCPX4MulticopterConfig) -{ - ui->setupUi(this); -} - -QGCPX4MulticopterConfig::~QGCPX4MulticopterConfig() -{ - delete ui; -} diff --git a/src/ui/px4_configuration/QGCPX4MulticopterConfig.h b/src/ui/px4_configuration/QGCPX4MulticopterConfig.h deleted file mode 100644 index 7a9140b74c61deb1b4bf87c1dc95ec0928f05208..0000000000000000000000000000000000000000 --- a/src/ui/px4_configuration/QGCPX4MulticopterConfig.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef QGCPX4MULTICOPTERCONFIG_H -#define QGCPX4MULTICOPTERCONFIG_H - -#include - -namespace Ui { -class QGCPX4MulticopterConfig; -} - -class QGCPX4MulticopterConfig : public QWidget -{ - Q_OBJECT - -public: - explicit QGCPX4MulticopterConfig(QWidget *parent = 0); - ~QGCPX4MulticopterConfig(); - -private: - Ui::QGCPX4MulticopterConfig *ui; -}; - -#endif // QGCPX4MULTICOPTERCONFIG_H diff --git a/src/ui/px4_configuration/QGCPX4MulticopterConfig.ui b/src/ui/px4_configuration/QGCPX4MulticopterConfig.ui deleted file mode 100644 index 6a10dfc26d8949bbaf8956432120ab8b9a5f48e1..0000000000000000000000000000000000000000 --- a/src/ui/px4_configuration/QGCPX4MulticopterConfig.ui +++ /dev/null @@ -1,123 +0,0 @@ - - - QGCPX4MulticopterConfig - - - - 0 - 0 - 605 - 449 - - - - Form - - - - - 130 - 150 - 341 - 22 - - - - Qt::Horizontal - - - - - - 130 - 400 - 351 - 22 - - - - Qt::Horizontal - - - - - - 30 - 160 - 62 - 16 - - - - TextLabel - - - - - - 510 - 160 - 62 - 16 - - - - TextLabel - - - - - - 40 - 400 - 62 - 16 - - - - TextLabel - - - - - - 520 - 400 - 62 - 16 - - - - TextLabel - - - - - - 30 - 10 - 62 - 16 - - - - TextLabel - - - - - - 30 - 200 - 62 - 16 - - - - TextLabel - - - - - -