diff --git a/ground/openpilotgcs/src/plugins/config/Config.pluginspec b/ground/openpilotgcs/src/plugins/config/Config.pluginspec index 83013fd28..1ba1c8f76 100644 --- a/ground/openpilotgcs/src/plugins/config/Config.pluginspec +++ b/ground/openpilotgcs/src/plugins/config/Config.pluginspec @@ -10,5 +10,6 @@ + diff --git a/ground/openpilotgcs/src/plugins/config/config.pri b/ground/openpilotgcs/src/plugins/config/config.pri new file mode 100644 index 000000000..4c7a450b8 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/config/config.pri @@ -0,0 +1,7 @@ +#include(config_dependencies.pri) +include(../../plugins/uavsettingsimportexport/uavsettingsimportexport.pri) +include(../../plugins/uavtalk/uavtalk.pri) +# Add the include path to the built-in uavobject include files. +INCLUDEPATH += $$PWD + +LIBS *= -l$$qtLibraryName(Config) diff --git a/ground/openpilotgcs/src/plugins/config/config.pro b/ground/openpilotgcs/src/plugins/config/config.pro index 091a7d45c..47ef5c960 100644 --- a/ground/openpilotgcs/src/plugins/config/config.pro +++ b/ground/openpilotgcs/src/plugins/config/config.pro @@ -1,13 +1,8 @@ TEMPLATE = lib TARGET = Config +DEFINES += CONFIG_LIBRARY QT += svg -include(../../openpilotgcsplugin.pri) -include(../../libs/utils/utils.pri) -include(../../plugins/uavtalk/uavtalk.pri) -include(../../plugins/coreplugin/coreplugin.pri) -include(../../plugins/uavobjects/uavobjects.pri) -include(../../plugins/uavobjectutil/uavobjectutil.pri) -include(../../plugins/uavsettingsimportexport/uavsettingsimportexport.pri) +include(config_dependencies.pri) INCLUDEPATH += ../../libs/eigen OTHER_FILES += Config.pluginspec HEADERS += configplugin.h \ @@ -19,25 +14,21 @@ HEADERS += configplugin.h \ fancytabwidget.h \ configinputwidget.h \ configoutputwidget.h \ - configtaskwidget.h \ configairframewidget.h \ config_pro_hw_widget.h \ config_cc_hw_widget.h \ configahrswidget.h \ configccattitudewidget.h \ - mixercurvewidget.h \ - mixercurvepoint.h \ - mixercurveline.h \ configccpmwidget.h \ configstabilizationwidget.h \ assertions.h \ calibration.h \ defaultattitudewidget.h \ - smartsavebutton.h \ defaulthwsettingswidget.h \ inputchannelform.h \ configcamerastabilizationwidget.h \ - outputchannelform.h + outputchannelform.h \ + config_global.h SOURCES += configplugin.cpp \ configgadgetconfiguration.cpp \ configgadgetwidget.cpp \ @@ -45,7 +36,6 @@ SOURCES += configplugin.cpp \ configgadgetoptionspage.cpp \ configgadget.cpp \ fancytabwidget.cpp \ - configtaskwidget.cpp \ configinputwidget.cpp \ configoutputwidget.cpp \ configairframewidget.cpp \ @@ -53,9 +43,6 @@ SOURCES += configplugin.cpp \ config_cc_hw_widget.cpp \ configahrswidget.cpp \ configccattitudewidget.cpp \ - mixercurvewidget.cpp \ - mixercurvepoint.cpp \ - mixercurveline.cpp \ configccpmwidget.cpp \ configstabilizationwidget.cpp \ twostep.cpp \ @@ -63,7 +50,6 @@ SOURCES += configplugin.cpp \ gyro-calibration.cpp \ alignment-calibration.cpp \ defaultattitudewidget.cpp \ - smartsavebutton.cpp \ defaulthwsettingswidget.cpp \ inputchannelform.cpp \ configcamerastabilizationwidget.cpp \ diff --git a/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp b/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp index 36337d3fa..97cfccd47 100644 --- a/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp +++ b/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp @@ -43,7 +43,7 @@ ConfigCCHWWidget::ConfigCCHWWidget(QWidget *parent) : ConfigTaskWidget(parent) m_telemetry->label_2->setPixmap(QPixmap(":/configgadget/images/coptercontrol.svg")); - setupButtons(m_telemetry->saveTelemetryToRAM,m_telemetry->saveTelemetryToSD); + addApplySaveButtons(m_telemetry->saveTelemetryToRAM,m_telemetry->saveTelemetryToSD); addUAVObjectToWidgetRelation("HwSettings","CC_FlexiPort",m_telemetry->cbFlexi); addUAVObjectToWidgetRelation("HwSettings","CC_MainPort",m_telemetry->cbTele); addUAVObjectToWidgetRelation("HwSettings","CC_RcvrPort",m_telemetry->cbRcvr); diff --git a/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.h b/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.h index 7c74043b3..7c4945281 100644 --- a/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.h +++ b/ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.h @@ -28,7 +28,7 @@ #define CONFIGCCHWWIDGET_H #include "ui_cc_hw_settings.h" -#include "configtaskwidget.h" +#include "../uavobjectwidgetutils/configtaskwidget.h" #include "extensionsystem/pluginmanager.h" #include "uavobjectmanager.h" #include "uavobject.h" diff --git a/ground/openpilotgcs/src/plugins/config/config_dependencies.pri b/ground/openpilotgcs/src/plugins/config/config_dependencies.pri new file mode 100644 index 000000000..33e0f3da7 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/config/config_dependencies.pri @@ -0,0 +1,8 @@ +include(../../openpilotgcsplugin.pri) +include(../../libs/utils/utils.pri) +include(../../plugins/uavtalk/uavtalk.pri) +include(../../plugins/coreplugin/coreplugin.pri) +include(../../plugins/uavobjects/uavobjects.pri) +include(../../plugins/uavobjectutil/uavobjectutil.pri) +include(../../plugins/uavsettingsimportexport/uavsettingsimportexport.pri) +include(../../plugins/uavobjectwidgetutils/uavobjectwidgetutils.pri) diff --git a/ground/openpilotgcs/src/plugins/config/config_global.h b/ground/openpilotgcs/src/plugins/config/config_global.h new file mode 100644 index 000000000..e38cbe5e8 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/config/config_global.h @@ -0,0 +1,41 @@ +/** + ****************************************************************************** + * + * @file config_global.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @see The GNU Public License (GPL) Version 3 + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @addtogroup Congig Plugin + * @{ + * @brief The Congig GCS plugin + *****************************************************************************/ +/* + * This program 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. + * + * This program 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 this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef CONFIG_GLOBAL_H +#define CONFIG_GLOBAL_H + +#include + +#if defined(CONFIG_LIBRARY) +# define CONFIG_EXPORT Q_DECL_EXPORT +#else +# define CONFIG_EXPORT Q_DECL_IMPORT +#endif + + +#endif // CONFIG_GLOBAL_H diff --git a/ground/openpilotgcs/src/plugins/config/config_pro_hw_widget.cpp b/ground/openpilotgcs/src/plugins/config/config_pro_hw_widget.cpp index f81ba32ee..c554cae31 100644 --- a/ground/openpilotgcs/src/plugins/config/config_pro_hw_widget.cpp +++ b/ground/openpilotgcs/src/plugins/config/config_pro_hw_widget.cpp @@ -39,7 +39,7 @@ ConfigProHWWidget::ConfigProHWWidget(QWidget *parent) : ConfigTaskWidget(parent) m_telemetry = new Ui_PRO_HW_Widget(); m_telemetry->setupUi(this); - setupButtons(m_telemetry->saveTelemetryToRAM,m_telemetry->saveTelemetryToSD); + addApplySaveButtons(m_telemetry->saveTelemetryToRAM,m_telemetry->saveTelemetryToSD); addUAVObjectToWidgetRelation("HwSettings","TelemetrySpeed",m_telemetry->telemetrySpeed); enableControls(false); populateWidgets(); diff --git a/ground/openpilotgcs/src/plugins/config/config_pro_hw_widget.h b/ground/openpilotgcs/src/plugins/config/config_pro_hw_widget.h index fbf35b9bd..021e19aaf 100644 --- a/ground/openpilotgcs/src/plugins/config/config_pro_hw_widget.h +++ b/ground/openpilotgcs/src/plugins/config/config_pro_hw_widget.h @@ -28,7 +28,7 @@ #define CONFIGPROHWWIDGET_H #include "ui_pro_hw_settings.h" -#include "configtaskwidget.h" +#include "../uavobjectwidgetutils/configtaskwidget.h" #include "extensionsystem/pluginmanager.h" #include "uavobjectmanager.h" #include "uavobject.h" diff --git a/ground/openpilotgcs/src/plugins/config/configahrswidget.h b/ground/openpilotgcs/src/plugins/config/configahrswidget.h index 23da6f242..645c63198 100644 --- a/ground/openpilotgcs/src/plugins/config/configahrswidget.h +++ b/ground/openpilotgcs/src/plugins/config/configahrswidget.h @@ -30,7 +30,7 @@ #include #include "ui_ahrs.h" -#include "configtaskwidget.h" +#include "../uavobjectwidgetutils/configtaskwidget.h" #include "extensionsystem/pluginmanager.h" #include "uavobjectmanager.h" #include "uavobject.h" diff --git a/ground/openpilotgcs/src/plugins/config/configairframewidget.cpp b/ground/openpilotgcs/src/plugins/config/configairframewidget.cpp index 9f118532e..6390cec0e 100644 --- a/ground/openpilotgcs/src/plugins/config/configairframewidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configairframewidget.cpp @@ -95,7 +95,7 @@ ConfigAirframeWidget::ConfigAirframeWidget(QWidget *parent) : ConfigTaskWidget(p m_aircraft = new Ui_AircraftWidget(); m_aircraft->setupUi(this); - setupButtons(m_aircraft->saveAircraftToRAM,m_aircraft->saveAircraftToSD); + addApplySaveButtons(m_aircraft->saveAircraftToRAM,m_aircraft->saveAircraftToSD); addUAVObject("SystemSettings"); addUAVObject("MixerSettings"); @@ -2179,7 +2179,6 @@ void ConfigAirframeWidget::addToDirtyMonitor() addWidget(m_aircraft->elevonSlider1); addWidget(m_aircraft->elevonSlider2); addWidget(m_aircraft->widget_3->m_ccpm->ccpmType); - addWidget(m_aircraft->widget_3->m_ccpm->TabObject); addWidget(m_aircraft->widget_3->m_ccpm->ccpmTailChannel); addWidget(m_aircraft->widget_3->m_ccpm->ccpmEngineChannel); addWidget(m_aircraft->widget_3->m_ccpm->ccpmServoWChannel); diff --git a/ground/openpilotgcs/src/plugins/config/configairframewidget.h b/ground/openpilotgcs/src/plugins/config/configairframewidget.h index 1383350ee..5305e92f2 100644 --- a/ground/openpilotgcs/src/plugins/config/configairframewidget.h +++ b/ground/openpilotgcs/src/plugins/config/configairframewidget.h @@ -28,7 +28,7 @@ #define CONFIGAIRFRAMEWIDGET_H #include "ui_airframe.h" -#include "configtaskwidget.h" +#include "../uavobjectwidgetutils/configtaskwidget.h" #include "extensionsystem/pluginmanager.h" #include "uavobjectmanager.h" #include "uavobject.h" diff --git a/ground/openpilotgcs/src/plugins/config/configcamerastabilizationwidget.h b/ground/openpilotgcs/src/plugins/config/configcamerastabilizationwidget.h index 4534bdc65..41fd5dc4d 100644 --- a/ground/openpilotgcs/src/plugins/config/configcamerastabilizationwidget.h +++ b/ground/openpilotgcs/src/plugins/config/configcamerastabilizationwidget.h @@ -28,7 +28,7 @@ #define CONFIGCAMERASTABILIZATIONWIDGET_H #include "ui_camerastabilization.h" -#include "configtaskwidget.h" +#include "../uavobjectwidgetutils/configtaskwidget.h" #include "extensionsystem/pluginmanager.h" #include "uavobjectmanager.h" #include "uavobject.h" diff --git a/ground/openpilotgcs/src/plugins/config/configccattitudewidget.cpp b/ground/openpilotgcs/src/plugins/config/configccattitudewidget.cpp index 6ad28c666..935e6ad4a 100644 --- a/ground/openpilotgcs/src/plugins/config/configccattitudewidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configccattitudewidget.cpp @@ -42,7 +42,7 @@ ConfigCCAttitudeWidget::ConfigCCAttitudeWidget(QWidget *parent) : connect(ui->zeroBias,SIGNAL(clicked()),this,SLOT(startAccelCalibration())); - setupButtons(ui->applyButton,ui->saveButton); + addApplySaveButtons(ui->applyButton,ui->saveButton); addUAVObject("AttitudeSettings"); // Connect the help button diff --git a/ground/openpilotgcs/src/plugins/config/configccattitudewidget.h b/ground/openpilotgcs/src/plugins/config/configccattitudewidget.h index af107f670..0d0581ba3 100644 --- a/ground/openpilotgcs/src/plugins/config/configccattitudewidget.h +++ b/ground/openpilotgcs/src/plugins/config/configccattitudewidget.h @@ -28,7 +28,7 @@ #define CCATTITUDEWIDGET_H #include "ui_ccattitude.h" -#include "configtaskwidget.h" +#include "../uavobjectwidgetutils/configtaskwidget.h" #include "extensionsystem/pluginmanager.h" #include "uavobjectmanager.h" #include "uavobject.h" diff --git a/ground/openpilotgcs/src/plugins/config/configccpmwidget.h b/ground/openpilotgcs/src/plugins/config/configccpmwidget.h index c6bc1b27b..1e72028a2 100644 --- a/ground/openpilotgcs/src/plugins/config/configccpmwidget.h +++ b/ground/openpilotgcs/src/plugins/config/configccpmwidget.h @@ -28,7 +28,7 @@ #define CONFIGccpmWIDGET_H #include "ui_ccpm.h" -#include "configtaskwidget.h" +#include "../uavobjectwidgetutils/configtaskwidget.h" #include "extensionsystem/pluginmanager.h" #include "uavobjectmanager.h" #include "uavobject.h" diff --git a/ground/openpilotgcs/src/plugins/config/configgadget.h b/ground/openpilotgcs/src/plugins/config/configgadget.h index 5f8e52522..6e617000b 100644 --- a/ground/openpilotgcs/src/plugins/config/configgadget.h +++ b/ground/openpilotgcs/src/plugins/config/configgadget.h @@ -28,7 +28,7 @@ #define CONFIGGADGET_H #include -#include "configgadgetwidget.h" +#include "../uavobjectwidgetutils/configtaskwidget.h" class IUAVGadget; //class QList; @@ -46,7 +46,7 @@ public: ConfigGadget(QString classId, ConfigGadgetWidget *widget, QWidget *parent = 0); ~ConfigGadget(); - QWidget *widget() { return m_widget; } + QWidget *widget() { return (QWidget*)m_widget; } void loadConfiguration(IUAVGadgetConfiguration* config); private: diff --git a/ground/openpilotgcs/src/plugins/config/configgadgetwidget.h b/ground/openpilotgcs/src/plugins/config/configgadgetwidget.h index 633253507..6cfcc2698 100644 --- a/ground/openpilotgcs/src/plugins/config/configgadgetwidget.h +++ b/ground/openpilotgcs/src/plugins/config/configgadgetwidget.h @@ -40,7 +40,7 @@ #include //#include "fancytabwidget.h" #include "utils/mytabbedstackwidget.h" -#include "configtaskwidget.h" +#include "../uavobjectwidgetutils/configtaskwidget.h" class ConfigGadgetWidget: public QWidget { diff --git a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp index 4387d10f4..67a54aa6d 100644 --- a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp @@ -54,10 +54,10 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent) m_config = new Ui_InputWidget(); m_config->setupUi(this); - setupButtons(m_config->saveRCInputToRAM,m_config->saveRCInputToSD); + addApplySaveButtons(m_config->saveRCInputToRAM,m_config->saveRCInputToSD); unsigned int index=0; - foreach(QString name,manualSettingsObj->getFields().at(0)->getElementNames()) + foreach(QString name,manualSettingsObj->getField("ChannelNumber")->getElementNames()) { Q_ASSERT(index < ManualControlSettings::CHANNELGROUPS_NUMELEM); inputChannelForm * inp=new inputChannelForm(this,index==0); @@ -1097,7 +1097,7 @@ void ConfigInputWidget::invertControls() QCheckBox * cb=qobject_cast(wd); if(cb) { - int index=manualSettingsObj->getFields().at(0)->getElementNames().indexOf(cb->text()); + int index=manualSettingsObj->getField("ChannelNumber")->getElementNames().indexOf(cb->text()); if((cb->isChecked() && (manualSettingsData.ChannelMax[index]>manualSettingsData.ChannelMin[index])) || (!cb->isChecked() && (manualSettingsData.ChannelMax[index]setupUi(this); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - setupButtons(m_config->saveRCOutputToRAM,m_config->saveRCOutputToSD); + addApplySaveButtons(m_config->saveRCOutputToRAM,m_config->saveRCOutputToSD); addUAVObject("ActuatorSettings"); UAVSettingsImportExportFactory * importexportplugin = pm->getObject(); connect(importexportplugin,SIGNAL(importAboutToBegin()),this,SLOT(stopTests())); - setupButtons(m_config->saveRCOutputToRAM,m_config->saveRCOutputToSD); + addApplySaveButtons(m_config->saveRCOutputToRAM,m_config->saveRCOutputToSD); addUAVObject("ActuatorSettings"); // NOTE: we have channel indices from 0 to 9, but the convention for OP is Channel 1 to Channel 10. diff --git a/ground/openpilotgcs/src/plugins/config/configoutputwidget.h b/ground/openpilotgcs/src/plugins/config/configoutputwidget.h index 76dc51658..b20839aa4 100644 --- a/ground/openpilotgcs/src/plugins/config/configoutputwidget.h +++ b/ground/openpilotgcs/src/plugins/config/configoutputwidget.h @@ -28,7 +28,7 @@ #define CONFIGOUTPUTWIDGET_H #include "ui_output.h" -#include "configtaskwidget.h" +#include "../uavobjectwidgetutils/configtaskwidget.h" #include "extensionsystem/pluginmanager.h" #include "uavobjectmanager.h" #include "uavobject.h" diff --git a/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.cpp b/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.cpp index 69b0427e3..f34e40900 100644 --- a/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.cpp @@ -34,298 +34,110 @@ #include #include #include +#include ConfigStabilizationWidget::ConfigStabilizationWidget(QWidget *parent) : ConfigTaskWidget(parent) { - stabSettings = StabilizationSettings::GetInstance(getObjectManager()); - m_stabilization = new Ui_StabilizationWidget(); m_stabilization->setupUi(this); + autoLoadWidgets(); + realtimeUpdates=new QTimer(this); + connect(m_stabilization->realTimeUpdates_6,SIGNAL(stateChanged(int)),this,SLOT(realtimeUpdatesSlot(int))); + connect(m_stabilization->realTimeUpdates_7,SIGNAL(stateChanged(int)),this,SLOT(realtimeUpdatesSlot(int))); + connect(realtimeUpdates,SIGNAL(timeout()),this,SLOT(apply())); - setupButtons(m_stabilization->saveStabilizationToRAM, m_stabilization->saveStabilizationToSD); + connect(m_stabilization->checkBox_7,SIGNAL(stateChanged(int)),this,SLOT(linkCheckBoxes(int))); + connect(m_stabilization->checkBox_2,SIGNAL(stateChanged(int)),this,SLOT(linkCheckBoxes(int))); + connect(m_stabilization->checkBox_8,SIGNAL(stateChanged(int)),this,SLOT(linkCheckBoxes(int))); + connect(m_stabilization->checkBox_3,SIGNAL(stateChanged(int)),this,SLOT(linkCheckBoxes(int))); - addUAVObject("StabilizationSettings"); - - refreshWidgetsValues(); - - // Create a timer to regularly send the object update in case - // we want realtime updates. - connect(&updateTimer, SIGNAL(timeout()), this, SLOT(updateObjectsFromWidgets())); - connect(m_stabilization->realTimeUpdates, SIGNAL(toggled(bool)), this, SLOT(realtimeUpdateToggle(bool))); - - // Connect the updates of the stab values - connect(m_stabilization->rateRollKp, SIGNAL(valueChanged(double)), this, SLOT(updateRateRollKP(double))); - connect(m_stabilization->rateRollKi, SIGNAL(valueChanged(double)), this, SLOT(updateRateRollKI(double))); - connect(m_stabilization->rateRollILimit, SIGNAL(valueChanged(double)), this, SLOT(updateRateRollILimit(double))); - - connect(m_stabilization->ratePitchKp, SIGNAL(valueChanged(double)), this, SLOT(updateRatePitchKP(double))); - connect(m_stabilization->ratePitchKi, SIGNAL(valueChanged(double)), this, SLOT(updateRatePitchKI(double))); - connect(m_stabilization->ratePitchILimit, SIGNAL(valueChanged(double)), this, SLOT(updateRatePitchILimit(double))); - - connect(m_stabilization->rollKp, SIGNAL(valueChanged(double)), this, SLOT(updateRollKP(double))); - connect(m_stabilization->rollKi, SIGNAL(valueChanged(double)), this, SLOT(updateRollKI(double))); - connect(m_stabilization->rollILimit, SIGNAL(valueChanged(double)), this, SLOT(updateRollILimit(double))); - - connect(m_stabilization->pitchKp, SIGNAL(valueChanged(double)), this, SLOT(updatePitchKP(double))); - connect(m_stabilization->pitchKi, SIGNAL(valueChanged(double)), this, SLOT(updatePitchKI(double))); - connect(m_stabilization->pitchILimit, SIGNAL(valueChanged(double)), this, SLOT(updatePitchILimit(double))); - - addWidget(m_stabilization->rateRollKp); - addWidget(m_stabilization->rateRollKi); - addWidget(m_stabilization->rateRollILimit); - addWidget(m_stabilization->ratePitchKp); - addWidget(m_stabilization->ratePitchKi); - addWidget(m_stabilization->ratePitchILimit); - addWidget(m_stabilization->rateYawKp); - addWidget(m_stabilization->rateYawKi); - addWidget(m_stabilization->rateYawILimit); - addWidget(m_stabilization->rollKp); - addWidget(m_stabilization->rollKi); - addWidget(m_stabilization->rollILimit); - addWidget(m_stabilization->yawILimit); - addWidget(m_stabilization->yawKi); - addWidget(m_stabilization->yawKp); - addWidget(m_stabilization->pitchKp); - addWidget(m_stabilization->pitchKi); - addWidget(m_stabilization->pitchILimit); - addWidget(m_stabilization->rollMax); - addWidget(m_stabilization->pitchMax); - addWidget(m_stabilization->yawMax); - addWidget(m_stabilization->manualRoll); - addWidget(m_stabilization->manualPitch); - addWidget(m_stabilization->manualYaw); - addWidget(m_stabilization->maximumRoll); - addWidget(m_stabilization->maximumPitch); - addWidget(m_stabilization->maximumYaw); - addWidget(m_stabilization->lowThrottleZeroIntegral); - - // Connect buttons - connect(m_stabilization->stabilizationResetToDefaults, SIGNAL(clicked()), this, SLOT(resetToDefaults())); - connect(m_stabilization->stabilizationHelp, SIGNAL(clicked()), this, SLOT(openHelp())); + connect(this,SIGNAL(widgetContentsChanged(QWidget*)),this,SLOT(processLinkedWidgets(QWidget*))); } + ConfigStabilizationWidget::~ConfigStabilizationWidget() { - // Do nothing + // Do nothing } -void ConfigStabilizationWidget::updateRateRollKP(double val) +void ConfigStabilizationWidget::realtimeUpdatesSlot(int value) { - if (m_stabilization->linkRateRP->isChecked()) { - m_stabilization->ratePitchKp->setValue(val); + m_stabilization->realTimeUpdates_6->setCheckState((Qt::CheckState)value); + m_stabilization->realTimeUpdates_7->setCheckState((Qt::CheckState)value); + if(value==Qt::Checked && !realtimeUpdates->isActive()) + realtimeUpdates->start(300); + else if(value==Qt::Unchecked) + realtimeUpdates->stop(); +} + +void ConfigStabilizationWidget::linkCheckBoxes(int value) +{ + if(sender()== m_stabilization->checkBox_7) + m_stabilization->checkBox_3->setCheckState((Qt::CheckState)value); + else if(sender()== m_stabilization->checkBox_3) + m_stabilization->checkBox_7->setCheckState((Qt::CheckState)value); + else if(sender()== m_stabilization->checkBox_8) + m_stabilization->checkBox_2->setCheckState((Qt::CheckState)value); + else if(sender()== m_stabilization->checkBox_2) + m_stabilization->checkBox_8->setCheckState((Qt::CheckState)value); +} + +void ConfigStabilizationWidget::processLinkedWidgets(QWidget * widget) +{ + if(m_stabilization->checkBox_7->checkState()==Qt::Checked) + { + if(widget== m_stabilization->RateRollKp_2) + { + m_stabilization->RatePitchKp->setValue(m_stabilization->RateRollKp_2->value()); + } + else if(widget== m_stabilization->RateRollKi_2) + { + m_stabilization->RatePitchKi->setValue(m_stabilization->RateRollKi_2->value()); + } + else if(widget== m_stabilization->RateRollILimit_2) + { + m_stabilization->RatePitchILimit->setValue(m_stabilization->RateRollILimit_2->value()); + } + else if(widget== m_stabilization->RatePitchKp) + { + m_stabilization->RateRollKp_2->setValue(m_stabilization->RatePitchKp->value()); + } + else if(widget== m_stabilization->RatePitchKi) + { + m_stabilization->RateRollKi_2->setValue(m_stabilization->RatePitchKi->value()); + } + else if(widget== m_stabilization->RatePitchILimit) + { + m_stabilization->RateRollILimit_2->setValue(m_stabilization->RatePitchILimit->value()); + } + } + if(m_stabilization->checkBox_8->checkState()==Qt::Checked) + { + if(widget== m_stabilization->AttitudeRollKp) + { + m_stabilization->AttitudePitchKp_2->setValue(m_stabilization->AttitudeRollKp->value()); + } + else if(widget== m_stabilization->AttitudeRollKi) + { + m_stabilization->AttitudePitchKi_2->setValue(m_stabilization->AttitudeRollKi->value()); + } + else if(widget== m_stabilization->AttitudeRollILimit) + { + m_stabilization->AttitudePitchILimit_2->setValue(m_stabilization->AttitudeRollILimit->value()); + } + else if(widget== m_stabilization->AttitudePitchKp_2) + { + m_stabilization->AttitudeRollKp->setValue(m_stabilization->AttitudePitchKp_2->value()); + } + else if(widget== m_stabilization->AttitudePitchKi_2) + { + m_stabilization->AttitudeRollKi->setValue(m_stabilization->AttitudePitchKi_2->value()); + } + else if(widget== m_stabilization->AttitudePitchILimit_2) + { + m_stabilization->AttitudeRollILimit->setValue(m_stabilization->AttitudePitchILimit_2->value()); + } } } -void ConfigStabilizationWidget::updateRateRollKI(double val) -{ - if (m_stabilization->linkRateRP->isChecked()) { - m_stabilization->ratePitchKi->setValue(val); - } -} -void ConfigStabilizationWidget::updateRateRollILimit(double val) -{ - if (m_stabilization->linkRateRP->isChecked()) { - m_stabilization->ratePitchILimit->setValue(val); - } -} - -void ConfigStabilizationWidget::updateRatePitchKP(double val) -{ - if (m_stabilization->linkRateRP->isChecked()) { - m_stabilization->rateRollKp->setValue(val); - } -} - -void ConfigStabilizationWidget::updateRatePitchKI(double val) -{ - if (m_stabilization->linkRateRP->isChecked()) { - m_stabilization->rateRollKi->setValue(val); - } -} - -void ConfigStabilizationWidget::updateRatePitchILimit(double val) -{ - if (m_stabilization->linkRateRP->isChecked()) { - m_stabilization->rateRollILimit->setValue(val); - } -} - -void ConfigStabilizationWidget::updateRollKP(double val) -{ - if (m_stabilization->linkAttitudeRP->isChecked()) { - m_stabilization->pitchKp->setValue(val); - } -} - -void ConfigStabilizationWidget::updateRollKI(double val) -{ - if (m_stabilization->linkAttitudeRP->isChecked()) { - m_stabilization->pitchKi->setValue(val); - } - -} - -void ConfigStabilizationWidget::updateRollILimit(double val) -{ - if (m_stabilization->linkAttitudeRP->isChecked()) { - m_stabilization->pitchILimit->setValue(val); - } -} - -void ConfigStabilizationWidget::updatePitchKP(double val) -{ - if (m_stabilization->linkAttitudeRP->isChecked()) { - m_stabilization->rollKp->setValue(val); - } -} - -void ConfigStabilizationWidget::updatePitchKI(double val) -{ - if (m_stabilization->linkAttitudeRP->isChecked()) { - m_stabilization->rollKi->setValue(val); - } - -} - -void ConfigStabilizationWidget::updatePitchILimit(double val) -{ - if (m_stabilization->linkAttitudeRP->isChecked()) { - m_stabilization->rollILimit->setValue(val); - } -} - -/******************************* - * Stabilization Settings - *****************************/ - -/** - * Refresh UI with new settings of StabilizationSettings object - * (either from active configuration or just loaded defaults - * to be applied or saved) - */ -void ConfigStabilizationWidget::refreshUIValues(StabilizationSettings::DataFields &stabData) -{ - // Now fill in all the fields, this is fairly tedious: - m_stabilization->rateRollKp->setValue(stabData.RollRatePID[StabilizationSettings::ROLLRATEPID_KP]); - m_stabilization->rateRollKi->setValue(stabData.RollRatePID[StabilizationSettings::ROLLRATEPID_KI]); - m_stabilization->rateRollILimit->setValue(stabData.RollRatePID[StabilizationSettings::ROLLRATEPID_ILIMIT]); - - m_stabilization->ratePitchKp->setValue(stabData.PitchRatePID[StabilizationSettings::PITCHRATEPID_KP]); - m_stabilization->ratePitchKi->setValue(stabData.PitchRatePID[StabilizationSettings::PITCHRATEPID_KI]); - m_stabilization->ratePitchILimit->setValue(stabData.PitchRatePID[StabilizationSettings::PITCHRATEPID_ILIMIT]); - - m_stabilization->rateYawKp->setValue(stabData.YawRatePID[StabilizationSettings::YAWRATEPID_KP]); - m_stabilization->rateYawKi->setValue(stabData.YawRatePID[StabilizationSettings::YAWRATEPID_KI]); - m_stabilization->rateYawILimit->setValue(stabData.YawRatePID[StabilizationSettings::YAWRATEPID_ILIMIT]); - - m_stabilization->rollKp->setValue(stabData.RollPI[StabilizationSettings::ROLLPI_KP]); - m_stabilization->rollKi->setValue(stabData.RollPI[StabilizationSettings::ROLLPI_KI]); - m_stabilization->rollILimit->setValue(stabData.RollPI[StabilizationSettings::ROLLPI_ILIMIT]); - - m_stabilization->pitchKp->setValue(stabData.PitchPI[StabilizationSettings::PITCHPI_KP]); - m_stabilization->pitchKi->setValue(stabData.PitchPI[StabilizationSettings::PITCHPI_KI]); - m_stabilization->pitchILimit->setValue(stabData.PitchPI[StabilizationSettings::PITCHPI_ILIMIT]); - - m_stabilization->yawKp->setValue(stabData.YawPI[StabilizationSettings::YAWPI_KP]); - m_stabilization->yawKi->setValue(stabData.YawPI[StabilizationSettings::YAWPI_KI]); - m_stabilization->yawILimit->setValue(stabData.YawPI[StabilizationSettings::YAWPI_ILIMIT]); - - m_stabilization->rollMax->setValue(stabData.RollMax); - m_stabilization->pitchMax->setValue(stabData.PitchMax); - m_stabilization->yawMax->setValue(stabData.YawMax); - - m_stabilization->manualRoll->setValue(stabData.ManualRate[StabilizationSettings::MANUALRATE_ROLL]); - m_stabilization->manualPitch->setValue(stabData.ManualRate[StabilizationSettings::MANUALRATE_PITCH]); - m_stabilization->manualYaw->setValue(stabData.ManualRate[StabilizationSettings::MANUALRATE_YAW]); - - m_stabilization->maximumRoll->setValue(stabData.MaximumRate[StabilizationSettings::MAXIMUMRATE_ROLL]); - m_stabilization->maximumPitch->setValue(stabData.MaximumRate[StabilizationSettings::MAXIMUMRATE_PITCH]); - m_stabilization->maximumYaw->setValue(stabData.MaximumRate[StabilizationSettings::MAXIMUMRATE_YAW]); - m_stabilization->lowThrottleZeroIntegral->setChecked(stabData.LowThrottleZeroIntegral==StabilizationSettings::LOWTHROTTLEZEROINTEGRAL_TRUE ? true : false); -} - -/** - Request stabilization settings from the board - */ -void ConfigStabilizationWidget::refreshWidgetsValues() -{ - bool dirty=isDirty(); - // Not needed anymore as this slot is only called whenever we get - // a signal that the object was just updated - // stabSettings->requestUpdate(); - StabilizationSettings::DataFields stabData = stabSettings->getData(); - refreshUIValues(stabData); - setDirty(dirty); -} - -/** - Send telemetry settings to the board - */ -void ConfigStabilizationWidget::updateObjectsFromWidgets() -{ - StabilizationSettings::DataFields stabData = stabSettings->getData(); - - stabData.RollRatePID[StabilizationSettings::ROLLRATEPID_KP] = m_stabilization->rateRollKp->value(); - stabData.RollRatePID[StabilizationSettings::ROLLRATEPID_KI] = m_stabilization->rateRollKi->value(); - stabData.RollRatePID[StabilizationSettings::ROLLRATEPID_ILIMIT] = m_stabilization->rateRollILimit->value(); - - stabData.PitchRatePID[StabilizationSettings::PITCHRATEPID_KP] = m_stabilization->ratePitchKp->value(); - stabData.PitchRatePID[StabilizationSettings::PITCHRATEPID_KI] = m_stabilization->ratePitchKi->value(); - stabData.PitchRatePID[StabilizationSettings::PITCHRATEPID_ILIMIT] = m_stabilization->ratePitchILimit->value(); - - stabData.YawRatePID[StabilizationSettings::YAWRATEPID_KP] = m_stabilization->rateYawKp->value(); - stabData.YawRatePID[StabilizationSettings::YAWRATEPID_KI] = m_stabilization->rateYawKi->value(); - stabData.YawRatePID[StabilizationSettings::YAWRATEPID_ILIMIT] = m_stabilization->rateYawILimit->value(); - - stabData.RollPI[StabilizationSettings::ROLLPI_KP] = m_stabilization->rollKp->value(); - stabData.RollPI[StabilizationSettings::ROLLPI_KI] = m_stabilization->rollKi->value(); - stabData.RollPI[StabilizationSettings::ROLLPI_ILIMIT] = m_stabilization->rollILimit->value(); - - stabData.PitchPI[StabilizationSettings::PITCHPI_KP] = m_stabilization->pitchKp->value(); - stabData.PitchPI[StabilizationSettings::PITCHPI_KI] = m_stabilization->pitchKi->value(); - stabData.PitchPI[StabilizationSettings::PITCHPI_ILIMIT] = m_stabilization->pitchILimit->value(); - - stabData.YawPI[StabilizationSettings::YAWPI_KP] = m_stabilization->yawKp->value(); - stabData.YawPI[StabilizationSettings::YAWPI_KI] = m_stabilization->yawKi->value(); - stabData.YawPI[StabilizationSettings::YAWPI_ILIMIT] = m_stabilization->yawILimit->value(); - - stabData.RollMax = m_stabilization->rollMax->value(); - stabData.PitchMax = m_stabilization->pitchMax->value(); - stabData.YawMax = m_stabilization->yawMax->value(); - - stabData.ManualRate[StabilizationSettings::MANUALRATE_ROLL] = m_stabilization->manualRoll->value(); - stabData.ManualRate[StabilizationSettings::MANUALRATE_PITCH] = m_stabilization->manualPitch->value(); - stabData.ManualRate[StabilizationSettings::MANUALRATE_YAW] = m_stabilization->manualYaw->value(); - - stabData.MaximumRate[StabilizationSettings::MAXIMUMRATE_ROLL] = m_stabilization->maximumRoll->value(); - stabData.MaximumRate[StabilizationSettings::MAXIMUMRATE_PITCH] = m_stabilization->maximumPitch->value(); - stabData.MaximumRate[StabilizationSettings::MAXIMUMRATE_YAW] = m_stabilization->maximumYaw->value(); - - stabData.LowThrottleZeroIntegral = (m_stabilization->lowThrottleZeroIntegral->isChecked() ? StabilizationSettings::LOWTHROTTLEZEROINTEGRAL_TRUE :StabilizationSettings::LOWTHROTTLEZEROINTEGRAL_FALSE); - - stabSettings->setData(stabData); // this is atomic -} - -void ConfigStabilizationWidget::realtimeUpdateToggle(bool state) -{ - if (state) { - updateTimer.start(300); - } else { - updateTimer.stop(); - } -} - -void ConfigStabilizationWidget::resetToDefaults() -{ - StabilizationSettings stabDefaults; - StabilizationSettings::DataFields defaults = stabDefaults.getData(); - bool dirty=isDirty(); - refreshUIValues(defaults); - setDirty(dirty); -} - -void ConfigStabilizationWidget::openHelp() -{ - QDesktopServices::openUrl( QUrl("http://wiki.openpilot.org/display/Doc/Stabilization+panel", QUrl::StrictMode) ); -} diff --git a/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.h b/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.h index b502dd25e..266b59ae9 100644 --- a/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.h +++ b/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.h @@ -28,7 +28,7 @@ #define CONFIGSTABILIZATIONWIDGET_H #include "ui_stabilization.h" -#include "configtaskwidget.h" +#include "../uavobjectwidgetutils/configtaskwidget.h" #include "extensionsystem/pluginmanager.h" #include "uavobjectmanager.h" #include "uavobject.h" @@ -47,32 +47,11 @@ public: private: Ui_StabilizationWidget *m_stabilization; - StabilizationSettings* stabSettings; - QTimer updateTimer; - void refreshUIValues(StabilizationSettings::DataFields &stabData); - + QTimer * realtimeUpdates; private slots: - virtual void refreshWidgetsValues(); - void updateObjectsFromWidgets(); - void realtimeUpdateToggle(bool); - void resetToDefaults(); - void openHelp(); - - void updateRateRollKP(double); - void updateRateRollKI(double); - void updateRateRollILimit(double); - - void updateRatePitchKP(double); - void updateRatePitchKI(double); - void updateRatePitchILimit(double); - - void updateRollKP(double); - void updateRollKI(double); - void updateRollILimit(double); - - void updatePitchKP(double); - void updatePitchKI(double); - void updatePitchILimit(double); + void realtimeUpdatesSlot(int); + void linkCheckBoxes(int value); + void processLinkedWidgets(QWidget*); }; -#endif // CONFIGSTABILIZATIONWIDGET_H +#endif // ConfigStabilizationWidget_H diff --git a/ground/openpilotgcs/src/plugins/config/configtaskwidget.cpp b/ground/openpilotgcs/src/plugins/config/configtaskwidget.cpp deleted file mode 100644 index c7a082507..000000000 --- a/ground/openpilotgcs/src/plugins/config/configtaskwidget.cpp +++ /dev/null @@ -1,365 +0,0 @@ -/** - ****************************************************************************** - * - * @file configtaskwidget.cpp - * @author E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup ConfigPlugin Config Plugin - * @{ - * @brief The Configuration Gadget used to update settings in the firmware - *****************************************************************************/ -/* - * This program 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. - * - * This program 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 this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include "configtaskwidget.h" -#include -#include "uavsettingsimportexport/uavsettingsimportexportfactory.h" -#include "configgadgetwidget.h" - -ConfigTaskWidget::ConfigTaskWidget(QWidget *parent) : QWidget(parent),isConnected(false),smartsave(NULL),dirty(false) -{ - pm = ExtensionSystem::PluginManager::instance(); - objManager = pm->getObject(); - connect((ConfigGadgetWidget*)parent, SIGNAL(autopilotConnected()),this, SLOT(onAutopilotConnect())); - connect((ConfigGadgetWidget*)parent, SIGNAL(autopilotDisconnected()),this, SLOT(onAutopilotDisconnect())); - UAVSettingsImportExportFactory * importexportplugin = pm->getObject(); - connect(importexportplugin,SIGNAL(importAboutToBegin()),this,SLOT(invalidateObjects())); -} -void ConfigTaskWidget::addWidget(QWidget * widget) -{ - addUAVObjectToWidgetRelation("","",widget); -} -void ConfigTaskWidget::addUAVObject(QString objectName) -{ - addUAVObjectToWidgetRelation(objectName,"",NULL); -} -void ConfigTaskWidget::addUAVObjectToWidgetRelation(QString object, QString field, QWidget * widget, QString index) -{ - UAVObject *obj=NULL; - UAVObjectField *_field=NULL; - obj = objManager->getObject(QString(object)); - Q_ASSERT(obj); - _field = obj->getField(QString(field)); - Q_ASSERT(_field); - addUAVObjectToWidgetRelation(object,field,widget,_field->getElementNames().indexOf(index)); -} - -void ConfigTaskWidget::addUAVObjectToWidgetRelation(QString object, QString field, QWidget * widget, int index,int scale) -{ - UAVObject *obj=NULL; - UAVObjectField *_field=NULL; - if(!object.isEmpty()) - { - obj = objManager->getObject(QString(object)); - Q_ASSERT(obj); - objectUpdates.insert(obj,true); - connect(obj, SIGNAL(objectUpdated(UAVObject*)),this, SLOT(objectUpdated(UAVObject*))); - connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshWidgetsValues())); - } - //smartsave->addObject(obj); - if(!field.isEmpty() && obj) - _field = obj->getField(QString(field)); - objectToWidget * ow=new objectToWidget(); - ow->field=_field; - ow->object=obj; - ow->widget=widget; - ow->index=index; - ow->scale=scale; - objOfInterest.append(ow); - if(obj) - smartsave->addObject((UAVDataObject*)obj); - if(widget==NULL) - { - // do nothing - } - else if(QComboBox * cb=qobject_cast(widget)) - { - connect(cb,SIGNAL(currentIndexChanged(int)),this,SLOT(widgetsContentsChanged())); - } - else if(QSlider * cb=qobject_cast(widget)) - { - connect(cb,SIGNAL(sliderMoved(int)),this,SLOT(widgetsContentsChanged())); - } - else if(MixerCurveWidget * cb=qobject_cast(widget)) - { - connect(cb,SIGNAL(curveUpdated(QList,double)),this,SLOT(widgetsContentsChanged())); - } - else if(QTableWidget * cb=qobject_cast(widget)) - { - connect(cb,SIGNAL(cellChanged(int,int)),this,SLOT(widgetsContentsChanged())); - } - else if(QSpinBox * cb=qobject_cast(widget)) - { - connect(cb,SIGNAL(valueChanged(int)),this,SLOT(widgetsContentsChanged())); - } - else if(QDoubleSpinBox * cb=qobject_cast(widget)) - { - connect(cb,SIGNAL(valueChanged(double)),this,SLOT(widgetsContentsChanged())); - } - else if(QCheckBox * cb=qobject_cast(widget)) - { - connect(cb,SIGNAL(clicked()),this,SLOT(widgetsContentsChanged())); - } - else if(QPushButton * cb=qobject_cast(widget)) - { - connect(cb,SIGNAL(clicked()),this,SLOT(widgetsContentsChanged())); - } - -} - - -ConfigTaskWidget::~ConfigTaskWidget() -{ - delete smartsave; -} - -void ConfigTaskWidget::saveObjectToSD(UAVObject *obj) -{ - qDebug()<<"ConfigTaskWidget::saveObjectToSD"; - // saveObjectToSD is now handled by the UAVUtils plugin in one - // central place (and one central queue) - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - UAVObjectUtilManager* utilMngr = pm->getObject(); - utilMngr->saveObjectToSD(obj); -} - - -UAVObjectManager* ConfigTaskWidget::getObjectManager() { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - UAVObjectManager * objMngr = pm->getObject(); - Q_ASSERT(objMngr); - return objMngr; -} - -double ConfigTaskWidget::listMean(QList list) -{ - double accum = 0; - for(int i = 0; i < list.size(); i++) - accum += list[i]; - return accum / list.size(); -} - -// ************************************ -// telemetry start/stop connect/disconnect signals - -void ConfigTaskWidget::onAutopilotDisconnect() -{ - isConnected=false; - enableControls(false); - invalidateObjects(); -} - -void ConfigTaskWidget::onAutopilotConnect() -{ - invalidateObjects(); - dirty=false; - isConnected=true; - enableControls(true); - refreshWidgetsValues(); -} - -void ConfigTaskWidget::populateWidgets() -{ - bool dirtyBack=dirty; - foreach(objectToWidget * ow,objOfInterest) - { - if(ow->object==NULL || ow->field==NULL) - { - // do nothing - } - else if(QComboBox * cb=qobject_cast(ow->widget)) - { - cb->addItems(ow->field->getOptions()); - cb->setCurrentIndex(cb->findText(ow->field->getValue(ow->index).toString())); - } - else if(QLabel * cb=qobject_cast(ow->widget)) - { - cb->setText(ow->field->getValue(ow->index).toString()); - } - else if(QSpinBox * cb=qobject_cast(ow->widget)) - { - cb->setValue(ow->field->getValue(ow->index).toInt()/ow->scale); - } - else if(QSlider * cb=qobject_cast(ow->widget)) - { - cb->setValue(ow->field->getValue(ow->index).toInt()/ow->scale); - } - else if(QCheckBox * cb=qobject_cast(ow->widget)) - { - cb->setChecked(ow->field->getValue(ow->index).toBool()); - } - } - setDirty(dirtyBack); -} - -void ConfigTaskWidget::refreshWidgetsValues() -{ - bool dirtyBack=dirty; - foreach(objectToWidget * ow,objOfInterest) - { - if(ow->object==NULL || ow->field==NULL) - { - //do nothing - } - else if(QComboBox * cb=qobject_cast(ow->widget)) - { - cb->setCurrentIndex(cb->findText(ow->field->getValue(ow->index).toString())); - } - else if(QLabel * cb=qobject_cast(ow->widget)) - { - cb->setText(ow->field->getValue(ow->index).toString()); - } - else if(QSpinBox * cb=qobject_cast(ow->widget)) - { - cb->setValue(ow->field->getValue(ow->index).toInt()/ow->scale); - } - else if(QSlider * cb=qobject_cast(ow->widget)) - { - cb->setValue(ow->field->getValue(ow->index).toInt()/ow->scale); - } - else if(QCheckBox * cb=qobject_cast(ow->widget)) - { - cb->setChecked(ow->field->getValue(ow->index).toBool()); - } - } - setDirty(dirtyBack); -} - -void ConfigTaskWidget::updateObjectsFromWidgets() -{ - foreach(objectToWidget * ow,objOfInterest) - { - if(ow->object==NULL || ow->field==NULL) - { - //do nothing - } - else if(QComboBox * cb=qobject_cast(ow->widget)) - { - ow->field->setValue(cb->currentText(),ow->index); - } - else if(QLabel * cb=qobject_cast(ow->widget)) - { - ow->field->setValue(cb->text(),ow->index); - } - else if(QSpinBox * cb=qobject_cast(ow->widget)) - { - ow->field->setValue(cb->value()* ow->scale,ow->index); - } - else if(QSlider * cb=qobject_cast(ow->widget)) - { - ow->field->setValue(cb->value()* ow->scale,ow->index); - } - else if(QCheckBox * cb=qobject_cast(ow->widget)) - { - ow->field->setValue((cb->isChecked()?"TRUE":"FALSE"),ow->index); - } - } -} - -void ConfigTaskWidget::setupButtons(QPushButton *update, QPushButton *save) -{ - smartsave=new smartSaveButton(update,save); - connect(smartsave,SIGNAL(preProcessOperations()), this, SLOT(updateObjectsFromWidgets())); - connect(smartsave,SIGNAL(saveSuccessfull()),this,SLOT(clearDirty())); - connect(smartsave,SIGNAL(beginOp()),this,SLOT(disableObjUpdates())); - connect(smartsave,SIGNAL(endOp()),this,SLOT(enableObjUpdates())); - enableControls(false); -} - -void ConfigTaskWidget::enableControls(bool enable) -{ - if(smartsave) - smartsave->enableControls(enable); -} - -void ConfigTaskWidget::widgetsContentsChanged() -{ - setDirty(true); -} - -void ConfigTaskWidget::clearDirty() -{ - setDirty(false); -} -void ConfigTaskWidget::setDirty(bool value) -{ - dirty=value; -} -bool ConfigTaskWidget::isDirty() -{ - if(isConnected) - return dirty; - else - return false; -} - -void ConfigTaskWidget::refreshValues() -{ -} - -void ConfigTaskWidget::disableObjUpdates() -{ - foreach(objectToWidget * obj,objOfInterest) - { - if(obj->object) - disconnect(obj->object, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshWidgetsValues())); - } -} - -void ConfigTaskWidget::enableObjUpdates() -{ - foreach(objectToWidget * obj,objOfInterest) - { - if(obj->object) - connect(obj->object, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshWidgetsValues())); - } -} - -void ConfigTaskWidget::objectUpdated(UAVObject *obj) -{ - objectUpdates[obj]=true; -} - -bool ConfigTaskWidget::allObjectsUpdated() -{ - bool ret=true; - foreach(UAVObject *obj, objectUpdates.keys()) - { - ret=ret & objectUpdates[obj]; - } - qDebug()<<"ALL OBJECTS UPDATE:"< -#include -#include -#include -#include "smartsavebutton.h" -#include "mixercurvewidget.h" -#include -#include -#include -#include -#include - -class ConfigTaskWidget: public QWidget -{ - Q_OBJECT - -public: - struct objectToWidget - { - UAVObject * object; - UAVObjectField * field; - QWidget * widget; - int index; - int scale; - }; - - ConfigTaskWidget(QWidget *parent = 0); - ~ConfigTaskWidget(); - void saveObjectToSD(UAVObject *obj); - UAVObjectManager* getObjectManager(); - static double listMean(QList list); - void addUAVObject(QString objectName); - void addWidget(QWidget * widget); - void addUAVObjectToWidgetRelation(QString object,QString field,QWidget * widget,int index=0,int scale=1); - - void setupButtons(QPushButton * update,QPushButton * save); - bool isDirty(); - void setDirty(bool value); - void addUAVObjectToWidgetRelation(QString object, QString field, QWidget *widget, QString index); - bool allObjectsUpdated(); -public slots: - void onAutopilotDisconnect(); - void onAutopilotConnect(); - void invalidateObjects(); - -private slots: - virtual void refreshValues(); - virtual void updateObjectsFromWidgets(); - void objectUpdated(UAVObject*); -private: - bool isConnected; - QStringList objectsList; - QList objOfInterest; - ExtensionSystem::PluginManager *pm; - UAVObjectManager *objManager; - smartSaveButton *smartsave; - QMap objectUpdates; - bool dirty; -protected slots: - virtual void disableObjUpdates(); - virtual void enableObjUpdates(); - virtual void clearDirty(); - virtual void widgetsContentsChanged(); - virtual void populateWidgets(); - virtual void refreshWidgetsValues(); -protected: - virtual void enableControls(bool enable); - -}; - -#endif // CONFIGTASKWIDGET_H diff --git a/ground/openpilotgcs/src/plugins/config/defaultattitudewidget.h b/ground/openpilotgcs/src/plugins/config/defaultattitudewidget.h index 5541eee37..8eb5cfa34 100644 --- a/ground/openpilotgcs/src/plugins/config/defaultattitudewidget.h +++ b/ground/openpilotgcs/src/plugins/config/defaultattitudewidget.h @@ -28,7 +28,7 @@ #define DEFAULTATTITUDEWIDGET_H #include "ui_defaultattitude.h" -#include "configtaskwidget.h" +#include "../uavobjectwidgetutils/configtaskwidget.h" #include "extensionsystem/pluginmanager.h" #include "uavobjectmanager.h" #include "uavobject.h" diff --git a/ground/openpilotgcs/src/plugins/config/defaulthwsettingswidget.h b/ground/openpilotgcs/src/plugins/config/defaulthwsettingswidget.h index e94435f8d..1d498c35a 100644 --- a/ground/openpilotgcs/src/plugins/config/defaulthwsettingswidget.h +++ b/ground/openpilotgcs/src/plugins/config/defaulthwsettingswidget.h @@ -28,7 +28,7 @@ #define DEFAULTHWSETTINGSt_H #include "ui_defaulthwsettings.h" -#include "configtaskwidget.h" +#include "../uavobjectwidgetutils/configtaskwidget.h" #include "extensionsystem/pluginmanager.h" #include "uavobjectmanager.h" #include "uavobject.h" diff --git a/ground/openpilotgcs/src/plugins/config/smartsavebutton.h b/ground/openpilotgcs/src/plugins/config/smartsavebutton.h deleted file mode 100644 index 9253de51d..000000000 --- a/ground/openpilotgcs/src/plugins/config/smartsavebutton.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef SMARTSAVEBUTTON_H -#define SMARTSAVEBUTTON_H - -#include "uavtalk/telemetrymanager.h" -#include "extensionsystem/pluginmanager.h" -#include "uavobjectmanager.h" -#include "uavobject.h" -#include -#include -#include -#include "uavobjectutilmanager.h" -#include -#include -class smartSaveButton:public QObject -{ -public: - Q_OBJECT -public: - smartSaveButton(QPushButton * update,QPushButton * save); - void setObjects(QList); - void addObject(UAVDataObject *); - void clearObjects(); -signals: - void preProcessOperations(); - void saveSuccessfull(); - void beginOp(); - void endOp(); -private slots: - void processClick(); - void transaction_finished(UAVObject* obj, bool result); - void saving_finished(int,bool); - -private: - QPushButton *bupdate; - QPushButton *bsave; - quint32 current_objectID; - UAVDataObject * current_object; - bool up_result; - bool sv_result; - QEventLoop loop; - QList objects; -protected: -public slots: - void enableControls(bool value); - -}; - - -#endif // SMARTSAVEBUTTON_H diff --git a/ground/openpilotgcs/src/plugins/config/stabilization.ui b/ground/openpilotgcs/src/plugins/config/stabilization.ui index f99b35b94..52c1e0d38 100644 --- a/ground/openpilotgcs/src/plugins/config/stabilization.ui +++ b/ground/openpilotgcs/src/plugins/config/stabilization.ui @@ -1,829 +1,22480 @@ - - - StabilizationWidget - - - - 0 - 0 - 683 - 685 - - - - Form - - - - - - - 0 - 1 - - - - QFrame::NoFrame - - - true - - - - - 0 - 0 - 665 - 627 - - - - - 0 - 0 - - - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 0 - 150 - - - - Rate Stabilization Coefficients (Inner Loop) - - - - - - Kp - - - Qt::AlignCenter - - - - - - - Ki - - - Qt::AlignCenter - - - - - - - ILimit - - - Qt::AlignCenter - - - - - - - Roll - - - - - - - Slowly raise Kp until you start seeing clear oscillations when you fly. -Then lower the value by 20% or so. - - - 6 - - - 0.000100000000000 - - - - - - - I factor for rate stabilization is usually very low or even zero. - - - 6 - - - 0.000100000000000 - - - - - - - 6 - - - 0.000100000000000 - - - - - - - If checked, the Roll and Pitch factors will be identical. -When you change one, the other is updated. - - - Link - - - - - - - Pitch - - - - - - - Slowly raise Kp until you start seeing clear oscillations when you fly. -Then lower the value by 20% or so. - - - 6 - - - 0.000100000000000 - - - - - - - I factor for rate stabilization is usually very low or even zero. - - - 6 - - - 0.000100000000000 - - - - - - - 6 - - - 0.000100000000000 - - - - - - - Yaw - - - - - - - Slowly raise Kp until you start seeing clear oscillations when you fly. -Then lower the value by 20% or so. - -You can usually go for higher values for Yaw factors. - - - 6 - - - 0.000100000000000 - - - - - - - As a rule of thumb, you can set YawRate Ki at roughly the same -value as YawRate Kp. - - - 6 - - - 0.000100000000000 - - - - - - - 6 - - - 0.000100000000000 - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 13 - - - - - - - - - 0 - 0 - - - - - 0 - 150 - - - - Attitude Stabization Coefficients (Outer Loop) - - - - - - Once Rate stabilization is done, you should increase the Kp factor until the airframe oscillates again, and go back down 20% or so. - - - - 6 - - - 0.100000000000000 - - - - - - - Ki can usually be almost identical to Kp. - - - 6 - - - 0.100000000000000 - - - - - - - ILimit can be equal to three to four times Ki, but you can adjust -depending on whether your airframe is well balanced, and your -flying style. - - - 6 - - - 0.100000000000000 - - - - - - - Kp - - - Qt::AlignCenter - - - - - - - Ki - - - Qt::AlignCenter - - - - - - - ILimit - - - Qt::AlignCenter - - - - - - - ILimit can be equal to three to four times Ki, but you can adjust -depending on whether your airframe is well balanced, and your -flying style. - - - 6 - - - 0.100000000000000 - - - - - - - Ki can usually be almost identical to Kp. - - - 6 - - - 0.100000000000000 - - - - - - - Once Rate stabilization is done, you should increase the Kp factor until the airframe oscillates again, and go back down 20% or so. - - - - 6 - - - 0.100000000000000 - - - - - - - Once Rate stabilization is done, you should increase the Kp factor until the airframe oscillates again, and go back down 20% or so. - - - - 6 - - - 0.100000000000000 - - - - - - - Yaw - - - - - - - Pitch - - - - - - - Roll - - - - - - - Ki can usually be almost identical to Kp. - - - 6 - - - 0.100000000000000 - - - - - - - ILimit can be equal to three to four times Ki, but you can adjust -depending on whether your airframe is well balanced, and your -flying style. - - - 6 - - - 0.100000000000000 - - - - - - - If checked, the Roll and Pitch factors will be identical. -When you change one, the other is updated. - - - Link - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 13 - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Stick range and limits - - - - QLayout::SetMinAndMaxSize - - - - - Roll - - - Qt::AlignCenter - - - - - - - Pitch - - - Qt::AlignCenter - - - - - - - Yaw - - - Qt::AlignCenter - - - - - - - 180 - - - - - - - 180 - - - - - - - 180 - - - - - - - - 150 - 0 - - - - - 50 - false - - - - Full stick angle (deg) - - - - - - - - 150 - 0 - - - - - 50 - false - - - - Full stick rate (deg/s) - - - - - - - 500 - - - - - - - 500 - - - - - - - 500 - - - - - - - - 150 - 0 - - - - - 50 - false - - - - - - - Maximum rate in attitude mode (deg/s) - - - - - - - 500 - - - - - - - 500 - - - - - - - 500 - - - - - - - - - - Zero the integral when throttle is low - - - - - - - Qt::Vertical - - - - 20 - 0 - - - - - - - - - - - - - - If you check this, the GCS will udpate the stabilization factors -automatically every 300ms, which will help for fast tuning. - - - Update in real time - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 32 - 32 - - - - - - - - :/core/images/helpicon.svg:/core/images/helpicon.svg - - - - 32 - 32 - - - - true - - - - - - - Load default Stabilization settings - -Loaded settings are not applied automatically. You have to click the -Apply or Save button afterwards. - - - Reset To Defaults - - - - - - - Send settings to the board but do not save to the non-volatile memory - - - Apply - - - - - - - Send settings to the board and save to the non-volatile memory - - - Save - - - - - - - - - scrollArea - rateRollKp - rateRollKi - rateRollILimit - linkRateRP - ratePitchKp - ratePitchKi - ratePitchILimit - rateYawKp - rateYawKi - rateYawILimit - rollKp - rollKi - rollILimit - linkAttitudeRP - pitchKp - pitchKi - pitchILimit - yawKp - yawKi - yawILimit - rollMax - pitchMax - yawMax - manualRoll - manualPitch - manualYaw - maximumRoll - maximumPitch - maximumYaw - lowThrottleZeroIntegral - realTimeUpdates - stabilizationHelp - stabilizationResetToDefaults - saveStabilizationToRAM - saveStabilizationToSD - - - - - - + + + StabilizationWidget + + + + 0 + 0 + 683 + 685 + + + + + + + + + 0 + 0 + 0 + + + + + + + 240 + 240 + 240 + + + + + + + 255 + 255 + 255 + + + + + + + 247 + 247 + 247 + + + + + + + 120 + 120 + 120 + + + + + + + 160 + 160 + 160 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 240 + 240 + 240 + + + + + + + 0 + 0 + 0 + + + + + + + 247 + 247 + 247 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 240 + 240 + 240 + + + + + + + 255 + 255 + 255 + + + + + + + 247 + 247 + 247 + + + + + + + 120 + 120 + 120 + + + + + + + 160 + 160 + 160 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 240 + 240 + 240 + + + + + + + 0 + 0 + 0 + + + + + + + 247 + 247 + 247 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 120 + 120 + 120 + + + + + + + 240 + 240 + 240 + + + + + + + 255 + 255 + 255 + + + + + + + 247 + 247 + 247 + + + + + + + 120 + 120 + 120 + + + + + + + 160 + 160 + 160 + + + + + + + 120 + 120 + 120 + + + + + + + 255 + 255 + 255 + + + + + + + 120 + 120 + 120 + + + + + + + 240 + 240 + 240 + + + + + + + 240 + 240 + 240 + + + + + + + 0 + 0 + 0 + + + + + + + 240 + 240 + 240 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + Stabilization + + + false + + + + 30 + 30 + + + + false + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Qt::TabFocus + + + true + + + true + + + QTabWidget::North + + + 1 + + + true + + + + Basic + + + + + + QFrame::NoFrame + + + 0 + + + true + + + + + 0 + 0 + 626 + 842 + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + + 0 + 16 + + + + + 9 + 75 + true + + + + Rate Stabilization (Inner Loop) + + + + + + + + 0 + 0 + + + + + 0 + 181 + + + + + 16777215 + 181 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 124 + 124 + 124 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 124 + 124 + 124 + + + + + + + 255 + 255 + 255 + + + + + + + 124 + 124 + 124 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 248 + 248 + 248 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + false + + + #RateStabilizationGroup_15{background-color: qlineargradient(spread:pad, x1:0.507, y1:0.869318, x2:0.507, y2:0.0965909, stop:0 rgba(243, 243, 243, 255), stop:1 rgba(250, 250, 250, 255));} + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 10 + + + + + + + + + 0 + 0 + + + + + + + Link Roll and Pitch + + + + + + + + 0 + 0 + + + + + 81 + 28 + + + + + 81 + 28 + + + + false + + + QPushButton { +border: 1px outset #999; +border-radius: 5; +background-color: qlineargradient(spread:pad, x1:0.507, y1:0.869318, x2:0.507, y2:0.0965909, stop:0.28 rgba(236, 236, 236, 255), stop:1 rgba(252, 252, 252, 255)); +} + +QPushButton:pressed { + + border-style: inset; + background-color: qlineargradient(spread:pad, x1:0.502, y1:0.664864, x2:0.502, y2:0.034, stop:0.358209 rgba(250, 250, 250, 255), stop:0.626866 rgba(235, 235, 235, 255)); + +} + + +QPushButton:hover { + border: 1px outset #999; +border-color: rgb(83, 83, 83); +border-radius: 4; + } + + + Default + + + + button:default + buttongroup:1 + + + + + + + + + 0 + 0 + + + + + 51 + 28 + + + + + 51 + 28 + + + + false + + + QPushButton { +border: 1px outset #999; +border-radius: 5; +background-color: qlineargradient(spread:pad, x1:0.507, y1:0.869318, x2:0.507, y2:0.0965909, stop:0.28 rgba(236, 236, 236, 255), stop:1 rgba(252, 252, 252, 255)); +} + +QPushButton:pressed { + + border-style: inset; + background-color: qlineargradient(spread:pad, x1:0.502, y1:0.664864, x2:0.502, y2:0.034, stop:0.358209 rgba(250, 250, 250, 255), stop:0.626866 rgba(235, 235, 235, 255)); + +} + + +QPushButton:hover { + border: 1px outset #999; +border-color: rgb(83, 83, 83); +border-radius: 4; + } + + + Wiki + + + + button:help + url:http://wiki.openpilot.org/display/Doc/Stabilization+panel + + + + + + + + + 0 + 0 + + + + + 0 + 131 + + + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 124 + 124 + 124 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 124 + 124 + 124 + + + + + + + 255 + 255 + 255 + + + + + + + 124 + 124 + 124 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 248 + 248 + 248 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + false + + + + + + + + + true + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 39 + 39 + 39 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 75 + true + + + + false + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; + + + Roll + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 39 + 39 + 39 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 75 + true + + + + false + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; + + + Pitch + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 39 + 39 + 39 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 75 + true + + + + false + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; + + + Yaw + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 69 + 16 + + + + + + + Proportional + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 0 + 25 + + + + + + + 100 + + + 51 + + + 51 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 25 + + + + objname:StabilizationSettings + fieldname:RollRatePID + element:Kp + haslimits:yes + scale:0.0001 + buttongroup:1,10 + + + + + + + + + 0 + 0 + + + + + 21 + 16 + + + + + + + 50 + + + + objname:StabilizationSettings + fieldname:RollRatePID + element:Kp + haslimits:yes + scale:0.0001 + buttongroup:1,10 + + + + + + + + + 0 + 0 + + + + + 0 + 25 + + + + + + + 100 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 25 + + + + objname:StabilizationSettings + fieldname:PitchRatePID + element:Kp + haslimits:yes + scale:0.0001 + buttongroup:1,10 + + + + + + + + + 0 + 0 + + + + + 21 + 16 + + + + + + + 50 + + + + objname:StabilizationSettings + fieldname:PitchRatePID + element:Kp + haslimits:yes + scale:0.0001 + buttongroup:1,10 + + + + + + + + + 0 + 0 + + + + + 0 + 25 + + + + + + + 100 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 25 + + + + objname:StabilizationSettings + fieldname:YawRatePID + element:Kp + haslimits:yes + scale:0.0001 + buttongroup:1,10 + + + + + + + + + 0 + 0 + + + + + 21 + 16 + + + + + + + 50 + + + + objname:StabilizationSettings + fieldname:YawRatePID + element:Kp + haslimits:yes + scale:0.0001 + buttongroup:1,10 + + + + + + + + + 0 + 0 + + + + + + + Integral + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 0 + 25 + + + + + + + 100 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 25 + + + + objname:StabilizationSettings + fieldname:RollRatePID + element:Ki + haslimits:yes + scale:0.0001 + buttongroup:1,10 + + + + + + + + + 0 + 0 + + + + + 21 + 16 + + + + + + + 50 + + + + objname:StabilizationSettings + fieldname:RollRatePID + element:Ki + haslimits:yes + scale:0.0001 + buttongroup:1,10 + + + + + + + + + 0 + 0 + + + + + 0 + 25 + + + + + + + 100 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 25 + + + + objname:StabilizationSettings + fieldname:PitchRatePID + element:Ki + haslimits:yes + scale:0.0001 + buttongroup:1,10 + + + + + + + + + 0 + 0 + + + + + 21 + 16 + + + + + + + 50 + + + + objname:StabilizationSettings + fieldname:PitchRatePID + element:Ki + haslimits:yes + scale:0.0001 + buttongroup:1,10 + + + + + + + + + 0 + 0 + + + + + 0 + 25 + + + + + + + 100 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 25 + + + + objname:StabilizationSettings + fieldname:YawRatePID + element:Ki + haslimits:yes + scale:0.0001 + buttongroup:1,10 + + + + + + + + + 0 + 0 + + + + + 21 + 16 + + + + + + + 50 + + + + objname:StabilizationSettings + fieldname:YawRatePID + element:Ki + haslimits:yes + scale:0.0001 + buttongroup:1,10 + + + + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 15 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 13 + + + + + + + + + 0 + 16 + + + + + 9 + 75 + true + + + + Attitude Stabilization (Outer Loop) + + + + + + + + 0 + 0 + + + + + 0 + 181 + + + + + 16777215 + 181 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 124 + 124 + 124 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 124 + 124 + 124 + + + + + + + 255 + 255 + 255 + + + + + + + 124 + 124 + 124 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 248 + 248 + 248 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + false + + + #RateStabilizationGroup_17{background-color: qlineargradient(spread:pad, x1:0.507, y1:0.869318, x2:0.507, y2:0.0965909, stop:0 rgba(243, 243, 243, 255), stop:1 rgba(250, 250, 250, 255));} + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 10 + + + + + + + + + 0 + 0 + + + + + + + Link Roll and Pitch + + + + + + + + 0 + 0 + + + + + 81 + 28 + + + + + 81 + 28 + + + + QPushButton { +border: 1px outset #999; +border-radius: 5; +background-color: qlineargradient(spread:pad, x1:0.507, y1:0.869318, x2:0.507, y2:0.0965909, stop:0.28 rgba(236, 236, 236, 255), stop:1 rgba(252, 252, 252, 255)); +} + +QPushButton:pressed { + + border-style: inset; + background-color: qlineargradient(spread:pad, x1:0.502, y1:0.664864, x2:0.502, y2:0.034, stop:0.358209 rgba(250, 250, 250, 255), stop:0.626866 rgba(235, 235, 235, 255)); + +} + + +QPushButton:hover { + border: 1px outset #999; +border-color: rgb(83, 83, 83); +border-radius: 4; + } + + + Default + + + + button:default + buttongroup:2 + + + + + + + + + 0 + 0 + + + + + 0 + 131 + + + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 124 + 124 + 124 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 124 + 124 + 124 + + + + + + + 255 + 255 + 255 + + + + + + + 124 + 124 + 124 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 248 + 248 + 248 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + false + + + + + + + + + true + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 39 + 39 + 39 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 75 + true + + + + false + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; + + + Roll + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 39 + 39 + 39 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 75 + true + + + + false + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; + + + Pitch + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 39 + 39 + 39 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 75 + true + + + + false + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; + + + Yaw + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 69 + 16 + + + + + + + Proportional + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 0 + 25 + + + + + + + 100 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 25 + + + + objname:StabilizationSettings + fieldname:RollPI + element:Kp + scale:0.1 + haslimits:yes + buttongroup:2,10 + + + + + + + + + 0 + 0 + + + + + 21 + 16 + + + + + + + 50 + + + + objname:StabilizationSettings + fieldname:RollPI + element:Kp + scale:0.1 + haslimits:yes + buttongroup:2,10 + + + + + + + + + 0 + 0 + + + + + 0 + 25 + + + + + + + 100 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 25 + + + + objname:StabilizationSettings + fieldname:PitchPI + element:Kp + scale:0.1 + haslimits:yes + buttongroup:2,10 + + + + + + + + + 0 + 0 + + + + + 21 + 16 + + + + + + + 50 + + + + objname:StabilizationSettings + fieldname:PitchPI + element:Kp + scale:0.1 + haslimits:yes + buttongroup:2,10 + + + + + + + + + 0 + 0 + + + + + 0 + 25 + + + + + + + 100 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 25 + + + + objname:StabilizationSettings + fieldname:YawPI + element:Kp + scale:0.1 + haslimits:yes + buttongroup:2,10 + + + + + + + + + 0 + 0 + + + + + 21 + 16 + + + + + + + 50 + + + + objname:StabilizationSettings + fieldname:YawPI + element:Kp + scale:0.1 + haslimits:yes + buttongroup:2,10 + + + + + + + + + 0 + 0 + + + + + + + Integral + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 0 + 25 + + + + + + + 100 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 25 + + + + objname:StabilizationSettings + fieldname:RollPI + element:Ki + scale:0.1 + haslimits:yes + buttongroup:2,10 + + + + + + + + + 0 + 0 + + + + + 21 + 16 + + + + + + + 50 + + + + objname:StabilizationSettings + fieldname:RollPI + element:Ki + scale:0.1 + haslimits:yes + buttongroup:2,10 + + + + + + + + + 0 + 0 + + + + + 0 + 25 + + + + + + + 100 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 25 + + + + objname:StabilizationSettings + fieldname:PitchPI + element:Ki + scale:0.1 + haslimits:yes + buttongroup:2,10 + + + + + + + + + 0 + 0 + + + + + 21 + 16 + + + + + + + 50 + + + + objname:StabilizationSettings + fieldname:PitchPI + element:Ki + scale:0.1 + haslimits:yes + buttongroup:2,10 + + + + + + + + + 0 + 0 + + + + + 0 + 25 + + + + + + + 100 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 25 + + + + objname:StabilizationSettings + fieldname:YawPI + element:Ki + scale:0.1 + haslimits:yes + buttongroup:2,10 + + + + + + + + + 0 + 0 + + + + + 21 + 16 + + + + + + + 50 + + + + objname:StabilizationSettings + fieldname:YawPI + element:Ki + scale:0.1 + haslimits:yes + buttongroup:2,10 + + + + + + + + + + + + 0 + 0 + + + + + 51 + 28 + + + + + 51 + 28 + + + + QPushButton { +border: 1px outset #999; +border-radius: 5; +background-color: qlineargradient(spread:pad, x1:0.507, y1:0.869318, x2:0.507, y2:0.0965909, stop:0.28 rgba(236, 236, 236, 255), stop:1 rgba(252, 252, 252, 255)); +} + +QPushButton:pressed { + + border-style: inset; + background-color: qlineargradient(spread:pad, x1:0.502, y1:0.664864, x2:0.502, y2:0.034, stop:0.358209 rgba(250, 250, 250, 255), stop:0.626866 rgba(235, 235, 235, 255)); + +} + + +QPushButton:hover { + border: 1px outset #999; +border-color: rgb(83, 83, 83); +border-radius: 4; + } + + + Wiki + + + + button:help + url:http://wiki.openpilot.org/display/Doc/Stabilization+panel + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 2 + 10 + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 15 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 13 + + + + + + + + + 0 + 16 + + + + + 9 + 75 + true + + + + Stick Range and Limits + + + + + + + + 0 + 0 + + + + + 0 + 211 + + + + + 16777215 + 211 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 124 + 124 + 124 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 124 + 124 + 124 + + + + + + + 255 + 255 + 255 + + + + + + + 124 + 124 + 124 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 248 + 248 + 248 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + false + + + #RateStabilizationGroup_19{background-color: qlineargradient(spread:pad, x1:0.507, y1:0.869318, x2:0.507, y2:0.0965909, stop:0 rgba(243, 243, 243, 255), stop:1 rgba(250, 250, 250, 255));} + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 10 + 10 + + + + + + + + + 0 + 0 + + + + + 51 + 28 + + + + + 51 + 28 + + + + QPushButton { +border: 1px outset #999; +border-radius: 5; +background-color: qlineargradient(spread:pad, x1:0.507, y1:0.869318, x2:0.507, y2:0.0965909, stop:0.28 rgba(236, 236, 236, 255), stop:1 rgba(252, 252, 252, 255)); +} + +QPushButton:pressed { + + border-style: inset; + background-color: qlineargradient(spread:pad, x1:0.502, y1:0.664864, x2:0.502, y2:0.034, stop:0.358209 rgba(250, 250, 250, 255), stop:0.626866 rgba(235, 235, 235, 255)); + +} + + +QPushButton:hover { + border: 1px outset #999; +border-color: rgb(83, 83, 83); +border-radius: 4; + } + + + Wiki + + + + button:help + url:http://wiki.openpilot.org/display/Doc/Stabilization+panel + + + + + + + + + 0 + 0 + + + + + 81 + 28 + + + + + 81 + 28 + + + + QPushButton { +border: 1px outset #999; +border-radius: 5; +background-color: qlineargradient(spread:pad, x1:0.507, y1:0.869318, x2:0.507, y2:0.0965909, stop:0.28 rgba(236, 236, 236, 255), stop:1 rgba(252, 252, 252, 255)); +} + +QPushButton:pressed { + + border-style: inset; + background-color: qlineargradient(spread:pad, x1:0.502, y1:0.664864, x2:0.502, y2:0.034, stop:0.358209 rgba(250, 250, 250, 255), stop:0.626866 rgba(235, 235, 235, 255)); + +} + + +QPushButton:hover { + border: 1px outset #999; +border-color: rgb(83, 83, 83); +border-radius: 4; + } + + + Default + + + + button:default + buttongroup:3 + + + + + + + + + 0 + 0 + + + + + 0 + 161 + + + + + 16777215 + 161 + + + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 124 + 124 + 124 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 124 + 124 + 124 + + + + + + + 255 + 255 + 255 + + + + + + + 124 + 124 + 124 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 248 + 248 + 248 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + false + + + + + + + + + true + + + + 11 + + + + + + 0 + 0 + + + + + 0 + 16 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 39 + 39 + 39 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 75 + true + + + + false + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; + + + Roll + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 39 + 39 + 39 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 75 + true + + + + false + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; + + + Pitch + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 39 + 39 + 39 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 75 + true + + + + false + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; + + + Yaw + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 69 + 16 + + + + + + + Full Stick +Angle + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 0 + 25 + + + + + + + 100 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 25 + + + + objname:StabilizationSettings + fieldname:RollMax + haslimits:yes + scale:1.8 + buttongroup:3,10 + + + + + + + + + 0 + 0 + + + + + 21 + 16 + + + + + + + 50 + + + + objname:StabilizationSettings + fieldname:RollMax + haslimits:yes + scale:1.8 + buttongroup:3,10 + + + + + + + + + 0 + 0 + + + + + 0 + 25 + + + + + + + 100 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 25 + + + + objname:StabilizationSettings + fieldname:PitchMax + haslimits:yes + scale:1.8 + buttongroup:3,10 + + + + + + + + + 0 + 0 + + + + + 21 + 16 + + + + + + + 50 + + + + objname:StabilizationSettings + fieldname:PitchMax + haslimits:yes + scale:1.8 + buttongroup:3,10 + + + + + + + + + 0 + 0 + + + + + 0 + 25 + + + + + + + 100 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 25 + + + + objname:StabilizationSettings + fieldname:YawMax + haslimits:yes + scale:1.8 + buttongroup:3,10 + + + + + + + + + 0 + 0 + + + + + 21 + 16 + + + + + + + 50 + + + + objname:StabilizationSettings + fieldname:YawMax + haslimits:yes + scale:1.8 + buttongroup:3,10 + + + + + + + + + 0 + 0 + + + + + + + Full Stick +Rate + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 0 + 25 + + + + + + + 100 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 25 + + + + objname:StabilizationSettings + fieldname:ManualRate + element:Roll + haslimits:yes + scale:5 + buttongroup:3,10 + + + + + + + + + 0 + 0 + + + + + 21 + 16 + + + + + + + 50 + + + + objname:StabilizationSettings + fieldname:ManualRate + element:Roll + haslimits:yes + scale:5 + buttongroup:3,10 + + + + + + + + + 0 + 0 + + + + + 0 + 25 + + + + + + + 100 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 25 + + + + objname:StabilizationSettings + fieldname:ManualRate + element:Pitch + haslimits:yes + scale:5 + buttongroup:3,10 + + + + + + + + + 0 + 0 + + + + + 21 + 16 + + + + + + + 50 + + + + objname:StabilizationSettings + fieldname:ManualRate + element:Pitch + haslimits:yes + scale:5 + buttongroup:3,10 + + + + + + + + + 0 + 0 + + + + + 0 + 25 + + + + + + + 100 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 25 + + + + objname:StabilizationSettings + fieldname:ManualRate + element:Yaw + haslimits:yes + scale:5 + buttongroup:3,10 + + + + + + + + + 0 + 0 + + + + + 21 + 16 + + + + + + + 50 + + + + objname:StabilizationSettings + fieldname:ManualRate + element:Yaw + haslimits:yes + scale:5 + buttongroup:3,10 + + + + + + + + + 0 + 0 + + + + + + + Max Rate in +Attitude + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 0 + 25 + + + + + + + 100 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 25 + + + + objname:StabilizationSettings + fieldname:MaximumRate + element:Roll + haslimits:yes + scale:5 + buttongroup:3,10 + + + + + + + + + 0 + 0 + + + + + 21 + 16 + + + + + + + 50 + + + + objname:StabilizationSettings + fieldname:MaximumRate + element:Roll + haslimits:yes + scale:5 + buttongroup:3,10 + + + + + + + + + 0 + 0 + + + + + 0 + 25 + + + + + + + 100 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 25 + + + + objname:StabilizationSettings + fieldname:MaximumRate + element:Pitch + haslimits:yes + scale:5 + buttongroup:3,10 + + + + + + + + + 0 + 0 + + + + + 21 + 16 + + + + + + + 50 + + + + objname:StabilizationSettings + fieldname:MaximumRate + element:Pitch + haslimits:yes + scale:5 + buttongroup:3,10 + + + + + + + + + 0 + 0 + + + + + 0 + 25 + + + + + + + 100 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 25 + + + + objname:StabilizationSettings + fieldname:MaximumRate + element:Yaw + haslimits:yes + scale:5 + buttongroup:3,10 + + + + + + + + + 0 + 0 + + + + + 21 + 16 + + + + + + + 50 + + + + objname:StabilizationSettings + fieldname:MaximumRate + element:Yaw + haslimits:yes + scale:5 + buttongroup:3,10 + + + + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + Qt::Vertical + + + QSizePolicy::Preferred + + + + 20 + 180 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 2 + 10 + + + + + + + + + 0 + 0 + + + + + 0 + 79 + + + + + 16777215 + 79 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 124 + 124 + 124 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 124 + 124 + 124 + + + + + + + 255 + 255 + 255 + + + + + + + 124 + 124 + 124 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 248 + 248 + 248 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + false + + + #RateStabilizationGroup_21{background-color: qlineargradient(spread:pad, x1:0.507, y1:0.869318, x2:0.507, y2:0.0965909, stop:0 rgba(243, 243, 243, 255), stop:1 rgba(250, 250, 250, 255));} + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + 0 + 0 + + + + + 239 + 20 + + + + + + + Zero the integral when throttle is low + + + + objname:StabilizationSettings + fieldname:LowThrottleZeroIntegral + + + + + + + + + 0 + 0 + + + + + 136 + 20 + + + + + 8 + 50 + false + + + + If you check this, the GCS will udpate the stabilization factors +automatically every 300ms, which will help for fast tuning. + + + + + + Update in real time + + + + + + + Qt::Horizontal + + + + 111 + 10 + + + + + + + + + 0 + 0 + + + + + 32 + 32 + + + + + + + + :/core/images/helpicon.svg:/core/images/helpicon.svg + + + + 32 + 32 + + + + true + + + + button:help + url:http://wiki.openpilot.org/display/Doc/Stabilization+panel + + + + + + + + + 0 + 0 + + + + + 120 + 28 + + + + + 120 + 28 + + + + + 8 + + + + QPushButton { +border: 1px outset #999; +border-radius: 5; +background-color: qlineargradient(spread:pad, x1:0.507, y1:0.869318, x2:0.507, y2:0.0965909, stop:0.28 rgba(236, 236, 236, 255), stop:1 rgba(252, 252, 252, 255)); +} + +QPushButton:pressed { + + border-style: inset; + background-color: qlineargradient(spread:pad, x1:0.502, y1:0.664864, x2:0.502, y2:0.034, stop:0.358209 rgba(250, 250, 250, 255), stop:0.626866 rgba(235, 235, 235, 255)); + +} + + +QPushButton:hover { + border: 1px outset #999; +border-color: rgb(83, 83, 83); +border-radius: 4; + } + + + Reload Board Data + + + + button:reload + buttongroup:10 + + + + + + + + + 0 + 0 + + + + + 60 + 28 + + + + + 60 + 28 + + + + + 8 + + + + Send settings to the board but do not save to the non-volatile memory + + + QPushButton { +border: 1px outset #999; +border-radius: 5; +background-color: qlineargradient(spread:pad, x1:0.507, y1:0.869318, x2:0.507, y2:0.0965909, stop:0.28 rgba(236, 236, 236, 255), stop:1 rgba(252, 252, 252, 255)); +} + +QPushButton:pressed { + + border-style: inset; + background-color: qlineargradient(spread:pad, x1:0.502, y1:0.664864, x2:0.502, y2:0.034, stop:0.358209 rgba(250, 250, 250, 255), stop:0.626866 rgba(235, 235, 235, 255)); + +} + + +QPushButton:hover { + border: 1px outset #999; +border-color: rgb(83, 83, 83); +border-radius: 4; + } + + + Apply + + + + button:apply + + + + + + + + + 0 + 0 + + + + + 60 + 28 + + + + + 60 + 28 + + + + + 8 + + + + Send settings to the board and save to the non-volatile memory + + + QPushButton { +border: 1px outset #999; +border-radius: 5; +background-color: qlineargradient(spread:pad, x1:0.507, y1:0.869318, x2:0.507, y2:0.0965909, stop:0.28 rgba(236, 236, 236, 255), stop:1 rgba(252, 252, 252, 255)); +} + +QPushButton:pressed { + + border-style: inset; + background-color: qlineargradient(spread:pad, x1:0.502, y1:0.664864, x2:0.502, y2:0.034, stop:0.358209 rgba(250, 250, 250, 255), stop:0.626866 rgba(235, 235, 235, 255)); + +} + + +QPushButton:hover { + border: 1px outset #999; +border-color: rgb(83, 83, 83); +border-radius: 4; + } + + + Save + + + + button:save + + + + + + + + + + + + + + + + + + + Expert + + + + + + QFrame::NoFrame + + + true + + + + + 0 + -38 + 626 + 828 + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 25 + 10 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + + 241 + 16 + + + + + 9 + 75 + true + + + + Rate Stabization Coefficients (Inner Loop) + + + + + + + + 0 + 0 + + + + + 0 + 181 + + + + + 16777215 + 181 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 124 + 124 + 124 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 124 + 124 + 124 + + + + + + + 255 + 255 + 255 + + + + + + + 124 + 124 + 124 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 248 + 248 + 248 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + false + + + #RateStabilizationGroup_8{background-color: qlineargradient(spread:pad, x1:0.507, y1:0.869318, x2:0.507, y2:0.0965909, stop:0 rgba(243, 243, 243, 255), stop:1 rgba(250, 250, 250, 255));} + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 10 + + + + + + + + + + + Link Roll and Pitch + + + + + + + + 0 + 0 + + + + + 81 + 28 + + + + + 81 + 28 + + + + QPushButton { +border: 1px outset #999; +border-radius: 5; +background-color: qlineargradient(spread:pad, x1:0.507, y1:0.869318, x2:0.507, y2:0.0965909, stop:0.28 rgba(236, 236, 236, 255), stop:1 rgba(252, 252, 252, 255)); +} + +QPushButton:pressed { + + border-style: inset; + background-color: qlineargradient(spread:pad, x1:0.502, y1:0.664864, x2:0.502, y2:0.034, stop:0.358209 rgba(250, 250, 250, 255), stop:0.626866 rgba(235, 235, 235, 255)); + +} + + +QPushButton:hover { + border: 1px outset #999; +border-color: rgb(83, 83, 83); +border-radius: 4; + } + + + Default + + + + objname:StabilizationSettings + button:default + buttongroup:4 + + + + + + + + + 0 + 0 + + + + + 0 + 131 + + + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 124 + 124 + 124 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 124 + 124 + 124 + + + + + + + 255 + 255 + 255 + + + + + + + 124 + 124 + 124 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 248 + 248 + 248 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + false + + + + + + + + + true + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 110 + 13 + + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 39 + 39 + 39 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 75 + true + + + + false + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; + + + Roll + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 39 + 39 + 39 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 75 + true + + + + false + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; + + + Pitch + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 39 + 39 + 39 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 75 + true + + + + false + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; + + + Yaw + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 69 + 16 + + + + + + + Proportional + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + I factor for rate stabilization is usually very low or even zero. + + + + + + 6 + + + 0.000100000000000 + + + + objname:StabilizationSettings + fieldname:RollRatePID + element:Kp + haslimits:no + scale:1 + buttongroup:4,20 + + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + + + + 6 + + + 0.000100000000000 + + + + objname:StabilizationSettings + fieldname:PitchRatePID + element:Kp + haslimits:no + scale:1 + buttongroup:4,20 + + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + Slowly raise Kp until you start seeing clear oscillations when you fly. +Then lower the value by 20% or so. + +You can usually go for higher values for Yaw factors. + + + + + + 6 + + + 0.000100000000000 + + + + objname:StabilizationSettings + fieldname:YawRatePID + element:Kp + haslimits:no + scale:1 + buttongroup:4,20 + + + + + + + + + 0 + 0 + + + + + + + Integral + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 10 + + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + As a rule of thumb, you can set YawRate Ki at roughly the same +value as YawRate Kp. + + + + + + 6 + + + 0.000100000000000 + + + + objname:StabilizationSettings + fieldname:RollRatePID + element:Ki + haslimits:no + scale:1 + buttongroup:4,20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 10 + + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + + + + 6 + + + 0.000100000000000 + + + + objname:StabilizationSettings + fieldname:PitchRatePID + element:Ki + haslimits:no + scale:1 + buttongroup:4,20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 10 + + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + Slowly raise Kp until you start seeing clear oscillations when you fly. +Then lower the value by 20% or so. + +You can usually go for higher values for Yaw factors. + + + + + + 6 + + + 0.000100000000000 + + + + objname:StabilizationSettings + fieldname:YawRatePID + element:Ki + haslimits:no + scale:1 + buttongroup:4,20 + + + + + + + + + 0 + 0 + + + + + 50 + 0 + + + + + 16777215 + 16777215 + + + + + + + ILimit + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + I factor for rate stabilization is usually very low or even zero. + + + + + + 6 + + + 1.000000000000000 + + + + objname:StabilizationSettings + fieldname:RollRatePID + element:ILimit + haslimits:no + scale:1 + buttongroup:4,20 + + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + + + + 6 + + + 1.000000000000000 + + + + objname:StabilizationSettings + fieldname:PitchRatePID + element:ILimit + haslimits:no + scale:1 + buttongroup:4,20 + + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + Slowly raise Kp until you start seeing clear oscillations when you fly. +Then lower the value by 20% or so. + +You can usually go for higher values for Yaw factors. + + + + + + 6 + + + 1.000000000000000 + + + + objname:StabilizationSettings + fieldname:YawRatePID + element:ILimit + haslimits:no + scale:1 + buttongroup:4,20 + + + + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 2 + 10 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 2 + 10 + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 15 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + + 241 + 16 + + + + + 9 + 75 + true + + + + Attitude Stabization Coefficients (Outer Loop) + + + + + + + + 0 + 0 + + + + + 0 + 181 + + + + + 16777215 + 181 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 124 + 124 + 124 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 124 + 124 + 124 + + + + + + + 255 + 255 + 255 + + + + + + + 124 + 124 + 124 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 248 + 248 + 248 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + false + + + #RateStabilizationGroup_4{background-color: qlineargradient(spread:pad, x1:0.507, y1:0.869318, x2:0.507, y2:0.0965909, stop:0 rgba(243, 243, 243, 255), stop:1 rgba(250, 250, 250, 255));} + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + false + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 10 + + + + + + + + + + + Link Roll and Pitch + + + + + + + + 0 + 0 + + + + + 81 + 28 + + + + + 81 + 28 + + + + QPushButton { +border: 1px outset #999; +border-radius: 5; +background-color: qlineargradient(spread:pad, x1:0.507, y1:0.869318, x2:0.507, y2:0.0965909, stop:0.28 rgba(236, 236, 236, 255), stop:1 rgba(252, 252, 252, 255)); +} + +QPushButton:pressed { + + border-style: inset; + background-color: qlineargradient(spread:pad, x1:0.502, y1:0.664864, x2:0.502, y2:0.034, stop:0.358209 rgba(250, 250, 250, 255), stop:0.626866 rgba(235, 235, 235, 255)); + +} + + +QPushButton:hover { + border: 1px outset #999; +border-color: rgb(83, 83, 83); +border-radius: 4; + } + + + Default + + + + objname:StabilizationSettings + button:default + buttongroup:5 + + + + + + + + + 0 + 0 + + + + + 0 + 131 + + + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 124 + 124 + 124 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 124 + 124 + 124 + + + + + + + 255 + 255 + 255 + + + + + + + 124 + 124 + 124 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 248 + 248 + 248 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + false + + + + + + + + + true + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 110 + 13 + + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 39 + 39 + 39 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 75 + true + + + + false + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; + + + Roll + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 39 + 39 + 39 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 75 + true + + + + false + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; + + + Pitch + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 39 + 39 + 39 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 75 + true + + + + false + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; + + + Yaw + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 69 + 16 + + + + + + + Proportional + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + I factor for rate stabilization is usually very low or even zero. + + + + + + 6 + + + 0.100000000000000 + + + + objname:StabilizationSettings + fieldname:RollPI + element:Kp + haslimits:no + scale:1 + buttongroup:5,20 + + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + + + + 6 + + + 0.100000000000000 + + + + objname:StabilizationSettings + fieldname:PitchPI + element:Kp + haslimits:no + scale:1 + buttongroup:5,20 + + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + Slowly raise Kp until you start seeing clear oscillations when you fly. +Then lower the value by 20% or so. + +You can usually go for higher values for Yaw factors. + + + + + + 6 + + + 0.100000000000000 + + + + objname:StabilizationSettings + fieldname:YawPI + element:Kp + haslimits:no + scale:1 + buttongroup:5,20 + + + + + + + + + 0 + 0 + + + + + + + Integral + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 10 + + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + As a rule of thumb, you can set YawRate Ki at roughly the same +value as YawRate Kp. + + + + + + 6 + + + 0.100000000000000 + + + + objname:StabilizationSettings + fieldname:RollPI + element:Ki + haslimits:no + scale:1 + buttongroup:5,20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 10 + + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + + + + 6 + + + 0.100000000000000 + + + + objname:StabilizationSettings + fieldname:PitchPI + element:Ki + haslimits:no + scale:1 + buttongroup:5,20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 10 + + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + Slowly raise Kp until you start seeing clear oscillations when you fly. +Then lower the value by 20% or so. + +You can usually go for higher values for Yaw factors. + + + + + + 6 + + + 0.100000000000000 + + + + objname:StabilizationSettings + fieldname:YawPI + element:Ki + haslimits:no + scale:1 + buttongroup:5,20 + + + + + + + + + 0 + 0 + + + + + 50 + 0 + + + + + 16777215 + 16777215 + + + + + + + ILimit + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + I factor for rate stabilization is usually very low or even zero. + + + + + + 6 + + + 0.100000000000000 + + + + objname:StabilizationSettings + fieldname:RollPI + element:ILimit + haslimits:no + scale:1 + buttongroup:5,20 + + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + + + + 6 + + + 0.100000000000000 + + + + objname:StabilizationSettings + fieldname:PitchPI + element:ILimit + haslimits:no + scale:1 + buttongroup:5,20 + + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + Slowly raise Kp until you start seeing clear oscillations when you fly. +Then lower the value by 20% or so. + +You can usually go for higher values for Yaw factors. + + + + + + 6 + + + 0.100000000000000 + + + + objname:StabilizationSettings + fieldname:YawPI + element:ILimit + haslimits:no + scale:1 + buttongroup:5,20 + + + + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 15 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + + 180 + 16 + + + + + 9 + 75 + true + + + + Stick Range and Limits + + + + + + + + 0 + 0 + + + + + 0 + 211 + + + + + 16777215 + 211 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 124 + 124 + 124 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 124 + 124 + 124 + + + + + + + 255 + 255 + 255 + + + + + + + 124 + 124 + 124 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 248 + 248 + 248 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + false + + + #RateStabilizationGroup_6{background-color: qlineargradient(spread:pad, x1:0.507, y1:0.869318, x2:0.507, y2:0.0965909, stop:0 rgba(243, 243, 243, 255), stop:1 rgba(250, 250, 250, 255));} + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 10 + 10 + + + + + + + + + 0 + 0 + + + + + 81 + 28 + + + + + 81 + 28 + + + + QPushButton { +border: 1px outset #999; +border-radius: 5; +background-color: qlineargradient(spread:pad, x1:0.507, y1:0.869318, x2:0.507, y2:0.0965909, stop:0.28 rgba(236, 236, 236, 255), stop:1 rgba(252, 252, 252, 255)); +} + +QPushButton:pressed { + + border-style: inset; + background-color: qlineargradient(spread:pad, x1:0.502, y1:0.664864, x2:0.502, y2:0.034, stop:0.358209 rgba(250, 250, 250, 255), stop:0.626866 rgba(235, 235, 235, 255)); + +} + + +QPushButton:hover { + border: 1px outset #999; +border-color: rgb(83, 83, 83); +border-radius: 4; + } + + + Default + + + + objname:StabilizationSettings + button:default + buttongroup:6 + + + + + + + + + 0 + 0 + + + + + 0 + 160 + + + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 124 + 124 + 124 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 124 + 124 + 124 + + + + + + + 255 + 255 + 255 + + + + + + + 124 + 124 + 124 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 248 + 248 + 248 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + false + + + + + + + + + true + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 110 + 13 + + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 39 + 39 + 39 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 75 + true + + + + false + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; + + + Roll + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 39 + 39 + 39 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 75 + true + + + + false + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; + + + Pitch + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 16 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 19 + 19 + 19 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 58 + 58 + 58 + + + + + + + 48 + 48 + 48 + + + + + + + 19 + 19 + 19 + + + + + + + 26 + 26 + 26 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + + + 74 + 74 + 74 + + + + + 36 + 36 + 36 + + + + + + + + + 0 + 0 + 0 + + + + + + + 39 + 39 + 39 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 75 + true + + + + false + + + background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255)); +color: rgb(255, 255, 255); +border-radius: 5; + + + Yaw + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 69 + 16 + + + + + + + Full stick +angle(deg) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + I factor for rate stabilization is usually very low or even zero. + + + + + + 0 + + + 1000000.000000000000000 + + + 1.000000000000000 + + + + objname:StabilizationSettings + fieldname:RollMax + haslimits:no + scale:1 + buttongroup:6,20 + + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + + + + 0 + + + 1000000.000000000000000 + + + 1.000000000000000 + + + + objname:StabilizationSettings + fieldname:PitchMax + haslimits:no + scale:1 + buttongroup:6,20 + + + + + + + + + 0 + 0 + + + + + + + Full stick rate +rate(deg/s) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 10 + + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + As a rule of thumb, you can set YawRate Ki at roughly the same +value as YawRate Kp. + + + + + + 6 + + + 1000000.000000000000000 + + + 0.100000000000000 + + + + objname:StabilizationSettings + fieldname:ManualRate + element:Roll + haslimits:no + scale:1 + buttongroup:6,20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 10 + + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + + + + 6 + + + 1000000.000000000000000 + + + 0.100000000000000 + + + + objname:StabilizationSettings + fieldname:ManualRate + element:Pitch + haslimits:no + scale:1 + buttongroup:6,20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 10 + + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + Slowly raise Kp until you start seeing clear oscillations when you fly. +Then lower the value by 20% or so. + +You can usually go for higher values for Yaw factors. + + + + + + 6 + + + 1000000.000000000000000 + + + 0.100000000000000 + + + + objname:StabilizationSettings + fieldname:ManualRate + element:Yaw + haslimits:no + scale:1 + buttongroup:6,20 + + + + + + + + + 0 + 0 + + + + + 50 + 0 + + + + + 16777215 + 16777215 + + + + + + + Max rate in attitude + mode(deg/s) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + I factor for rate stabilization is usually very low or even zero. + + + + + + 6 + + + 1000000.000000000000000 + + + 0.100000000000000 + + + + objname:StabilizationSettings + fieldname:MaximumRate + element:Roll + haslimits:no + scale:1 + buttongroup:6,20 + + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + + + + 6 + + + 1000000.000000000000000 + + + 0.100000000000000 + + + + objname:StabilizationSettings + fieldname:MaximumRate + element:Pitch + haslimits:no + scale:1 + buttongroup:6,20 + + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + Slowly raise Kp until you start seeing clear oscillations when you fly. +Then lower the value by 20% or so. + +You can usually go for higher values for Yaw factors. + + + + + + 6 + + + 1000000.000000000000000 + + + 0.100000000000000 + + + + objname:StabilizationSettings + fieldname:MaximumRate + element:Yaw + haslimits:no + scale:1 + buttongroup:6,20 + + + + + + + + + 0 + 0 + + + + + 0 + 22 + + + + + 16777215 + 22 + + + + Slowly raise Kp until you start seeing clear oscillations when you fly. +Then lower the value by 20% or so. + +You can usually go for higher values for Yaw factors. + + + + + + 0 + + + 1000000.000000000000000 + + + 1.000000000000000 + + + + objname:StabilizationSettings + fieldname:YawMax + haslimits:no + scale:1 + buttongroup:6,20 + + + + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + + 0 + 0 + + + + + 0 + 79 + + + + + 16777215 + 79 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 251 + 251 + 251 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 124 + 124 + 124 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 255 + 255 + 255 + + + + + + + 251 + 251 + 251 + + + + + + + 124 + 124 + 124 + + + + + + + 165 + 165 + 165 + + + + + + + 124 + 124 + 124 + + + + + + + 255 + 255 + 255 + + + + + + + 124 + 124 + 124 + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + + + 243 + 243 + 243 + + + + + 250 + 250 + 250 + + + + + + + + + 0 + 0 + 0 + + + + + + + 248 + 248 + 248 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + false + + + #RateStabilizationGroup_22{background-color: qlineargradient(spread:pad, x1:0.507, y1:0.869318, x2:0.507, y2:0.0965909, stop:0 rgba(243, 243, 243, 255), stop:1 rgba(250, 250, 250, 255));} + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + 0 + 0 + + + + + 239 + 20 + + + + + + + Zero the integral when throttle is low + + + + objname:StabilizationSettings + fieldname:LowThrottleZeroIntegral + + + + + + + + + 0 + 0 + + + + + 8 + 50 + false + + + + If you check this, the GCS will udpate the stabilization factors +automatically every 300ms, which will help for fast tuning. + + + + + + Update in real time + + + + + + + + 0 + 0 + + + + + 32 + 32 + + + + + + + + :/core/images/helpicon.svg:/core/images/helpicon.svg + + + + 32 + 32 + + + + true + + + + button:help + url:http://wiki.openpilot.org/display/Doc/Stabilization+panel + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 60 + 28 + + + + + 60 + 28 + + + + + 8 + + + + Send settings to the board but do not save to the non-volatile memory + + + QPushButton { +border: 1px outset #999; +border-radius: 5; +background-color: qlineargradient(spread:pad, x1:0.507, y1:0.869318, x2:0.507, y2:0.0965909, stop:0.28 rgba(236, 236, 236, 255), stop:1 rgba(252, 252, 252, 255)); +} + +QPushButton:pressed { + + border-style: inset; + background-color: qlineargradient(spread:pad, x1:0.502, y1:0.664864, x2:0.502, y2:0.034, stop:0.358209 rgba(250, 250, 250, 255), stop:0.626866 rgba(235, 235, 235, 255)); + +} + + +QPushButton:hover { + border: 1px outset #999; +border-color: rgb(83, 83, 83); +border-radius: 4; + } + + + Apply + + + + button:apply + + + + + + + + + 0 + 0 + + + + + 60 + 28 + + + + + 60 + 28 + + + + + 8 + + + + Send settings to the board and save to the non-volatile memory + + + QPushButton { +border: 1px outset #999; +border-radius: 5; +background-color: qlineargradient(spread:pad, x1:0.507, y1:0.869318, x2:0.507, y2:0.0965909, stop:0.28 rgba(236, 236, 236, 255), stop:1 rgba(252, 252, 252, 255)); +} + +QPushButton:pressed { + + border-style: inset; + background-color: qlineargradient(spread:pad, x1:0.502, y1:0.664864, x2:0.502, y2:0.034, stop:0.358209 rgba(250, 250, 250, 255), stop:0.626866 rgba(235, 235, 235, 255)); + +} + + +QPushButton:hover { + border: 1px outset #999; +border-color: rgb(83, 83, 83); +border-radius: 4; + } + + + Save + + + + button:save + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ground/openpilotgcs/src/plugins/debuggadget/debuggadget.h b/ground/openpilotgcs/src/plugins/debuggadget/debuggadget.h index b39f8b5b5..68773df53 100644 --- a/ground/openpilotgcs/src/plugins/debuggadget/debuggadget.h +++ b/ground/openpilotgcs/src/plugins/debuggadget/debuggadget.h @@ -51,7 +51,7 @@ public: QString contextHelpId() const { return QString(); } private: - QWidget *m_widget; + QWidget *m_widget; QList m_context; }; diff --git a/ground/openpilotgcs/src/plugins/debuggadget/debuggadget.pro b/ground/openpilotgcs/src/plugins/debuggadget/debuggadget.pro index a45db6697..767966bc1 100644 --- a/ground/openpilotgcs/src/plugins/debuggadget/debuggadget.pro +++ b/ground/openpilotgcs/src/plugins/debuggadget/debuggadget.pro @@ -3,7 +3,6 @@ TARGET = DebugGadget include(../../openpilotgcsplugin.pri) include(../../plugins/coreplugin/coreplugin.pri) -include(../../libs/libqxt/core/logengines.pri) HEADERS += debugplugin.h \ debugengine.h HEADERS += debuggadget.h diff --git a/ground/openpilotgcs/src/plugins/plugins.pro b/ground/openpilotgcs/src/plugins/plugins.pro index dfa61f9ea..f8efac2b7 100644 --- a/ground/openpilotgcs/src/plugins/plugins.pro +++ b/ground/openpilotgcs/src/plugins/plugins.pro @@ -112,6 +112,7 @@ SUBDIRS += plugin_systemhealth plugin_config.subdir = config plugin_config.depends = plugin_coreplugin plugin_config.depends += plugin_uavobjects +plugin_config.depends += plugin_uavobjectwidgetutils plugin_config.depends += plugin_uavsettingsimportexport SUBDIRS += plugin_config @@ -190,6 +191,12 @@ plugin_uavobjectutil.depends = plugin_coreplugin plugin_uavobjectutil.depends += plugin_uavobjects SUBDIRS += plugin_uavobjectutil +# UAV Object Widget Utility plugin +plugin_uavobjectwidgetutils.subdir = uavobjectwidgetutils +plugin_uavobjectwidgetutils.depends = plugin_coreplugin +plugin_uavobjectwidgetutils.depends += plugin_uavobjects +SUBDIRS += plugin_uavobjectwidgetutils + # Magic Waypoint gadget plugin_magicwaypoint.subdir = magicwaypoint plugin_magicwaypoint.depends = plugin_coreplugin diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavdataobject.h b/ground/openpilotgcs/src/plugins/uavobjects/uavdataobject.h index 1f42ff15f..7ffce28d9 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavdataobject.h +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavdataobject.h @@ -47,6 +47,7 @@ public: Metadata getMetadata(); UAVMetaObject* getMetaObject(); virtual UAVDataObject* clone(quint32 instID = 0) = 0; + virtual UAVDataObject* dirtyClone() = 0; private: UAVMetaObject* mobj; diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp index da71fd943..ed9644988 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp @@ -11,25 +11,25 @@ * @brief The UAVUObjects GCS plugin *****************************************************************************/ /* - * This program 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 + * This program 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. - * - * This program 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 + * + * This program 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 this program; if not, write to the Free Software Foundation, Inc., + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "uavobjectfield.h" #include #include -UAVObjectField::UAVObjectField(const QString& name, const QString& units, FieldType type, quint32 numElements, const QStringList& options) +UAVObjectField::UAVObjectField(const QString& name, const QString& units, FieldType type, quint32 numElements, const QStringList& options, const QString &limits) { QStringList elementNames; // Set element names @@ -38,16 +38,16 @@ UAVObjectField::UAVObjectField(const QString& name, const QString& units, FieldT elementNames.append(QString("%1").arg(n)); } // Initialize - constructorInitialize(name, units, type, elementNames, options); + constructorInitialize(name, units, type, elementNames, options,limits); } -UAVObjectField::UAVObjectField(const QString& name, const QString& units, FieldType type, const QStringList& elementNames, const QStringList& options) +UAVObjectField::UAVObjectField(const QString& name, const QString& units, FieldType type, const QStringList& elementNames, const QStringList& options, const QString &limits) { - constructorInitialize(name, units, type, elementNames, options); + constructorInitialize(name, units, type, elementNames, options,limits); } -void UAVObjectField::constructorInitialize(const QString& name, const QString& units, FieldType type, const QStringList& elementNames, const QStringList& options) +void UAVObjectField::constructorInitialize(const QString& name, const QString& units, FieldType type, const QStringList& elementNames, const QStringList& options,const QString &limits) { // Copy params this->name = name; @@ -62,38 +62,368 @@ void UAVObjectField::constructorInitialize(const QString& name, const QString& u // Set field size switch (type) { - case INT8: - numBytesPerElement = sizeof(qint8); - break; - case INT16: - numBytesPerElement = sizeof(qint16); - break; - case INT32: - numBytesPerElement = sizeof(qint32); - break; - case UINT8: - numBytesPerElement = sizeof(quint8); - break; - case UINT16: - numBytesPerElement = sizeof(quint16); - break; - case UINT32: - numBytesPerElement = sizeof(quint32); - break; - case FLOAT32: - numBytesPerElement = sizeof(quint32); - break; - case ENUM: - numBytesPerElement = sizeof(quint8); - break; - case STRING: - numBytesPerElement = sizeof(quint8); - break; - default: - numBytesPerElement = 0; + case INT8: + numBytesPerElement = sizeof(qint8); + break; + case INT16: + numBytesPerElement = sizeof(qint16); + break; + case INT32: + numBytesPerElement = sizeof(qint32); + break; + case UINT8: + numBytesPerElement = sizeof(quint8); + break; + case UINT16: + numBytesPerElement = sizeof(quint16); + break; + case UINT32: + numBytesPerElement = sizeof(quint32); + break; + case FLOAT32: + numBytesPerElement = sizeof(quint32); + break; + case ENUM: + numBytesPerElement = sizeof(quint8); + break; + case STRING: + numBytesPerElement = sizeof(quint8); + break; + default: + numBytesPerElement = 0; } + limitsInitialize(limits); } +void UAVObjectField::limitsInitialize(const QString &limits) +{ + /// format + /// (TY)->type (EQ-equal;NE-not equal;BE-between;BI-bigger;SM-smaller) + /// (VALX)->value + /// %TY:VAL1:VAL2:VAL3,%TY,VAL1,VAL2,VAL3 + /// example: first element bigger than 3 and second element inside [2.3,5] + /// "%BI:3,%BE:2.3:5" + if(limits.isEmpty()) + return; + QStringList stringPerElement=limits.split(","); + quint32 index=0; + foreach (QString str, stringPerElement) { + QString _str=str.trimmed(); + QStringList valuesPerElement=_str.split(":"); + LimitStruct lstruc; + bool b1=valuesPerElement.at(0).startsWith("%"); + bool b2=(int)(index)<(int)numElements; + if(b1 && b2) + { + if(valuesPerElement.at(0).right(2)=="EQ") + lstruc.type=EQUAL; + else if(valuesPerElement.at(0).right(2)=="NE") + lstruc.type=NOT_EQUAL; + else if(valuesPerElement.at(0).right(2)=="BE") + lstruc.type=BETWEEN; + else if(valuesPerElement.at(0).right(2)=="BI") + lstruc.type=BIGGER; + else if(valuesPerElement.at(0).right(2)=="SM") + lstruc.type=SMALLER; + else + qDebug()<<"limits parsing failed (invalid property) on UAVObjectField"<numelements) on UAVObjectField"<2) + qDebug()<<__FUNCTION__<<"between limit with more than 1 pair, using first; field"<=struc.values.at(0).toInt() && var.toInt()<=struc.values.at(1).toInt())) + return false; + return true; + break; + case UINT8: + case UINT16: + case UINT32: + if(!(var.toUInt()>=struc.values.at(0).toUInt() && var.toUInt()<=struc.values.at(1).toUInt())) + return false; + return true; + break; + case ENUM: + if(!(options.indexOf(var.toString())>=options.indexOf(struc.values.at(0).toString()) && options.indexOf(var.toString())<=options.indexOf(struc.values.at(1).toString()))) + return false; + return true; + break; + case STRING: + return true; + break; + case FLOAT32: + if(!(var.toFloat()>=struc.values.at(0).toFloat() && var.toFloat()<=struc.values.at(1).toFloat())) + return false; + return true; + break; + default: + return true; + } + break; + case BIGGER: + if(struc.values.length()<1) + { + qDebug()<<__FUNCTION__<<"BIGGER limit with less than 1 value, aborting; field:"<1) + qDebug()<<__FUNCTION__<<"BIGGER limit with more than 1 value, using first; field"<=struc.values.at(0).toInt())) + return false; + return true; + break; + case UINT8: + case UINT16: + case UINT32: + if(!(var.toUInt()>=struc.values.at(0).toUInt())) + return false; + return true; + break; + case ENUM: + if(!(options.indexOf(var.toString())>=options.indexOf(struc.values.at(0).toString()))) + return false; + return true; + break; + case STRING: + return true; + break; + case FLOAT32: + if(!(var.toFloat()>=struc.values.at(0).toFloat())) + return false; + return true; + break; + default: + return true; + } + break; + case SMALLER: + switch (type) + { + case INT8: + case INT16: + case INT32: + if(!(var.toInt()<=struc.values.at(0).toInt())) + return false; + return true; + break; + case UINT8: + case UINT16: + case UINT32: + if(!(var.toUInt()<=struc.values.at(0).toUInt())) + return false; + return true; + break; + case ENUM: + if(!(options.indexOf(var.toString())<=options.indexOf(struc.values.at(0).toString()))) + return false; + return true; + break; + case STRING: + return true; + break; + case FLOAT32: + if(!(var.toFloat()<=struc.values.at(0).toFloat())) + return false; + return true; + break; + default: + return true; + } + } + return true; +} + +QVariant UAVObjectField::getMaxLimit(quint32 index) +{ + if(!elementLimits.keys().contains(index)) + return QVariant(); + LimitStruct struc=elementLimits.value(index); + switch(struc.type) + { + case EQUAL: + case NOT_EQUAL: + case BIGGER: + return QVariant(); + break; + break; + case BETWEEN: + return struc.values.at(1); + break; + case SMALLER: + return struc.values.at(0); + break; + default: + return QVariant(); + break; + } + return QVariant(); +} +QVariant UAVObjectField::getMinLimit(quint32 index) +{ + if(!elementLimits.keys().contains(index)) + return QVariant(); + LimitStruct struc=elementLimits.value(index); + switch(struc.type) + { + case EQUAL: + case NOT_EQUAL: + case SMALLER: + return QVariant(); + break; + break; + case BETWEEN: + return struc.values.at(0); + break; + case BIGGER: + return struc.values.at(0); + break; + default: + return QVariant(); + break; + } + return QVariant(); +} void UAVObjectField::initialize(quint8* data, quint32 dataOffset, UAVObject* obj) { this->data = data; @@ -111,26 +441,26 @@ QString UAVObjectField::getTypeAsString() { switch (type) { - case UAVObjectField::INT8: - return "int8"; - case UAVObjectField::INT16: - return "int16"; - case UAVObjectField::INT32: - return "int32"; - case UAVObjectField::UINT8: - return "uint8"; - case UAVObjectField::UINT16: - return "uint16"; - case UAVObjectField::UINT32: - return "uint32"; - case UAVObjectField::FLOAT32: - return "float32"; - case UAVObjectField::ENUM: - return "enum"; - case UAVObjectField::STRING: - return "string"; - default: - return ""; + case UAVObjectField::INT8: + return "int8"; + case UAVObjectField::INT16: + return "int16"; + case UAVObjectField::INT32: + return "int32"; + case UAVObjectField::UINT8: + return "uint8"; + case UAVObjectField::UINT16: + return "uint16"; + case UAVObjectField::UINT32: + return "uint32"; + case UAVObjectField::FLOAT32: + return "float32"; + case UAVObjectField::ENUM: + return "enum"; + case UAVObjectField::STRING: + return "string"; + default: + return ""; } } @@ -199,64 +529,64 @@ qint32 UAVObjectField::pack(quint8* dataOut) // Pack each element in output buffer switch (type) { - case INT8: - memcpy(dataOut, &data[offset], numElements); - break; - case INT16: - for (quint32 index = 0; index < numElements; ++index) - { - qint16 value; - memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement); - qToLittleEndian(value, &dataOut[numBytesPerElement*index]); - } - break; - case INT32: - for (quint32 index = 0; index < numElements; ++index) - { - qint32 value; - memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement); - qToLittleEndian(value, &dataOut[numBytesPerElement*index]); - } - break; - case UINT8: - for (quint32 index = 0; index < numElements; ++index) - { - dataOut[numBytesPerElement*index] = data[offset + numBytesPerElement*index]; - } - break; - case UINT16: - for (quint32 index = 0; index < numElements; ++index) - { - quint16 value; - memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement); - qToLittleEndian(value, &dataOut[numBytesPerElement*index]); - } - break; - case UINT32: - for (quint32 index = 0; index < numElements; ++index) - { - quint32 value; - memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement); - qToLittleEndian(value, &dataOut[numBytesPerElement*index]); - } - break; - case FLOAT32: - for (quint32 index = 0; index < numElements; ++index) - { - quint32 value; - memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement); - qToLittleEndian(value, &dataOut[numBytesPerElement*index]); - } - break; - case ENUM: - for (quint32 index = 0; index < numElements; ++index) - { - dataOut[numBytesPerElement*index] = data[offset + numBytesPerElement*index]; - } - break; - case STRING: - memcpy(dataOut, &data[offset], numElements); - break; + case INT8: + memcpy(dataOut, &data[offset], numElements); + break; + case INT16: + for (quint32 index = 0; index < numElements; ++index) + { + qint16 value; + memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement); + qToLittleEndian(value, &dataOut[numBytesPerElement*index]); + } + break; + case INT32: + for (quint32 index = 0; index < numElements; ++index) + { + qint32 value; + memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement); + qToLittleEndian(value, &dataOut[numBytesPerElement*index]); + } + break; + case UINT8: + for (quint32 index = 0; index < numElements; ++index) + { + dataOut[numBytesPerElement*index] = data[offset + numBytesPerElement*index]; + } + break; + case UINT16: + for (quint32 index = 0; index < numElements; ++index) + { + quint16 value; + memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement); + qToLittleEndian(value, &dataOut[numBytesPerElement*index]); + } + break; + case UINT32: + for (quint32 index = 0; index < numElements; ++index) + { + quint32 value; + memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement); + qToLittleEndian(value, &dataOut[numBytesPerElement*index]); + } + break; + case FLOAT32: + for (quint32 index = 0; index < numElements; ++index) + { + quint32 value; + memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement); + qToLittleEndian(value, &dataOut[numBytesPerElement*index]); + } + break; + case ENUM: + for (quint32 index = 0; index < numElements; ++index) + { + dataOut[numBytesPerElement*index] = data[offset + numBytesPerElement*index]; + } + break; + case STRING: + memcpy(dataOut, &data[offset], numElements); + break; } // Done return getNumBytes(); @@ -268,64 +598,64 @@ qint32 UAVObjectField::unpack(const quint8* dataIn) // Unpack each element from input buffer switch (type) { - case INT8: - memcpy(&data[offset], dataIn, numElements); - break; - case INT16: - for (quint32 index = 0; index < numElements; ++index) - { - qint16 value; - value = qFromLittleEndian(&dataIn[numBytesPerElement*index]); - memcpy(&data[offset + numBytesPerElement*index], &value, numBytesPerElement); - } - break; - case INT32: - for (quint32 index = 0; index < numElements; ++index) - { - qint32 value; - value = qFromLittleEndian(&dataIn[numBytesPerElement*index]); - memcpy(&data[offset + numBytesPerElement*index], &value, numBytesPerElement); - } - break; - case UINT8: - for (quint32 index = 0; index < numElements; ++index) - { - data[offset + numBytesPerElement*index] = dataIn[numBytesPerElement*index]; - } - break; - case UINT16: - for (quint32 index = 0; index < numElements; ++index) - { - quint16 value; - value = qFromLittleEndian(&dataIn[numBytesPerElement*index]); - memcpy(&data[offset + numBytesPerElement*index], &value, numBytesPerElement); - } - break; - case UINT32: - for (quint32 index = 0; index < numElements; ++index) - { - quint32 value; - value = qFromLittleEndian(&dataIn[numBytesPerElement*index]); - memcpy(&data[offset + numBytesPerElement*index], &value, numBytesPerElement); - } - break; - case FLOAT32: - for (quint32 index = 0; index < numElements; ++index) - { - quint32 value; - value = qFromLittleEndian(&dataIn[numBytesPerElement*index]); - memcpy(&data[offset + numBytesPerElement*index], &value, numBytesPerElement); - } - break; - case ENUM: - for (quint32 index = 0; index < numElements; ++index) - { - data[offset + numBytesPerElement*index] = dataIn[numBytesPerElement*index]; - } - break; - case STRING: - memcpy(&data[offset], dataIn, numElements); - break; + case INT8: + memcpy(&data[offset], dataIn, numElements); + break; + case INT16: + for (quint32 index = 0; index < numElements; ++index) + { + qint16 value; + value = qFromLittleEndian(&dataIn[numBytesPerElement*index]); + memcpy(&data[offset + numBytesPerElement*index], &value, numBytesPerElement); + } + break; + case INT32: + for (quint32 index = 0; index < numElements; ++index) + { + qint32 value; + value = qFromLittleEndian(&dataIn[numBytesPerElement*index]); + memcpy(&data[offset + numBytesPerElement*index], &value, numBytesPerElement); + } + break; + case UINT8: + for (quint32 index = 0; index < numElements; ++index) + { + data[offset + numBytesPerElement*index] = dataIn[numBytesPerElement*index]; + } + break; + case UINT16: + for (quint32 index = 0; index < numElements; ++index) + { + quint16 value; + value = qFromLittleEndian(&dataIn[numBytesPerElement*index]); + memcpy(&data[offset + numBytesPerElement*index], &value, numBytesPerElement); + } + break; + case UINT32: + for (quint32 index = 0; index < numElements; ++index) + { + quint32 value; + value = qFromLittleEndian(&dataIn[numBytesPerElement*index]); + memcpy(&data[offset + numBytesPerElement*index], &value, numBytesPerElement); + } + break; + case FLOAT32: + for (quint32 index = 0; index < numElements; ++index) + { + quint32 value; + value = qFromLittleEndian(&dataIn[numBytesPerElement*index]); + memcpy(&data[offset + numBytesPerElement*index], &value, numBytesPerElement); + } + break; + case ENUM: + for (quint32 index = 0; index < numElements; ++index) + { + data[offset + numBytesPerElement*index] = dataIn[numBytesPerElement*index]; + } + break; + case STRING: + memcpy(&data[offset], dataIn, numElements); + break; } // Done return getNumBytes(); @@ -340,35 +670,35 @@ bool UAVObjectField::isNumeric() { switch (type) { - case INT8: - return true; - break; - case INT16: - return true; - break; - case INT32: - return true; - break; - case UINT8: - return true; - break; - case UINT16: - return true; - break; - case UINT32: - return true; - break; - case FLOAT32: - return true; - break; - case ENUM: - return false; - break; - case STRING: - return false; - break; - default: - return false; + case INT8: + return true; + break; + case INT16: + return true; + break; + case INT32: + return true; + break; + case UINT8: + return true; + break; + case UINT16: + return true; + break; + case UINT32: + return true; + break; + case FLOAT32: + return true; + break; + case ENUM: + return false; + break; + case STRING: + return false; + break; + default: + return false; } } @@ -376,35 +706,35 @@ bool UAVObjectField::isText() { switch (type) { - case INT8: - return false; - break; - case INT16: - return false; - break; - case INT32: - return false; - break; - case UINT8: - return false; - break; - case UINT16: - return false; - break; - case UINT32: - return false; - break; - case FLOAT32: - return false; - break; - case ENUM: - return true; - break; - case STRING: - return true; - break; - default: - return false; + case INT8: + return false; + break; + case INT16: + return false; + break; + case INT32: + return false; + break; + case UINT8: + return false; + break; + case UINT16: + return false; + break; + case UINT32: + return false; + break; + case FLOAT32: + return false; + break; + case ENUM: + return true; + break; + case STRING: + return true; + break; + default: + return false; } } @@ -419,74 +749,74 @@ QVariant UAVObjectField::getValue(quint32 index) // Get value switch (type) { - case INT8: - { - qint8 tmpint8; - memcpy(&tmpint8, &data[offset + numBytesPerElement*index], numBytesPerElement); - return QVariant(tmpint8); - break; - } - case INT16: - { - qint16 tmpint16; - memcpy(&tmpint16, &data[offset + numBytesPerElement*index], numBytesPerElement); - return QVariant(tmpint16); - break; - } - case INT32: - { - qint32 tmpint32; - memcpy(&tmpint32, &data[offset + numBytesPerElement*index], numBytesPerElement); - return QVariant(tmpint32); - break; - } - case UINT8: - { - quint8 tmpuint8; - memcpy(&tmpuint8, &data[offset + numBytesPerElement*index], numBytesPerElement); - return QVariant(tmpuint8); - break; - } - case UINT16: - { - quint16 tmpuint16; - memcpy(&tmpuint16, &data[offset + numBytesPerElement*index], numBytesPerElement); - return QVariant(tmpuint16); - break; - } - case UINT32: - { - quint32 tmpuint32; - memcpy(&tmpuint32, &data[offset + numBytesPerElement*index], numBytesPerElement); - return QVariant(tmpuint32); - break; - } - case FLOAT32: - { - float tmpfloat; - memcpy(&tmpfloat, &data[offset + numBytesPerElement*index], numBytesPerElement); - return QVariant(tmpfloat); - break; - } - case ENUM: - { - quint8 tmpenum; - memcpy(&tmpenum, &data[offset + numBytesPerElement*index], numBytesPerElement); -// Q_ASSERT((tmpenum < options.length()) && (tmpenum >= 0)); // catch bad enum settings - if(tmpenum >= options.length()) { - qDebug() << "Invalid value for" << name; - return QVariant( QString("Bad Value") ); - } - return QVariant( options[tmpenum] ); - break; - } - case STRING: - { - data[offset + numElements - 1] = '\0'; - QString str((char*)&data[offset]); - return QVariant( str ); - break; + case INT8: + { + qint8 tmpint8; + memcpy(&tmpint8, &data[offset + numBytesPerElement*index], numBytesPerElement); + return QVariant(tmpint8); + break; + } + case INT16: + { + qint16 tmpint16; + memcpy(&tmpint16, &data[offset + numBytesPerElement*index], numBytesPerElement); + return QVariant(tmpint16); + break; + } + case INT32: + { + qint32 tmpint32; + memcpy(&tmpint32, &data[offset + numBytesPerElement*index], numBytesPerElement); + return QVariant(tmpint32); + break; + } + case UINT8: + { + quint8 tmpuint8; + memcpy(&tmpuint8, &data[offset + numBytesPerElement*index], numBytesPerElement); + return QVariant(tmpuint8); + break; + } + case UINT16: + { + quint16 tmpuint16; + memcpy(&tmpuint16, &data[offset + numBytesPerElement*index], numBytesPerElement); + return QVariant(tmpuint16); + break; + } + case UINT32: + { + quint32 tmpuint32; + memcpy(&tmpuint32, &data[offset + numBytesPerElement*index], numBytesPerElement); + return QVariant(tmpuint32); + break; + } + case FLOAT32: + { + float tmpfloat; + memcpy(&tmpfloat, &data[offset + numBytesPerElement*index], numBytesPerElement); + return QVariant(tmpfloat); + break; + } + case ENUM: + { + quint8 tmpenum; + memcpy(&tmpenum, &data[offset + numBytesPerElement*index], numBytesPerElement); + // Q_ASSERT((tmpenum < options.length()) && (tmpenum >= 0)); // catch bad enum settings + if(tmpenum >= options.length()) { + qDebug() << "Invalid value for" << name; + return QVariant( QString("Bad Value") ); } + return QVariant( options[tmpenum] ); + break; + } + case STRING: + { + data[offset + numElements - 1] = '\0'; + QString str((char*)&data[offset]); + return QVariant( str ); + break; + } } // If this point is reached then we got an invalid type return QVariant(); @@ -499,7 +829,7 @@ bool UAVObjectField::checkValue(const QVariant& value, quint32 index) if ( index >= numElements ) { return false; - } + } // Get metadata UAVObject::Metadata mdata = obj->getMetadata(); // Update value if the access mode permits @@ -507,28 +837,29 @@ bool UAVObjectField::checkValue(const QVariant& value, quint32 index) { switch (type) { - case INT8: - case INT16: - case INT32: - case UINT8: - case UINT16: - case UINT32: - case FLOAT32: - case STRING: - return true; - break; - case ENUM: - { - qint8 tmpenum = options.indexOf( value.toString() ); - return ((tmpenum < 0) ? false : true); - break; - } - default: - qDebug() << "checkValue: other types" << type; - Q_ASSERT(0); // To catch any programming errors where we tried to test invalid values - break; + case INT8: + case INT16: + case INT32: + case UINT8: + case UINT16: + case UINT32: + case FLOAT32: + case STRING: + return true; + break; + case ENUM: + { + qint8 tmpenum = options.indexOf( value.toString() ); + return ((tmpenum < 0) ? false : true); + break; + } + default: + qDebug() << "checkValue: other types" << type; + Q_ASSERT(0); // To catch any programming errors where we tried to test invalid values + break; } } + return true; } void UAVObjectField::setValue(const QVariant& value, quint32 index) @@ -538,7 +869,7 @@ void UAVObjectField::setValue(const QVariant& value, quint32 index) if ( index >= numElements ) { return; - } + } // Get metadata UAVObject::Metadata mdata = obj->getMetadata(); // Update value if the access mode permits @@ -546,67 +877,67 @@ void UAVObjectField::setValue(const QVariant& value, quint32 index) { switch (type) { - case INT8: + case INT8: + { + qint8 tmpint8 = value.toInt(); + memcpy(&data[offset + numBytesPerElement*index], &tmpint8, numBytesPerElement); + break; + } + case INT16: + { + qint16 tmpint16 = value.toInt(); + memcpy(&data[offset + numBytesPerElement*index], &tmpint16, numBytesPerElement); + break; + } + case INT32: + { + qint32 tmpint32 = value.toInt(); + memcpy(&data[offset + numBytesPerElement*index], &tmpint32, numBytesPerElement); + break; + } + case UINT8: + { + quint8 tmpuint8 = value.toUInt(); + memcpy(&data[offset + numBytesPerElement*index], &tmpuint8, numBytesPerElement); + break; + } + case UINT16: + { + quint16 tmpuint16 = value.toUInt(); + memcpy(&data[offset + numBytesPerElement*index], &tmpuint16, numBytesPerElement); + break; + } + case UINT32: + { + quint32 tmpuint32 = value.toUInt(); + memcpy(&data[offset + numBytesPerElement*index], &tmpuint32, numBytesPerElement); + break; + } + case FLOAT32: + { + float tmpfloat = value.toFloat(); + memcpy(&data[offset + numBytesPerElement*index], &tmpfloat, numBytesPerElement); + break; + } + case ENUM: + { + qint8 tmpenum = options.indexOf( value.toString() ); + Q_ASSERT(tmpenum >= 0); // To catch any programming errors where we set invalid values + memcpy(&data[offset + numBytesPerElement*index], &tmpenum, numBytesPerElement); + break; + } + case STRING: + { + QString str = value.toString(); + QByteArray barray = str.toAscii(); + quint32 index; + for (index = 0; index < (quint32)barray.length() && index < (numElements-1); ++index) { - qint8 tmpint8 = value.toInt(); - memcpy(&data[offset + numBytesPerElement*index], &tmpint8, numBytesPerElement); - break; - } - case INT16: - { - qint16 tmpint16 = value.toInt(); - memcpy(&data[offset + numBytesPerElement*index], &tmpint16, numBytesPerElement); - break; - } - case INT32: - { - qint32 tmpint32 = value.toInt(); - memcpy(&data[offset + numBytesPerElement*index], &tmpint32, numBytesPerElement); - break; - } - case UINT8: - { - quint8 tmpuint8 = value.toUInt(); - memcpy(&data[offset + numBytesPerElement*index], &tmpuint8, numBytesPerElement); - break; - } - case UINT16: - { - quint16 tmpuint16 = value.toUInt(); - memcpy(&data[offset + numBytesPerElement*index], &tmpuint16, numBytesPerElement); - break; - } - case UINT32: - { - quint32 tmpuint32 = value.toUInt(); - memcpy(&data[offset + numBytesPerElement*index], &tmpuint32, numBytesPerElement); - break; - } - case FLOAT32: - { - float tmpfloat = value.toFloat(); - memcpy(&data[offset + numBytesPerElement*index], &tmpfloat, numBytesPerElement); - break; - } - case ENUM: - { - qint8 tmpenum = options.indexOf( value.toString() ); - Q_ASSERT(tmpenum >= 0); // To catch any programming errors where we set invalid values - memcpy(&data[offset + numBytesPerElement*index], &tmpenum, numBytesPerElement); - break; - } - case STRING: - { - QString str = value.toString(); - QByteArray barray = str.toAscii(); - quint32 index; - for (index = 0; index < (quint32)barray.length() && index < (numElements-1); ++index) - { - data[offset+index] = barray[index]; - } - barray[index] = '\0'; - break; + data[offset+index] = barray[index]; } + barray[index] = '\0'; + break; + } } } } diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.h b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.h index 3cefc25e6..59a4ad196 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.h +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.h @@ -32,6 +32,8 @@ #include "uavobject.h" #include #include +#include +#include class UAVObject; @@ -41,9 +43,15 @@ class UAVOBJECTS_EXPORT UAVObjectField: public QObject public: typedef enum { INT8 = 0, INT16, INT32, UINT8, UINT16, UINT32, FLOAT32, ENUM, STRING } FieldType; + typedef enum { EQUAL,NOT_EQUAL,BETWEEN,BIGGER,SMALLER } LimitType; + typedef struct + { + LimitType type; + QList values; + } LimitStruct; - UAVObjectField(const QString& name, const QString& units, FieldType type, quint32 numElements, const QStringList& options); - UAVObjectField(const QString& name, const QString& units, FieldType type, const QStringList& elementNames, const QStringList& options); + UAVObjectField(const QString& name, const QString& units, FieldType type, quint32 numElements, const QStringList& options,const QString& limits=QString::QString()); + UAVObjectField(const QString& name, const QString& units, FieldType type, const QStringList& elementNames, const QStringList& options,const QString& limits=QString::QString()); void initialize(quint8* data, quint32 dataOffset, UAVObject* obj); UAVObject* getObject(); FieldType getType(); @@ -67,6 +75,9 @@ public: bool isText(); QString toString(); + bool isWithinLimits(QVariant var, quint32 index); + QVariant getMaxLimit(quint32 index); + QVariant getMinLimit(quint32 index); signals: void fieldUpdated(UAVObjectField* field); @@ -81,9 +92,10 @@ protected: quint32 offset; quint8* data; UAVObject* obj; - + QMap elementLimits; void clear(); - void constructorInitialize(const QString& name, const QString& units, FieldType type, const QStringList& elementNames, const QStringList& options); + void constructorInitialize(const QString& name, const QString& units, FieldType type, const QStringList& elementNames, const QStringList& options, const QString &limits); + void limitsInitialize(const QString &limits); }; diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjecttemplate.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavobjecttemplate.cpp index 6cb14d058..d38bcdbc5 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjecttemplate.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjecttemplate.cpp @@ -127,6 +127,15 @@ UAVDataObject* $(NAME)::clone(quint32 instID) return obj; } +/** + * Create a clone of this object only to be used to retrieve defaults + */ +UAVDataObject* $(NAME)::dirtyClone() +{ + $(NAME)* obj = new $(NAME)(); + return obj; +} + /** * Static function to retrieve an instance of the object. */ diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjecttemplate.h b/ground/openpilotgcs/src/plugins/uavobjects/uavobjecttemplate.h index 1fa00ff0a..9b5a766ee 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjecttemplate.h +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjecttemplate.h @@ -65,7 +65,8 @@ $(DATAFIELDINFO) void setData(const DataFields& data); Metadata getDefaultMetadata(); UAVDataObject* clone(quint32 instID); - + UAVDataObject* dirtyClone(); + static $(NAME)* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0); $(PROPERTY_GETTERS) diff --git a/ground/openpilotgcs/src/plugins/uavobjectutil/UAVObjectUtil.pluginspec b/ground/openpilotgcs/src/plugins/uavobjectutil/UAVObjectUtil.pluginspec index af65371e7..7c57a051d 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectutil/UAVObjectUtil.pluginspec +++ b/ground/openpilotgcs/src/plugins/uavobjectutil/UAVObjectUtil.pluginspec @@ -6,6 +6,6 @@ http://www.openpilot.org - + diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/UAVObjectWidgetUtils.pluginspec b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/UAVObjectWidgetUtils.pluginspec new file mode 100644 index 000000000..9d4fcda8a --- /dev/null +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/UAVObjectWidgetUtils.pluginspec @@ -0,0 +1,13 @@ + + The OpenPilot Project + (C) 2010 OpenPilot Project + The GNU Public License (GPL) Version 3 + Utils classes for UAVObjects to Widget relations + http://www.openpilot.org + + + + + + + diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp new file mode 100644 index 000000000..a15bdae7d --- /dev/null +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.cpp @@ -0,0 +1,1120 @@ +/** + ****************************************************************************** + * + * @file configtaskwidget.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @addtogroup UAVObjectWidgetUtils Plugin + * @{ + * @brief Utility plugin for UAVObject to Widget relation management + *****************************************************************************/ +/* + * This program 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. + * + * This program 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 this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include "configtaskwidget.h" +#include +#include "uavsettingsimportexport/uavsettingsimportexportfactory.h" + +/** + * Constructor + */ +ConfigTaskWidget::ConfigTaskWidget(QWidget *parent) : QWidget(parent),isConnected(false),smartsave(NULL),dirty(false),outOfLimitsStyle("background-color: rgb(255, 0, 0);") +{ + pm = ExtensionSystem::PluginManager::instance(); + objManager = pm->getObject(); + TelemetryManager* telMngr = pm->getObject(); + connect(telMngr, SIGNAL(connected()), this, SLOT(onAutopilotConnect())); + connect(telMngr, SIGNAL(disconnected()), this, SLOT(onAutopilotDisconnect())); + connect(telMngr, SIGNAL(connected()), this, SIGNAL(autoPilotConnected())); + connect(telMngr, SIGNAL(disconnected()), this, SIGNAL(autoPilotDisconnected())); + UAVSettingsImportExportFactory * importexportplugin = pm->getObject(); + connect(importexportplugin,SIGNAL(importAboutToBegin()),this,SLOT(invalidateObjects())); +} + +/** + * Add a widget to the dirty detection pool + * @param widget to add to the detection pool + */ +void ConfigTaskWidget::addWidget(QWidget * widget) +{ + addUAVObjectToWidgetRelation("","",widget); +} +/** + * Add an object to the management system + * @param objectName name of the object to add to the management system + */ +void ConfigTaskWidget::addUAVObject(QString objectName) +{ + addUAVObjectToWidgetRelation(objectName,"",NULL); +} +/** + * Add an UAVObject field to widget relation to the management system + * @param object name of the object to add + * @param field name of the field to add + * @param widget pointer to the widget whitch will display/define the field value + * @param index index of the field element to add to this relation + */ +void ConfigTaskWidget::addUAVObjectToWidgetRelation(QString object, QString field, QWidget * widget, QString index) +{ + UAVObject *obj=NULL; + UAVObjectField *_field=NULL; + obj = objManager->getObject(QString(object)); + Q_ASSERT(obj); + _field = obj->getField(QString(field)); + Q_ASSERT(_field); + addUAVObjectToWidgetRelation(object,field,widget,_field->getElementNames().indexOf(index)); +} +/** + * Add a UAVObject field to widget relation to the management system + * @param object name of the object to add + * @param field name of the field to add + * @param widget pointer to the widget whitch will display/define the field value + * @param element name of the element of the field element to add to this relation + * @param scale scale value of this relation + * @param isLimited bool to signal if this widget contents is limited in value + * @param defaultReloadGroups default and reload groups this relation belongs to + * @param instID instance ID of the object used on this relation + */ +void ConfigTaskWidget::addUAVObjectToWidgetRelation(QString object, QString field, QWidget *widget, QString element, double scale, bool isLimited, QList *defaultReloadGroups, quint32 instID) +{ + UAVObject *obj=objManager->getObject(QString(object),instID); + Q_ASSERT(obj); + UAVObjectField *_field; + int index=0; + if(!field.isEmpty() && obj) + { + _field = obj->getField(QString(field)); + if(!element.isEmpty()) + index=_field->getElementNames().indexOf(QString(element)); + } + addUAVObjectToWidgetRelation(object, field, widget,index,scale,isLimited,defaultReloadGroups,instID); +} +/** + * Add an UAVObject field to widget relation to the management system + * @param object name of the object to add + * @param field name of the field to add + * @param widget pointer to the widget whitch will display/define the field value + * @param index index of the element of the field to add to this relation + * @param scale scale value of this relation + * @param isLimited bool to signal if this widget contents is limited in value + * @param defaultReloadGroups default and reload groups this relation belongs to + * @param instID instance ID of the object used on this relation + */ +void ConfigTaskWidget::addUAVObjectToWidgetRelation(QString object, QString field, QWidget * widget, int index,double scale,bool isLimited,QList* defaultReloadGroups, quint32 instID) +{ + if(addShadowWidget(object,field,widget,index,scale,isLimited,defaultReloadGroups,instID)) + return; + + UAVObject *obj=NULL; + UAVObjectField *_field=NULL; + if(!object.isEmpty()) + { + obj = objManager->getObject(QString(object),instID); + Q_ASSERT(obj); + objectUpdates.insert(obj,true); + connect(obj, SIGNAL(objectUpdated(UAVObject*)),this, SLOT(objectUpdated(UAVObject*))); + connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshWidgetsValues())); + } + if(!field.isEmpty() && obj) + _field = obj->getField(QString(field)); + objectToWidget * ow=new objectToWidget(); + ow->field=_field; + ow->object=obj; + ow->widget=widget; + ow->index=index; + ow->scale=scale; + ow->isLimited=isLimited; + objOfInterest.append(ow); + if(obj) + { + if(smartsave) + { + smartsave->addObject((UAVDataObject*)obj); + } + } + if(widget==NULL) + { + // do nothing + } + else + { + connectWidgetUpdatesToSlot(widget,SLOT(widgetsContentsChanged())); + if(defaultReloadGroups) + addWidgetToDefaultReloadGroups(widget,defaultReloadGroups); + shadowsList.insert(widget,ow); + loadWidgetLimits(widget,_field,index,isLimited,scale); + } +} +/** + * destructor + */ +ConfigTaskWidget::~ConfigTaskWidget() +{ + if(smartsave) + delete smartsave; + foreach(QList* pointer,defaultReloadGroups.values()) + { + if(pointer) + delete pointer; + } + foreach (objectToWidget* oTw, objOfInterest) + { + if(oTw) + delete oTw; + } +} + +void ConfigTaskWidget::saveObjectToSD(UAVObject *obj) +{ + // saveObjectToSD is now handled by the UAVUtils plugin in one + // central place (and one central queue) + ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); + UAVObjectUtilManager* utilMngr = pm->getObject(); + utilMngr->saveObjectToSD(obj); +} + +/** + * Util function to get a pointer to the object manager + * @return pointer to the UAVObjectManager + */ +UAVObjectManager* ConfigTaskWidget::getObjectManager() { + ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); + UAVObjectManager * objMngr = pm->getObject(); + Q_ASSERT(objMngr); + return objMngr; +} +/** + * Utility function which calculates the Mean value of a list of values + * @param list list of double values + * @returns Mean value of the list of parameter values + */ +double ConfigTaskWidget::listMean(QList list) +{ + double accum = 0; + for(int i = 0; i < list.size(); i++) + accum += list[i]; + return accum / list.size(); +} + +// ************************************ +// telemetry start/stop connect/disconnect signals + +void ConfigTaskWidget::onAutopilotDisconnect() +{ + isConnected=false; + enableControls(false); + invalidateObjects(); +} + +void ConfigTaskWidget::onAutopilotConnect() +{ + invalidateObjects(); + dirty=false; + isConnected=true; + enableControls(true); + refreshWidgetsValues(); +} +/** + * SLOT Function used to populate the widgets with the initial values + * Overwrite this if you need to change the default behavior + */ +void ConfigTaskWidget::populateWidgets() +{ + bool dirtyBack=dirty; + emit populateWidgetsRequested(); + foreach(objectToWidget * ow,objOfInterest) + { + if(ow->object==NULL || ow->field==NULL || ow->widget==NULL) + { + // do nothing + } + else + setWidgetFromField(ow->widget,ow->field,ow->index,ow->scale,ow->isLimited); + } + setDirty(dirtyBack); +} +/** + * SLOT function used to refresh the widgets contents of the widgets with relation to + * object field added to the framework pool + * Overwrite this if you need to change the default behavior + */ +void ConfigTaskWidget::refreshWidgetsValues() +{ + bool dirtyBack=dirty; + emit refreshWidgetsValuesRequested(); + foreach(objectToWidget * ow,objOfInterest) + { + if(ow->object==NULL || ow->field==NULL || ow->widget==NULL) + { + //do nothing + } + else + { + setWidgetFromField(ow->widget,ow->field,ow->index,ow->scale,ow->isLimited); + } + + } + setDirty(dirtyBack); +} +/** + * SLOT function used to update the uavobject fields from widgets with relation to + * object field added to the framework pool + * Overwrite this if you need to change the default behavior + */ +void ConfigTaskWidget::updateObjectsFromWidgets() +{ + emit updateObjectsFromWidgetsRequested(); + foreach(objectToWidget * ow,objOfInterest) + { + if(ow->object==NULL || ow->field==NULL) + { + + } + else + setFieldFromWidget(ow->widget,ow->field,ow->index,ow->scale); + + } +} +/** + * SLOT function used handle help button presses + * Overwrite this if you need to change the default behavior + */ +void ConfigTaskWidget::helpButtonPressed() +{ + QString url=helpButtonList.value((QPushButton*)sender(),QString::QString()); + if(!url.isEmpty()) + QDesktopServices::openUrl( QUrl(url, QUrl::StrictMode) ); +} +/** + * Add update and save buttons to the form + * multiple buttons can be added for the same function + * @param update pointer to the update button + * @param save pointer to the save button + */ +void ConfigTaskWidget::addApplySaveButtons(QPushButton *update, QPushButton *save) +{ + if(!smartsave) + { + smartsave=new smartSaveButton(); + connect(smartsave,SIGNAL(preProcessOperations()), this, SLOT(updateObjectsFromWidgets())); + connect(smartsave,SIGNAL(saveSuccessfull()),this,SLOT(clearDirty())); + connect(smartsave,SIGNAL(beginOp()),this,SLOT(disableObjUpdates())); + connect(smartsave,SIGNAL(endOp()),this,SLOT(enableObjUpdates())); + } + if(update && save) + smartsave->addButtons(save,update); + else if (update) + smartsave->addApplyButton(update); + else if (save) + smartsave->addSaveButton(save); + if(objOfInterest.count()>0) + { + foreach(objectToWidget * oTw,objOfInterest) + { + smartsave->addObject((UAVDataObject*)oTw->object); + } + } + TelemetryManager* telMngr = pm->getObject(); + if(telMngr->isConnected()) + enableControls(true); + else + enableControls(false); +} +/** + * SLOT function used the enable or disable the SAVE, UPLOAD and RELOAD buttons + * @param enable set to true to enable the buttons or false to disable them + * @param field name of the field to add + */ +void ConfigTaskWidget::enableControls(bool enable) +{ + if(smartsave) + smartsave->enableControls(enable); + foreach (QPushButton * button, reloadButtonList) { + button->setEnabled(enable); + } +} +/** + * SLOT function called when on of the widgets contents added to the framework changes + */ +void ConfigTaskWidget::widgetsContentsChanged() +{ + emit widgetContentsChanged((QWidget*)sender()); + double scale; + objectToWidget * oTw= shadowsList.value((QWidget*)sender(),NULL); + if(oTw) + { + if(oTw->widget==(QWidget*)sender()) + { + scale=oTw->scale; + checkWidgetsLimits((QWidget*)sender(),oTw->field,oTw->index,oTw->isLimited,getVariantFromWidget((QWidget*)sender(),oTw->scale),oTw->scale); + } + else + { + foreach (shadow * sh, oTw->shadowsList) + { + if(sh->widget==(QWidget*)sender()) + { + scale=sh->scale; + checkWidgetsLimits((QWidget*)sender(),oTw->field,oTw->index,sh->isLimited,getVariantFromWidget((QWidget*)sender(),scale),scale); + } + } + } + if(oTw->widget!=(QWidget *)sender()) + { + disconnectWidgetUpdatesToSlot((QWidget*)oTw->widget,SLOT(widgetsContentsChanged())); + checkWidgetsLimits(oTw->widget,oTw->field,oTw->index,oTw->isLimited,getVariantFromWidget((QWidget*)sender(),scale),oTw->scale); + setWidgetFromVariant(oTw->widget,getVariantFromWidget((QWidget*)sender(),scale),oTw->scale); + emit widgetContentsChanged((QWidget*)oTw->widget); + connectWidgetUpdatesToSlot((QWidget*)oTw->widget,SLOT(widgetsContentsChanged())); + } + foreach (shadow * sh, oTw->shadowsList) + { + if(sh->widget!=(QWidget*)sender()) + { + disconnectWidgetUpdatesToSlot((QWidget*)sh->widget,SLOT(widgetsContentsChanged())); + checkWidgetsLimits(sh->widget,oTw->field,oTw->index,sh->isLimited,getVariantFromWidget((QWidget*)sender(),scale),sh->scale); + setWidgetFromVariant(sh->widget,getVariantFromWidget((QWidget*)sender(),scale),sh->scale); + emit widgetContentsChanged((QWidget*)sh->widget); + connectWidgetUpdatesToSlot((QWidget*)sh->widget,SLOT(widgetsContentsChanged())); + } + } + } + setDirty(true); +} +/** + * SLOT function used clear the forms dirty status flag + */ +void ConfigTaskWidget::clearDirty() +{ + setDirty(false); +} +/** + * Sets the form's dirty status flag + * @param value + */ +void ConfigTaskWidget::setDirty(bool value) +{ + dirty=value; +} +/** + * Checks if the form is dirty (unsaved changes) + * @return true if the form has unsaved changes + */ +bool ConfigTaskWidget::isDirty() +{ + if(isConnected) + return dirty; + else + return false; +} +/** + * SLOT function used to disable widget contents changes when related object field changes + */ +void ConfigTaskWidget::disableObjUpdates() +{ + foreach(objectToWidget * obj,objOfInterest) + { + if(obj->object) + disconnect(obj->object, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshWidgetsValues())); + } +} +/** + * SLOT function used to enable widget contents changes when related object field changes + */ +void ConfigTaskWidget::enableObjUpdates() +{ + foreach(objectToWidget * obj,objOfInterest) + { + if(obj->object) + connect(obj->object, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshWidgetsValues())); + } +} +/** + * Called when an uav object is updated + * @param obj pointer to the object whitch has just been updated + */ +void ConfigTaskWidget::objectUpdated(UAVObject *obj) +{ + objectUpdates[obj]=true; +} +/** + * Checks if all objects added to the pool have already been updated + * @return true if all objects added to the pool have already been updated + */ +bool ConfigTaskWidget::allObjectsUpdated() +{ + bool ret=true; + foreach(UAVObject *obj, objectUpdates.keys()) + { + ret=ret & objectUpdates[obj]; + } + return ret; +} +/** + * Adds a new help button + * @param button pointer to the help button + * @param url url to open in the browser when the help button is pressed + */ +void ConfigTaskWidget::addHelpButton(QPushButton *button, QString url) +{ + helpButtonList.insert(button,url); + connect(button,SIGNAL(clicked()),this,SLOT(helpButtonPressed())); + +} +/** + * Invalidates all the uav objects "is updated" flag + */ +void ConfigTaskWidget::invalidateObjects() +{ + foreach(UAVObject *obj, objectUpdates.keys()) + { + objectUpdates[obj]=false; + } +} +/** + * SLOT call this to apply changes to uav objects + */ +void ConfigTaskWidget::apply() +{ + if(smartsave) + smartsave->apply(); +} +/** + * SLOT call this to save changes to uav objects + */ +void ConfigTaskWidget::save() +{ + if(smartsave) + smartsave->save(); +} +/** + * Adds a new shadow widget + * shadow widgets are widgets whitch have a relation to an object already present on the framework pool i.e. already added trough addUAVObjectToWidgetRelation + * This function doesn't have to be used directly, addUAVObjectToWidgetRelation will call it if a previous relation exhists. + * @return returns false if the shadow widget relation failed to be added (no previous relation exhisted) + */ +bool ConfigTaskWidget::addShadowWidget(QString object, QString field, QWidget *widget, int index, double scale, bool isLimited,QList* defaultReloadGroups,quint32 instID) +{ + foreach(objectToWidget * oTw,objOfInterest) + { + if(!oTw->object || !oTw->widget) + continue; + if(oTw->object->getName()==object && oTw->field->getName()==field && oTw->index==index && oTw->object->getInstID()==instID) + { + shadow * sh=NULL; + //prefer anything else to QLabel + if(qobject_cast(oTw->widget) && !qobject_cast(widget)) + { + sh=new shadow; + sh->isLimited=oTw->isLimited; + sh->scale=oTw->scale; + sh->widget=oTw->widget; + oTw->isLimited=isLimited; + oTw->scale=scale; + oTw->widget=widget; + } + //prefer QDoubleSpinBox to anything else + else if(!qobject_cast(oTw->widget) && qobject_cast(widget)) + { + sh=new shadow; + sh->isLimited=oTw->isLimited; + sh->scale=oTw->scale; + sh->widget=oTw->widget; + oTw->isLimited=isLimited; + oTw->scale=scale; + oTw->widget=widget; + } + else + { + sh=new shadow; + sh->isLimited=isLimited; + sh->scale=scale; + sh->widget=widget; + } + shadowsList.insert(widget,oTw); + oTw->shadowsList.append(sh); + connectWidgetUpdatesToSlot(widget,SLOT(widgetsContentsChanged())); + if(defaultReloadGroups) + addWidgetToDefaultReloadGroups(widget,defaultReloadGroups); + loadWidgetLimits(widget,oTw->field,oTw->index,isLimited,scale); + return true; + } + } + return false; +} +/** + * Auto loads widgets based on the Dynamic property named "objrelation" + * Check the wiki for more information + */ +void ConfigTaskWidget::autoLoadWidgets() +{ + QPushButton * saveButtonWidget=NULL; + QPushButton * applyButtonWidget=NULL; + foreach(QWidget * widget,this->findChildren()) + { + QVariant info=widget->property("objrelation"); + if(info.isValid()) + { + uiRelationAutomation uiRelation; + uiRelation.buttonType=none; + uiRelation.scale=1; + uiRelation.element=QString(); + uiRelation.haslimits=false; + foreach(QString str, info.toStringList()) + { + QString prop=str.split(":").at(0); + QString value=str.split(":").at(1); + if(prop== "objname") + uiRelation.objname=value; + else if(prop== "fieldname") + uiRelation.fieldname=value; + else if(prop=="element") + uiRelation.element=value; + else if(prop== "scale") + { + if(value=="null") + uiRelation.scale=1; + else + uiRelation.scale=value.toDouble(); + } + else if(prop== "haslimits") + { + if(value=="yes") + uiRelation.haslimits=true; + else + uiRelation.haslimits=false; + } + else if(prop== "button") + { + if(value=="save") + uiRelation.buttonType=save_button; + else if(value=="apply") + uiRelation.buttonType=apply_button; + else if(value=="reload") + uiRelation.buttonType=reload_button; + else if(value=="default") + uiRelation.buttonType=default_button; + else if(value=="help") + uiRelation.buttonType=help_button; + } + else if(prop== "buttongroup") + { + foreach(QString s,value.split(",")) + { + uiRelation.buttonGroup.append(s.toInt()); + } + } + else if(prop=="url") + uiRelation.url=str.mid(str.indexOf(":")+1); + } + if(!uiRelation.buttonType==none) + { + QPushButton * button=NULL; + switch(uiRelation.buttonType) + { + case save_button: + saveButtonWidget=qobject_cast(widget); + if(saveButtonWidget) + addApplySaveButtons(NULL,saveButtonWidget); + break; + case apply_button: + applyButtonWidget=qobject_cast(widget); + if(applyButtonWidget) + addApplySaveButtons(applyButtonWidget,NULL); + break; + case default_button: + button=qobject_cast(widget); + if(button) + addDefaultButton(button,uiRelation.buttonGroup.at(0)); + break; + case reload_button: + button=qobject_cast(widget); + if(button) + addReloadButton(button,uiRelation.buttonGroup.at(0)); + break; + case help_button: + button=qobject_cast(widget); + if(button) + addHelpButton(button,uiRelation.url); + break; + + default: + break; + } + } + else + { + QWidget * wid=qobject_cast(widget); + if(wid) + addUAVObjectToWidgetRelation(uiRelation.objname,uiRelation.fieldname,wid,uiRelation.element,uiRelation.scale,uiRelation.haslimits,&uiRelation.buttonGroup); + } + } + } + refreshWidgetsValues(); +} +/** + * Adds a widget to a list of default/reload groups + * default/reload groups are groups of widgets to be set with default or reloaded (values from persistent memory) when a defined button is pressed + * @param widget pointer to the widget to be added to the groups + * @param groups list of the groups on which to add the widget + */ +void ConfigTaskWidget::addWidgetToDefaultReloadGroups(QWidget *widget, QList * groups) +{ + foreach(objectToWidget * oTw,objOfInterest) + { + bool addOTW=false; + if(oTw->widget==widget) + addOTW=true; + else + { + foreach(shadow * sh, oTw->shadowsList) + { + if(sh->widget==widget) + addOTW=true; + } + } + if(addOTW) + { + foreach(int i,*groups) + { + if(defaultReloadGroups.contains(i)) + { + defaultReloadGroups.value(i)->append(oTw); + } + else + { + defaultReloadGroups.insert(i,new QList()); + defaultReloadGroups.value(i)->append(oTw); + } + } + } + } +} +/** + * Adds a button to a default group + * @param button pointer to the default button + * @param buttongroup number of the group + */ +void ConfigTaskWidget::addDefaultButton(QPushButton *button, int buttonGroup) +{ + button->setProperty("group",buttonGroup); + connect(button,SIGNAL(clicked()),this,SLOT(defaultButtonClicked())); +} +/** + * Adds a button to a reload group + * @param button pointer to the reload button + * @param buttongroup number of the group + */ +void ConfigTaskWidget::addReloadButton(QPushButton *button, int buttonGroup) +{ + button->setProperty("group",buttonGroup); + reloadButtonList.append(button); + connect(button,SIGNAL(clicked()),this,SLOT(reloadButtonClicked())); +} +/** + * Called when a default button is clicked + */ +void ConfigTaskWidget::defaultButtonClicked() +{ + int group=sender()->property("group").toInt(); + QList * list=defaultReloadGroups.value(group); + foreach(objectToWidget * oTw,*list) + { + if(!oTw->object) + continue; + UAVDataObject * temp=((UAVDataObject*)oTw->object)->dirtyClone(); + setWidgetFromField(oTw->widget,temp->getField(oTw->field->getName()),oTw->index,oTw->scale,oTw->isLimited); + } +} +/** + * Called when a reload button is clicked + */ +void ConfigTaskWidget::reloadButtonClicked() +{ + int group=sender()->property("group").toInt(); + QList * list=defaultReloadGroups.value(group,NULL); + if(!list) + return; + ObjectPersistence* objper = dynamic_cast( getObjectManager()->getObject(ObjectPersistence::NAME) ); + QTimer * timeOut=new QTimer(this); + QEventLoop * eventLoop=new QEventLoop(this); + connect(timeOut, SIGNAL(timeout()),eventLoop,SLOT(quit())); + connect(objper, SIGNAL(objectUpdated(UAVObject*)), eventLoop, SLOT(quit())); + foreach(objectToWidget * oTw,*list) + { + if (oTw->object != NULL) + { + ObjectPersistence::DataFields data; + data.Operation = ObjectPersistence::OPERATION_LOAD; + data.Selection = ObjectPersistence::SELECTION_SINGLEOBJECT; + data.ObjectID = oTw->object->getObjID(); + data.InstanceID = oTw->object->getInstID(); + objper->setData(data); + objper->updated(); + timeOut->start(500); + eventLoop->exec(); + if(timeOut->isActive()) + { + setWidgetFromField(oTw->widget,oTw->field,oTw->index,oTw->scale,oTw->isLimited); + } + timeOut->stop(); + } + } + delete eventLoop; + delete timeOut; +} + +/** + * Connects widgets "contents changed" signals to a slot + */ +void ConfigTaskWidget::connectWidgetUpdatesToSlot(QWidget * widget,const char* function) +{ + if(!widget) + return; + if(QComboBox * cb=qobject_cast(widget)) + { + connect(cb,SIGNAL(currentIndexChanged(int)),this,function); + } + else if(QSlider * cb=qobject_cast(widget)) + { + connect(cb,SIGNAL(valueChanged(int)),this,function); + } + else if(MixerCurveWidget * cb=qobject_cast(widget)) + { + connect(cb,SIGNAL(curveUpdated(QList,double)),this,function); + } + else if(QTableWidget * cb=qobject_cast(widget)) + { + connect(cb,SIGNAL(cellChanged(int,int)),this,function); + } + else if(QSpinBox * cb=qobject_cast(widget)) + { + connect(cb,SIGNAL(valueChanged(int)),this,function); + } + else if(QDoubleSpinBox * cb=qobject_cast(widget)) + { + connect(cb,SIGNAL(valueChanged(double)),this,function); + } + else if(QCheckBox * cb=qobject_cast(widget)) + { + connect(cb,SIGNAL(stateChanged(int)),this,function); + } + else if(QPushButton * cb=qobject_cast(widget)) + { + connect(cb,SIGNAL(clicked()),this,function); + } + else + qDebug()<<__FUNCTION__<<"widget to uavobject relation not implemented"<metaObject()->className(); + +} +/** + * Disconnects widgets "contents changed" signals to a slot + */ +void ConfigTaskWidget::disconnectWidgetUpdatesToSlot(QWidget * widget,const char* function) +{ + if(!widget) + return; + if(QComboBox * cb=qobject_cast(widget)) + { + disconnect(cb,SIGNAL(currentIndexChanged(int)),this,function); + } + else if(QSlider * cb=qobject_cast(widget)) + { + disconnect(cb,SIGNAL(valueChanged(int)),this,function); + } + else if(MixerCurveWidget * cb=qobject_cast(widget)) + { + disconnect(cb,SIGNAL(curveUpdated(QList,double)),this,function); + } + else if(QTableWidget * cb=qobject_cast(widget)) + { + disconnect(cb,SIGNAL(cellChanged(int,int)),this,function); + } + else if(QSpinBox * cb=qobject_cast(widget)) + { + disconnect(cb,SIGNAL(valueChanged(int)),this,function); + } + else if(QDoubleSpinBox * cb=qobject_cast(widget)) + { + disconnect(cb,SIGNAL(valueChanged(double)),this,function); + } + else if(QCheckBox * cb=qobject_cast(widget)) + { + disconnect(cb,SIGNAL(stateChanged(int)),this,function); + } + else if(QPushButton * cb=qobject_cast(widget)) + { + disconnect(cb,SIGNAL(clicked()),this,function); + } + else + qDebug()<<__FUNCTION__<<"widget to uavobject relation not implemented"<metaObject()->className(); + +} +/** + * Sets a widget value from an UAVObject field + * @param widget pointer for the widget to set + * @param field pointer to the UAVObject field to use + * @param index index of the element to use + * @param scale scale to be used on the assignement + * @return returns true if the assignement was successfull + */ +bool ConfigTaskWidget::setFieldFromWidget(QWidget * widget,UAVObjectField * field,int index,double scale) +{ + if(!widget || !field) + return false; + QVariant ret=getVariantFromWidget(widget,scale); + if(ret.isValid()) + { + field->setValue(ret,index); + return true; + } + { + qDebug()<<__FUNCTION__<<"widget to uavobject relation not implemented"<metaObject()->className(); + return false; + } +} +/** + * Gets a variant from a widget + * @param widget pointer to the widget from where to get the value + * @param scale scale to be used on the assignement + * @return returns the value of the widget times the scale + */ +QVariant ConfigTaskWidget::getVariantFromWidget(QWidget * widget,double scale) +{ + if(QComboBox * cb=qobject_cast(widget)) + { + return (QString)cb->currentText(); + } + else if(QDoubleSpinBox * cb=qobject_cast(widget)) + { + return (double)(cb->value()* scale); + } + else if(QSpinBox * cb=qobject_cast(widget)) + { + return (double)(cb->value()* scale); + } + else if(QSlider * cb=qobject_cast(widget)) + { + return(double)(cb->value()* scale); + } + else if(QCheckBox * cb=qobject_cast(widget)) + { + return (QString)(cb->isChecked()?"TRUE":"FALSE"); + } + else + return QVariant(); +} +/** + * Sets a widget from a variant + * @param widget pointer for the widget to set + * @param scale scale to be used on the assignement + * @param value value to be used on the assignement + * @return returns true if the assignement was successfull + */ +bool ConfigTaskWidget::setWidgetFromVariant(QWidget *widget, QVariant value, double scale) +{ + if(QComboBox * cb=qobject_cast(widget)) + { + cb->setCurrentIndex(cb->findText(value.toString())); + return true; + } + else if(QLabel * cb=qobject_cast(widget)) + { + if(scale==0) + cb->setText(value.toString()); + else + cb->setText(QString::number((value.toDouble()/scale))); + return true; + } + else if(QDoubleSpinBox * cb=qobject_cast(widget)) + { + cb->setValue((double)(value.toDouble()/scale)); + return true; + } + else if(QSpinBox * cb=qobject_cast(widget)) + { + cb->setValue((int)qRound(value.toDouble()/scale)); + return true; + } + else if(QSlider * cb=qobject_cast(widget)) + { + cb->setValue((int)qRound(value.toDouble()/scale)); + return true; + } + else if(QCheckBox * cb=qobject_cast(widget)) + { + bool bvalue=value.toString()=="TRUE"; + cb->setChecked(bvalue); + return true; + } + else + return false; +} +/** + * Sets a widget from a UAVObject field + * @param widget pointer to the widget to set + * @param field pointer to the field from where to get the value from + * @param index index of the element to use + * @param scale scale to be used on the assignement + * @param hasLimits set to true if you want to limit the values (check wiki) + * @return returns true if the assignement was successfull + */ +bool ConfigTaskWidget::setWidgetFromField(QWidget * widget,UAVObjectField * field,int index,double scale,bool hasLimits) +{ + if(!widget || !field) + return false; + if(QComboBox * cb=qobject_cast(widget)) + { + if(cb->count()==0) + loadWidgetLimits(cb,field,index,hasLimits,scale); + } + QVariant var=field->getValue(index); + checkWidgetsLimits(widget,field,index,hasLimits,var,scale); + bool ret=setWidgetFromVariant(widget,var,scale); + if(ret) + return true; + else + { + qDebug()<<__FUNCTION__<<"widget to uavobject relation not implemented"<metaObject()->className(); + return false; + } +} +void ConfigTaskWidget::checkWidgetsLimits(QWidget * widget,UAVObjectField * field,int index,bool hasLimits, QVariant value, double scale) +{ + if(!hasLimits) + return; + if(!field->isWithinLimits(value,index)) + { + if(!widget->property("styleBackup").isValid()) + widget->setProperty("styleBackup",widget->styleSheet()); + widget->setStyleSheet(outOfLimitsStyle); + widget->setProperty("wasOverLimits",(bool)true); + if(QComboBox * cb=qobject_cast(widget)) + { + if(cb->findText(value.toString())==-1) + cb->addItem(value.toString()); + } + else if(QDoubleSpinBox * cb=qobject_cast(widget)) + { + if((double)(value.toDouble()/scale)>cb->maximum()) + { + cb->setMaximum((double)(value.toDouble()/scale)); + } + else if((double)(value.toDouble()/scale)minimum()) + { + cb->setMinimum((double)(value.toDouble()/scale)); + } + + } + else if(QSpinBox * cb=qobject_cast(widget)) + { + if((int)qRound(value.toDouble()/scale)>cb->maximum()) + { + cb->setMaximum((int)qRound(value.toDouble()/scale)); + } + else if((int)qRound(value.toDouble()/scale)minimum()) + { + cb->setMinimum((int)qRound(value.toDouble()/scale)); + } + } + else if(QSlider * cb=qobject_cast(widget)) + { + if((int)qRound(value.toDouble()/scale)>cb->maximum()) + { + cb->setMaximum((int)qRound(value.toDouble()/scale)); + } + else if((int)qRound(value.toDouble()/scale)minimum()) + { + cb->setMinimum((int)qRound(value.toDouble()/scale)); + } + } + + } + else if(widget->property("wasOverLimits").isValid()) + { + if(widget->property("wasOverLimits").toBool()) + { + widget->setProperty("wasOverLimits",(bool)false); + if(widget->property("styleBackup").isValid()) + { + QString style=widget->property("styleBackup").toString(); + widget->setStyleSheet(style); + } + loadWidgetLimits(widget,field,index,hasLimits,scale); + } + } +} + +void ConfigTaskWidget::loadWidgetLimits(QWidget * widget,UAVObjectField * field,int index,bool hasLimits,double scale) +{ + if(!widget || !field) + return; + if(QComboBox * cb=qobject_cast(widget)) + { + cb->clear(); + QStringList option=field->getOptions(); + if(hasLimits) + { + foreach(QString str,option) + { + if(field->isWithinLimits(str,index)) + cb->addItem(str); + } + } + else + cb->addItems(option); + } + if(!hasLimits) + return; + else if(QDoubleSpinBox * cb=qobject_cast(widget)) + { + if(field->getMaxLimit(index).isValid()) + { + cb->setMaximum((double)(field->getMaxLimit(index).toDouble()/scale)); + } + if(field->getMinLimit(index).isValid()) + { + cb->setMinimum((double)(field->getMinLimit(index).toDouble()/scale)); + } + } + else if(QSpinBox * cb=qobject_cast(widget)) + { + if(field->getMaxLimit(index).isValid()) + { + cb->setMaximum((int)qRound(field->getMaxLimit(index).toDouble()/scale)); + } + if(field->getMinLimit(index).isValid()) + { + cb->setMinimum((int)qRound(field->getMinLimit(index).toDouble()/scale)); + } + } + else if(QSlider * cb=qobject_cast(widget)) + { + if(field->getMaxLimit(index).isValid()) + { + cb->setMaximum((int)qRound(field->getMaxLimit(index).toDouble()/scale)); + } + if(field->getMinLimit(index).isValid()) + { + cb->setMinimum((int)(field->getMinLimit(index).toDouble()/scale)); + } + } +} + +/** + @} + @} + */ diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.h b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.h new file mode 100644 index 000000000..b6733acc0 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/configtaskwidget.h @@ -0,0 +1,176 @@ +/** + ****************************************************************************** + * + * @file configtaskwidget.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @addtogroup UAVObjectWidgetUtils Plugin + * @{ + * @brief Utility plugin for UAVObject to Widget relation management + *****************************************************************************/ +/* + * This program 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. + * + * This program 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 this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef CONFIGTASKWIDGET_H +#define CONFIGTASKWIDGET_H + + +#include "extensionsystem/pluginmanager.h" +#include "uavobjectmanager.h" +#include "uavobject.h" +#include "uavobjectutilmanager.h" +#include +#include +#include +#include +#include "smartsavebutton.h" +#include "mixercurvewidget.h" +#include +#include +#include +#include +#include +#include "uavobjectwidgetutils_global.h" +#include +#include + +class UAVOBJECTWIDGETUTILS_EXPORT ConfigTaskWidget: public QWidget +{ + Q_OBJECT + +public: + struct shadow + { + QWidget * widget; + double scale; + bool isLimited; + }; + struct objectToWidget + { + UAVObject * object; + UAVObjectField * field; + QWidget * widget; + int index; + double scale; + bool isLimited; + QList shadowsList; + }; + + enum buttonTypeEnum {none,save_button,apply_button,reload_button,default_button,help_button}; + struct uiRelationAutomation + { + QString objname; + QString fieldname; + QString element; + QString url; + double scale; + bool haslimits; + buttonTypeEnum buttonType; + QList buttonGroup; + }; + + ConfigTaskWidget(QWidget *parent = 0); + ~ConfigTaskWidget(); + + void saveObjectToSD(UAVObject *obj); + UAVObjectManager* getObjectManager(); + static double listMean(QList list); + + void addUAVObject(QString objectName); + void addWidget(QWidget * widget); + + void addUAVObjectToWidgetRelation(QString object,QString field,QWidget * widget,int index=0,double scale=1,bool isLimited=false,QList* defaultReloadGroups=0,quint32 instID=0); + void addUAVObjectToWidgetRelation(QString object,QString field,QWidget * widget,QString element,double scale,bool isLimited=false,QList* defaultReloadGroups=0,quint32 instID=0); + void addUAVObjectToWidgetRelation(QString object, QString field, QWidget *widget, QString index); + + //BUTTONS// + void addApplySaveButtons(QPushButton * update,QPushButton * save); + void addReloadButton(QPushButton * button,int buttonGroup); + void addDefaultButton(QPushButton * button,int buttonGroup); + ////////// + + void addWidgetToDefaultReloadGroups(QWidget * widget, QList *groups); + + bool addShadowWidget(QWidget * masterWidget, QWidget * shadowWidget,double shadowScale=1,bool shadowIsLimited=false); + bool addShadowWidget(QString object,QString field,QWidget * widget,int index=0,double scale=1,bool isLimited=false, QList *defaultReloadGroups=NULL, quint32 instID=0); + + void autoLoadWidgets(); + + bool isDirty(); + void setDirty(bool value); + + bool allObjectsUpdated(); + void setOutOfLimitsStyle(QString style){outOfLimitsStyle=style;} + void addHelpButton(QPushButton * button,QString url); +public slots: + void onAutopilotDisconnect(); + void onAutopilotConnect(); + void invalidateObjects(); + void apply(); + void save(); +signals: + //fired when a widgets contents changes + void widgetContentsChanged(QWidget * widget); + //fired when the framework requests that the widgets values be populated, use for custom behaviour + void populateWidgetsRequested(); + //fired when the framework requests that the widgets values be refreshed, use for custom behaviour + void refreshWidgetsValuesRequested(); + //fired when the framework requests that the UAVObject values be updated from the widgets value, use for custom behaviour + void updateObjectsFromWidgetsRequested(); + //fired when the autopilot connects + void autoPilotConnected(); + //fired when the autopilot disconnects + void autoPilotDisconnected(); +private slots: + void objectUpdated(UAVObject*); + void defaultButtonClicked(); + void reloadButtonClicked(); +private: + bool isConnected; + QStringList objectsList; + QList objOfInterest; + ExtensionSystem::PluginManager *pm; + UAVObjectManager *objManager; + smartSaveButton *smartsave; + QMap objectUpdates; + QMap *> defaultReloadGroups; + QMap shadowsList; + QMap helpButtonList; + QList reloadButtonList; + bool dirty; + bool setFieldFromWidget(QWidget *widget, UAVObjectField *field, int index, double scale); + bool setWidgetFromField(QWidget *widget, UAVObjectField *field, int index, double scale, bool hasLimits); + QVariant getVariantFromWidget(QWidget *widget, double scale); + bool setWidgetFromVariant(QWidget *widget,QVariant value,double scale); + void connectWidgetUpdatesToSlot(QWidget *widget, const char *function); + void disconnectWidgetUpdatesToSlot(QWidget *widget, const char *function); + void loadWidgetLimits(QWidget *widget, UAVObjectField *field, int index, bool hasLimits, double sclale); + QString outOfLimitsStyle; +protected slots: + virtual void disableObjUpdates(); + virtual void enableObjUpdates(); + virtual void clearDirty(); + virtual void widgetsContentsChanged(); + virtual void populateWidgets(); + virtual void refreshWidgetsValues(); + virtual void updateObjectsFromWidgets(); + virtual void helpButtonPressed(); +protected: + virtual void enableControls(bool enable); + void checkWidgetsLimits(QWidget *widget, UAVObjectField *field, int index, bool hasLimits, QVariant value, double scale); +}; + +#endif // CONFIGTASKWIDGET_H diff --git a/ground/openpilotgcs/src/plugins/config/mixercurveline.cpp b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurveline.cpp similarity index 92% rename from ground/openpilotgcs/src/plugins/config/mixercurveline.cpp rename to ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurveline.cpp index 8a49a3d18..4846f62e3 100644 --- a/ground/openpilotgcs/src/plugins/config/mixercurveline.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurveline.cpp @@ -2,13 +2,12 @@ ****************************************************************************** * * @file mixercurveline.h - * @author Edouard Lafargue Copyright (C) 2010. - * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2010. + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @addtogroup GCSPlugins GCS Plugins * @{ - * @addtogroup ConfigPlugin Configuration Plugin + * @addtogroup UAVObjectWidgetUtils Plugin * @{ - * @brief A line connecting two mixer points + * @brief Utility plugin for UAVObject to Widget relation management *****************************************************************************/ /* * This program is free software; you can redistribute it and/or modify diff --git a/ground/openpilotgcs/src/plugins/config/mixercurveline.h b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurveline.h similarity index 88% rename from ground/openpilotgcs/src/plugins/config/mixercurveline.h rename to ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurveline.h index 540a36457..80fb50e0c 100644 --- a/ground/openpilotgcs/src/plugins/config/mixercurveline.h +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurveline.h @@ -2,13 +2,12 @@ ****************************************************************************** * * @file mixercurveline.h - * @author Edouard Lafargue Copyright (C) 2010. - * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2010. + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @addtogroup GCSPlugins GCS Plugins * @{ - * @addtogroup ConfigPlugin Configuration Plugin + * @addtogroup UAVObjectWidgetUtils Plugin * @{ - * @brief A line connecting two mixer points + * @brief Utility plugin for UAVObject to Widget relation management *****************************************************************************/ /* * This program is free software; you can redistribute it and/or modify diff --git a/ground/openpilotgcs/src/plugins/config/mixercurvepoint.cpp b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvepoint.cpp similarity index 94% rename from ground/openpilotgcs/src/plugins/config/mixercurvepoint.cpp rename to ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvepoint.cpp index d7702b7e6..6eaa8f5ed 100644 --- a/ground/openpilotgcs/src/plugins/config/mixercurvepoint.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvepoint.cpp @@ -2,13 +2,12 @@ ****************************************************************************** * * @file mixercurvepoint.h - * @author Edouard Lafargue Copyright (C) 2010. - * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2010. + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @addtogroup GCSPlugins GCS Plugins * @{ - * @addtogroup ConfigPlugin Configuration Plugin + * @addtogroup UAVObjectWidgetUtils Plugin * @{ - * @brief A point on the mixer curve + * @brief Utility plugin for UAVObject to Widget relation management *****************************************************************************/ /* * This program is free software; you can redistribute it and/or modify diff --git a/ground/openpilotgcs/src/plugins/config/mixercurvepoint.h b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvepoint.h similarity index 89% rename from ground/openpilotgcs/src/plugins/config/mixercurvepoint.h rename to ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvepoint.h index e59622fee..987875e32 100644 --- a/ground/openpilotgcs/src/plugins/config/mixercurvepoint.h +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvepoint.h @@ -2,13 +2,12 @@ ****************************************************************************** * * @file mixercurvepoint.h - * @author Edouard Lafargue Copyright (C) 2010. - * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2010. + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @addtogroup GCSPlugins GCS Plugins * @{ - * @addtogroup ConfigPlugin Configuration Plugin + * @addtogroup UAVObjectWidgetUtils Plugin * @{ - * @brief A point on the mixer curve + * @brief Utility plugin for UAVObject to Widget relation management *****************************************************************************/ /* * This program is free software; you can redistribute it and/or modify diff --git a/ground/openpilotgcs/src/plugins/config/mixercurvewidget.cpp b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvewidget.cpp similarity index 96% rename from ground/openpilotgcs/src/plugins/config/mixercurvewidget.cpp rename to ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvewidget.cpp index 6e031d8d7..f21d782f6 100644 --- a/ground/openpilotgcs/src/plugins/config/mixercurvewidget.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvewidget.cpp @@ -2,12 +2,12 @@ ****************************************************************************** * * @file mixercurvewidget.cpp - * @author Edouard Lafargue Copyright (C) 2010. + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @addtogroup GCSPlugins GCS Plugins * @{ - * @addtogroup ConfigPlugin Config Plugin + * @addtogroup UAVObjectWidgetUtils Plugin * @{ - * @brief A widget which displays an adjustable mixer curve + * @brief Utility plugin for UAVObject to Widget relation management *****************************************************************************/ /* * This program is free software; you can redistribute it and/or modify diff --git a/ground/openpilotgcs/src/plugins/config/mixercurvewidget.h b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvewidget.h similarity index 86% rename from ground/openpilotgcs/src/plugins/config/mixercurvewidget.h rename to ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvewidget.h index 3bba14335..9a14123a7 100644 --- a/ground/openpilotgcs/src/plugins/config/mixercurvewidget.h +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvewidget.h @@ -2,12 +2,12 @@ ****************************************************************************** * * @file mixercurvewidget.h - * @author Edouard Lafargue Copyright (C) 2010. + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @addtogroup GCSPlugins GCS Plugins * @{ - * @addtogroup ConfigPlugin Configuration Plugin + * @addtogroup UAVObjectWidgetUtils Plugin * @{ - * @brief A widget which displays a mixer curve + * @brief Utility plugin for UAVObject to Widget relation management *****************************************************************************/ /* * This program is free software; you can redistribute it and/or modify @@ -33,9 +33,9 @@ #include #include "mixercurvepoint.h" #include "mixercurveline.h" +#include "uavobjectwidgetutils_global.h" - -class MixerCurveWidget : public QGraphicsView +class UAVOBJECTWIDGETUTILS_EXPORT MixerCurveWidget : public QGraphicsView { Q_OBJECT diff --git a/ground/openpilotgcs/src/plugins/config/smartsavebutton.cpp b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/smartsavebutton.cpp similarity index 53% rename from ground/openpilotgcs/src/plugins/config/smartsavebutton.cpp rename to ground/openpilotgcs/src/plugins/uavobjectwidgetutils/smartsavebutton.cpp index 69ddb9cb2..36da08758 100644 --- a/ground/openpilotgcs/src/plugins/config/smartsavebutton.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/smartsavebutton.cpp @@ -1,24 +1,74 @@ +/** + ****************************************************************************** + * + * @file smartsavebutton.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @addtogroup UAVObjectWidgetUtils Plugin + * @{ + * @brief Utility plugin for UAVObject to Widget relation management + *****************************************************************************/ +/* + * This program 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. + * + * This program 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 this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #include "smartsavebutton.h" -smartSaveButton::smartSaveButton(QPushButton * update, QPushButton * save):bupdate(update),bsave(save) +smartSaveButton::smartSaveButton() { - connect(bsave,SIGNAL(clicked()),this,SLOT(processClick())); - connect(bupdate,SIGNAL(clicked()),this,SLOT(processClick())); } + +void smartSaveButton::addButtons(QPushButton *save, QPushButton *apply) +{ + buttonList.insert(save,save_button); + buttonList.insert(apply,apply_button); + connect(save,SIGNAL(clicked()),this,SLOT(processClick())); + connect(apply,SIGNAL(clicked()),this,SLOT(processClick())); +} +void smartSaveButton::addApplyButton(QPushButton *apply) +{ + buttonList.insert(apply,apply_button); + connect(apply,SIGNAL(clicked()),this,SLOT(processClick())); +} +void smartSaveButton::addSaveButton(QPushButton *save) +{ + buttonList.insert(save,save_button); + connect(save,SIGNAL(clicked()),this,SLOT(processClick())); +} void smartSaveButton::processClick() { emit beginOp(); bool save=false; - QPushButton *button=bupdate; - if(sender()==bsave) - { + QPushButton *button=qobject_cast(sender()); + if(!button) + return; + if(buttonList.value(button)==save_button) save=true; - button=bsave; - } + processOperation(button,save); + +} + +void smartSaveButton::processOperation(QPushButton * button,bool save) +{ emit preProcessOperations(); - button->setEnabled(false); - button->setIcon(QIcon(":/uploader/images/system-run.svg")); + if(button) + { + button->setEnabled(false); + button->setIcon(QIcon(":/uploader/images/system-run.svg")); + } QTimer timer; timer.setSingleShot(true); bool error=false; @@ -78,15 +128,18 @@ void smartSaveButton::processClick() } } } - button->setEnabled(true); + if(button) + button->setEnabled(true); if(!error) { - button->setIcon(QIcon(":/uploader/images/dialog-apply.svg")); + if(button) + button->setIcon(QIcon(":/uploader/images/dialog-apply.svg")); emit saveSuccessfull(); } else { - button->setIcon(QIcon(":/uploader/images/process-stop.svg")); + if(button) + button->setIcon(QIcon(":/uploader/images/process-stop.svg")); } emit endOp(); } @@ -101,7 +154,15 @@ void smartSaveButton::addObject(UAVDataObject * obj) if(!objects.contains(obj)) objects.append(obj); } - +void smartSaveButton::removeObject(UAVDataObject * obj) +{ + if(objects.contains(obj)) + objects.removeAll(obj); +} +void smartSaveButton::removeAllObjects() +{ + objects.clear(); +} void smartSaveButton::clearObjects() { objects.clear(); @@ -127,6 +188,18 @@ void smartSaveButton::saving_finished(int id, bool result) void smartSaveButton::enableControls(bool value) { - bupdate->setEnabled(value); - bsave->setEnabled(value); + foreach(QPushButton * button,buttonList.keys()) + button->setEnabled(value); } + +void smartSaveButton::apply() +{ + processOperation(NULL,false); +} + +void smartSaveButton::save() +{ + processOperation(NULL,true); +} + + diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/smartsavebutton.h b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/smartsavebutton.h new file mode 100644 index 000000000..6931cee92 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/smartsavebutton.h @@ -0,0 +1,84 @@ +/** + ****************************************************************************** + * + * @file smartsavebutton.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @addtogroup UAVObjectWidgetUtils Plugin + * @{ + * @brief Utility plugin for UAVObject to Widget relation management + *****************************************************************************/ +/* + * This program 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. + * + * This program 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 this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef SMARTSAVEBUTTON_H +#define SMARTSAVEBUTTON_H + +#include "uavtalk/telemetrymanager.h" +#include "extensionsystem/pluginmanager.h" +#include "uavobjectmanager.h" +#include "uavobject.h" +#include +#include +#include +#include "uavobjectutilmanager.h" +#include +#include +class smartSaveButton:public QObject +{ + enum buttonTypeEnum {save_button,apply_button}; +public: + Q_OBJECT +public: + smartSaveButton(); + void addButtons(QPushButton * save,QPushButton * apply); + void setObjects(QList); + void addObject(UAVDataObject *); + void clearObjects(); + void removeObject(UAVDataObject *obj); + void removeAllObjects(); + void addApplyButton(QPushButton *apply); + void addSaveButton(QPushButton *save); +signals: + void preProcessOperations(); + void saveSuccessfull(); + void beginOp(); + void endOp(); +public slots: + void apply(); + void save(); +private slots: + void processClick(); + void processOperation(QPushButton *button, bool save); + void transaction_finished(UAVObject* obj, bool result); + void saving_finished(int,bool); + +private: + quint32 current_objectID; + UAVDataObject * current_object; + bool up_result; + bool sv_result; + QEventLoop loop; + QList objects; + QMap buttonList; +protected: +public slots: + void enableControls(bool value); + +}; + + +#endif // SMARTSAVEBUTTON_H diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/uavobjectwidgetutils.pri b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/uavobjectwidgetutils.pri new file mode 100644 index 000000000..b3b18df54 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/uavobjectwidgetutils.pri @@ -0,0 +1,6 @@ +include(uavobjectwidgetutils_dependencies.pri) + +# Add the include path to the built-in uavobject include files. +INCLUDEPATH += $$PWD + +LIBS *= -l$$qtLibraryName(UAVObjectWidgetUtils) diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/uavobjectwidgetutils.pro b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/uavobjectwidgetutils.pro new file mode 100644 index 000000000..caacc1e9c --- /dev/null +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/uavobjectwidgetutils.pro @@ -0,0 +1,22 @@ +TEMPLATE = lib +TARGET = UAVObjectWidgetUtils +DEFINES += UAVOBJECTWIDGETUTILS_LIBRARY +QT += svg +include(../../openpilotgcsplugin.pri) +include(uavobjectwidgetutils_dependencies.pri) +HEADERS += uavobjectwidgetutils_global.h \ + uavobjectwidgetutilsplugin.h \ + configtaskwidget.h \ + mixercurvewidget.h \ + mixercurvepoint.h \ + mixercurveline.h \ + smartsavebutton.h +SOURCES += uavobjectwidgetutilsplugin.cpp \ + configtaskwidget.cpp \ + mixercurvewidget.cpp \ + mixercurvepoint.cpp \ + mixercurveline.cpp \ + smartsavebutton.cpp + + +OTHER_FILES += UAVObjectWidgetUtils.pluginspec diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/uavobjectwidgetutils_dependencies.pri b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/uavobjectwidgetutils_dependencies.pri new file mode 100644 index 000000000..43d9ac0d7 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/uavobjectwidgetutils_dependencies.pri @@ -0,0 +1,6 @@ +include(../../plugins/coreplugin/coreplugin.pri) +include(../../libs/utils/utils.pri) +include(../../plugins/uavobjects/uavobjects.pri) +include(../uavobjectutil/uavobjectutil.pri) +include(../uavsettingsimportexport/uavsettingsimportexport.pri) +include(../uavtalk/uavtalk.pri) diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/uavobjectwidgetutils_global.h b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/uavobjectwidgetutils_global.h new file mode 100644 index 000000000..918ec07b4 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/uavobjectwidgetutils_global.h @@ -0,0 +1,39 @@ +/** + ****************************************************************************** + * + * @file uavobjectwidgetutils_global.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @addtogroup UAVObjectWidgetUtils Plugin + * @{ + * @brief Utility plugin for UAVObject to Widget relation management + *****************************************************************************/ +/* + * This program 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. + * + * This program 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 this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef UAVOBJECTWIDGETUTILS_GLOBAL_H +#define UAVOBJECTWIDGETUTILS_GLOBAL_H + +#include + +#if defined(UAVOBJECTWIDGETUTILS_LIBRARY) +# define UAVOBJECTWIDGETUTILS_EXPORT Q_DECL_EXPORT +#else +# define UAVOBJECTWIDGETUTILS_EXPORT Q_DECL_IMPORT +#endif + +#endif diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/uavobjectwidgetutilsplugin.cpp b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/uavobjectwidgetutilsplugin.cpp new file mode 100644 index 000000000..ec0150a53 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/uavobjectwidgetutilsplugin.cpp @@ -0,0 +1,54 @@ +/** + ****************************************************************************** + * + * @file uavobjectutilplugin.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @addtogroup UAVObjectWidgetUtils Plugin + * @{ + * @brief Utility plugin for UAVObject to Widget relation management + *****************************************************************************/ +/* + * This program 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. + * + * This program 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 this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "uavobjectwidgetutilsplugin.h" + +UAVObjectWidgetUtilsPlugin::UAVObjectWidgetUtilsPlugin() +{ +} + +UAVObjectWidgetUtilsPlugin::~UAVObjectWidgetUtilsPlugin() +{ +} + +void UAVObjectWidgetUtilsPlugin::extensionsInitialized() +{ +} + +bool UAVObjectWidgetUtilsPlugin::initialize(const QStringList & arguments, QString * errorString) +{ + Q_UNUSED(arguments) + Q_UNUSED(errorString) + + return true; +} + +void UAVObjectWidgetUtilsPlugin::shutdown() +{ +} + +Q_EXPORT_PLUGIN(UAVObjectWidgetUtilsPlugin) diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/uavobjectwidgetutilsplugin.h b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/uavobjectwidgetutilsplugin.h new file mode 100644 index 000000000..59291c210 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/uavobjectwidgetutilsplugin.h @@ -0,0 +1,47 @@ +/** + ****************************************************************************** + * + * @file uavobjectwidgetutilsplugin.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @addtogroup UAVObjectWidgetUtils Plugin + * @{ + * @brief Utility plugin for UAVObject to Widget relation management + *****************************************************************************/ +/* + * This program 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. + * + * This program 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 this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#ifndef UAVOBJECTWIDGETUTILSPLUGIN_H +#define UAVOBJECTWIDGETUTILSPLUGIN_H + +#include "uavobjectwidgetutils_global.h" +#include +#include + +class UAVOBJECTWIDGETUTILS_EXPORT UAVObjectWidgetUtilsPlugin: public ExtensionSystem::IPlugin +{ + Q_OBJECT + +public: + UAVObjectWidgetUtilsPlugin(); + ~UAVObjectWidgetUtilsPlugin(); + + void extensionsInitialized(); + bool initialize(const QStringList & arguments, QString * errorString); + void shutdown(); +}; + +#endif diff --git a/ground/uavobjgenerator/generators/gcs/uavobjectgeneratorgcs.cpp b/ground/uavobjgenerator/generators/gcs/uavobjectgeneratorgcs.cpp index 7e17c9148..b2a58444e 100644 --- a/ground/uavobjgenerator/generators/gcs/uavobjectgeneratorgcs.cpp +++ b/ground/uavobjgenerator/generators/gcs/uavobjectgeneratorgcs.cpp @@ -224,19 +224,21 @@ bool UAVObjectGeneratorGCS::process_object(ObjectInfo* info) .arg(varOptionName) .arg(options[m]) ); } - finit.append( QString(" fields.append( new UAVObjectField(QString(\"%1\"), QString(\"%2\"), UAVObjectField::ENUM, %3, %4) );\n") + finit.append( QString(" fields.append( new UAVObjectField(QString(\"%1\"), QString(\"%2\"), UAVObjectField::ENUM, %3, %4, QString(\"%5\")));\n") .arg(info->fields[n]->name) .arg(info->fields[n]->units) .arg(varElemName) - .arg(varOptionName) ); + .arg(varOptionName) + .arg(info->fields[n]->limitValues)); } // For all other types else { - finit.append( QString(" fields.append( new UAVObjectField(QString(\"%1\"), QString(\"%2\"), UAVObjectField::%3, %4, QStringList()) );\n") + finit.append( QString(" fields.append( new UAVObjectField(QString(\"%1\"), QString(\"%2\"), UAVObjectField::%3, %4, QStringList(), QString(\"%5\")));\n") .arg(info->fields[n]->name) .arg(info->fields[n]->units) .arg(fieldTypeStrCPPClass[info->fields[n]->type]) - .arg(varElemName) ); + .arg(varElemName) + .arg(info->fields[n]->limitValues)); } } outCode.replace(QString("$(FIELDSINIT)"), finit); diff --git a/ground/uavobjgenerator/uavobjectparser.cpp b/ground/uavobjgenerator/uavobjectparser.cpp index 414712658..a0409f06f 100644 --- a/ground/uavobjgenerator/uavobjectparser.cpp +++ b/ground/uavobjgenerator/uavobjectparser.cpp @@ -469,6 +469,13 @@ QString UAVObjectParser::processObjectFields(QDomNode& childNode, ObjectInfo* in } field->defaultValues = defaults; } + elemAttr = elemAttributes.namedItem("limits"); + if ( elemAttr.isNull() ) { + field->limitValues=QString(); + } + else{ + field->limitValues=elemAttr.nodeValue(); + } // Add field to object info->fields.append(field); // Done diff --git a/ground/uavobjgenerator/uavobjectparser.h b/ground/uavobjgenerator/uavobjectparser.h index 6f8678930..f1e93d8f5 100644 --- a/ground/uavobjgenerator/uavobjectparser.h +++ b/ground/uavobjgenerator/uavobjectparser.h @@ -52,11 +52,12 @@ typedef struct { QString units; FieldType type; int numElements; - int numBytes; + int numBytes; QStringList elementNames; QStringList options; // for enums only bool defaultElementNames; QStringList defaultValues; + QString limitValues; } FieldInfo; /** @@ -69,13 +70,13 @@ typedef enum { UPDATEMODE_NEVER /** Object is never updated */ } UpdateMode; - + typedef enum { ACCESS_READWRITE = 0, ACCESS_READONLY = 1 } AccessMode; - - + + typedef struct { QString name; QString namelc; /** name in lowercase */ @@ -110,8 +111,8 @@ public: quint32 getObjectID(int objIndex); ObjectInfo* getObjectByIndex(int objIndex); - int getNumBytes(int objIndex); - QStringList all_units; + int getNumBytes(int objIndex); + QStringList all_units; private: QList objInfo; diff --git a/shared/uavobjectdefinition/stabilizationsettings.xml b/shared/uavobjectdefinition/stabilizationsettings.xml index e42f468bf..29c9d8116 100644 --- a/shared/uavobjectdefinition/stabilizationsettings.xml +++ b/shared/uavobjectdefinition/stabilizationsettings.xml @@ -1,18 +1,18 @@ PID settings used by the Stabilization module to combine the @ref AttitudeActual and @ref AttitudeDesired to compute @ref ActuatorDesired - - - - - + + + + + - - - - - - + + + + + +