diff --git a/ground/openpilotgcs/src/plugins/config/config.pro b/ground/openpilotgcs/src/plugins/config/config.pro
index 091a7d45c..192a801e0 100644
--- a/ground/openpilotgcs/src/plugins/config/config.pro
+++ b/ground/openpilotgcs/src/plugins/config/config.pro
@@ -37,6 +37,7 @@ HEADERS += configplugin.h \
defaulthwsettingswidget.h \
inputchannelform.h \
configcamerastabilizationwidget.h \
+ configtxpidwidget.h \
outputchannelform.h
SOURCES += configplugin.cpp \
configgadgetconfiguration.cpp \
@@ -67,6 +68,7 @@ SOURCES += configplugin.cpp \
defaulthwsettingswidget.cpp \
inputchannelform.cpp \
configcamerastabilizationwidget.cpp \
+ configtxpidwidget.cpp \
outputchannelform.cpp
FORMS += airframe.ui \
cc_hw_settings.ui \
@@ -81,5 +83,6 @@ FORMS += airframe.ui \
defaulthwsettings.ui \
inputchannelform.ui \
camerastabilization.ui \
- outputchannelform.ui
+ outputchannelform.ui \
+ txpid.ui
RESOURCES += configgadget.qrc
diff --git a/ground/openpilotgcs/src/plugins/config/configgadget.qrc b/ground/openpilotgcs/src/plugins/config/configgadget.qrc
index f24cb68b8..9692603c2 100644
--- a/ground/openpilotgcs/src/plugins/config/configgadget.qrc
+++ b/ground/openpilotgcs/src/plugins/config/configgadget.qrc
@@ -17,5 +17,6 @@
images/gyroscope.png
images/TX.svg
images/camera.png
+ images/txpid.png
diff --git a/ground/openpilotgcs/src/plugins/config/configgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/config/configgadgetwidget.cpp
index d40db122f..29a36636a 100644
--- a/ground/openpilotgcs/src/plugins/config/configgadgetwidget.cpp
+++ b/ground/openpilotgcs/src/plugins/config/configgadgetwidget.cpp
@@ -34,6 +34,7 @@
#include "configoutputwidget.h"
#include "configstabilizationwidget.h"
#include "configcamerastabilizationwidget.h"
+#include "configtxpidwidget.h"
#include "config_pro_hw_widget.h"
#include "config_cc_hw_widget.h"
#include "defaultattitudewidget.h"
@@ -85,6 +86,8 @@ ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
qwd = new ConfigCameraStabilizationWidget(this);
ftw->insertTab(ConfigGadgetWidget::camerastabilization, qwd, QIcon(":/configgadget/images/camera.png"), QString("Camera Stab"));
+ qwd = new ConfigTxPIDWidget(this);
+ ftw->insertTab(ConfigGadgetWidget::txpid, qwd, QIcon(":/configgadget/images/txpid.png"), QString("TxPID"));
// qwd = new ConfigPipXtremeWidget(this);
// ftw->insertTab(5, qwd, QIcon(":/configgadget/images/PipXtreme.png"), QString("PipXtreme"));
diff --git a/ground/openpilotgcs/src/plugins/config/configgadgetwidget.h b/ground/openpilotgcs/src/plugins/config/configgadgetwidget.h
index 633253507..1a650ded6 100644
--- a/ground/openpilotgcs/src/plugins/config/configgadgetwidget.h
+++ b/ground/openpilotgcs/src/plugins/config/configgadgetwidget.h
@@ -50,7 +50,7 @@ class ConfigGadgetWidget: public QWidget
public:
ConfigGadgetWidget(QWidget *parent = 0);
~ConfigGadgetWidget();
- enum widgetTabs {hardware=0, aircraft, input, output, ins, stabilization, camerastabilization};
+ enum widgetTabs { hardware = 0, aircraft, input, output, ins, stabilization, camerastabilization, txpid };
public slots:
void onAutopilotConnect();
diff --git a/ground/openpilotgcs/src/plugins/config/configtxpidwidget.cpp b/ground/openpilotgcs/src/plugins/config/configtxpidwidget.cpp
new file mode 100644
index 000000000..2c50095d8
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/config/configtxpidwidget.cpp
@@ -0,0 +1,105 @@
+/**
+ ******************************************************************************
+ *
+ * @file configtxpidswidget.cpp
+ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
+ * @addtogroup GCSPlugins GCS Plugins
+ * @{
+ * @addtogroup ConfigPlugin Config Plugin
+ * @{
+ * @brief The Configuration Gadget used to configure TxPID module
+ *****************************************************************************/
+/*
+ * 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 "configtxpidwidget.h"
+#include "txpidsettings.h"
+#include "hwsettings.h"
+
+ConfigTxPIDWidget::ConfigTxPIDWidget(QWidget *parent) : ConfigTaskWidget(parent)
+{
+ m_txpid = new Ui_TxPIDWidget();
+ m_txpid->setupUi(this);
+
+ setupButtons(m_txpid->Apply, m_txpid->Save);
+
+ // Cannot use addUAVObjectToWidgetRelation() for OptionaModules enum because
+ // QCheckBox returns bool (0 or -1) and this value is then set to enum instead
+ // or enum options
+ connect(HwSettings::GetInstance(getObjectManager()), SIGNAL(objectUpdated(UAVObject *)), this, SLOT(refreshValues()));
+ connect(m_txpid->Apply, SIGNAL(clicked()), this, SLOT(applySettings()));
+ connect(m_txpid->Save, SIGNAL(clicked()), this, SLOT(saveSettings()));
+
+ addUAVObjectToWidgetRelation("TxPIDSettings", "PIDs", m_txpid->PID1, TxPIDSettings::PIDS_INSTANCE1);
+ addUAVObjectToWidgetRelation("TxPIDSettings", "PIDs", m_txpid->PID2, TxPIDSettings::PIDS_INSTANCE2);
+ addUAVObjectToWidgetRelation("TxPIDSettings", "PIDs", m_txpid->PID3, TxPIDSettings::PIDS_INSTANCE3);
+
+ addUAVObjectToWidgetRelation("TxPIDSettings", "Inputs", m_txpid->Input1, TxPIDSettings::INPUTS_INSTANCE1);
+ addUAVObjectToWidgetRelation("TxPIDSettings", "Inputs", m_txpid->Input2, TxPIDSettings::INPUTS_INSTANCE2);
+ addUAVObjectToWidgetRelation("TxPIDSettings", "Inputs", m_txpid->Input3, TxPIDSettings::INPUTS_INSTANCE3);
+
+ addUAVObjectToWidgetRelation("TxPIDSettings", "MinPID", m_txpid->MinPID1, TxPIDSettings::MINPID_INSTANCE1);
+ addUAVObjectToWidgetRelation("TxPIDSettings", "MinPID", m_txpid->MinPID2, TxPIDSettings::MINPID_INSTANCE2);
+ addUAVObjectToWidgetRelation("TxPIDSettings", "MinPID", m_txpid->MinPID3, TxPIDSettings::MINPID_INSTANCE3);
+
+ addUAVObjectToWidgetRelation("TxPIDSettings", "MaxPID", m_txpid->MaxPID1, TxPIDSettings::MAXPID_INSTANCE1);
+ addUAVObjectToWidgetRelation("TxPIDSettings", "MaxPID", m_txpid->MaxPID2, TxPIDSettings::MAXPID_INSTANCE2);
+ addUAVObjectToWidgetRelation("TxPIDSettings", "MaxPID", m_txpid->MaxPID3, TxPIDSettings::MAXPID_INSTANCE3);
+
+ addUAVObjectToWidgetRelation("TxPIDSettings", "ThrottleRange", m_txpid->ThrottleMin, TxPIDSettings::THROTTLERANGE_MIN);
+ addUAVObjectToWidgetRelation("TxPIDSettings", "ThrottleRange", m_txpid->ThrottleMax, TxPIDSettings::THROTTLERANGE_MAX);
+
+ addUAVObjectToWidgetRelation("TxPIDSettings", "UpdateMode", m_txpid->UpdateMode);
+
+ enableControls(false);
+ populateWidgets();
+ refreshWidgetsValues();
+}
+
+ConfigTxPIDWidget::~ConfigTxPIDWidget()
+{
+ // Do nothing
+}
+
+void ConfigTxPIDWidget::refreshValues()
+{
+ HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
+ HwSettings::DataFields hwSettingsData = hwSettings->getData();
+ m_txpid->TxPIDEnable->setChecked(
+ hwSettingsData.OptionalModules[HwSettings::OPTIONALMODULES_TXPID] == HwSettings::OPTIONALMODULES_ENABLED);
+}
+
+void ConfigTxPIDWidget::applySettings()
+{
+ HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
+ HwSettings::DataFields hwSettingsData = hwSettings->getData();
+ hwSettingsData.OptionalModules[HwSettings::OPTIONALMODULES_TXPID] =
+ m_txpid->TxPIDEnable->isChecked() ? HwSettings::OPTIONALMODULES_ENABLED : HwSettings::OPTIONALMODULES_DISABLED;
+ hwSettings->setData(hwSettingsData);
+}
+
+void ConfigTxPIDWidget::saveSettings()
+{
+ applySettings();
+ UAVObject *obj = HwSettings::GetInstance(getObjectManager());
+ saveObjectToSD(obj);
+}
+
+
+/**
+ @}
+ @}
+ */
diff --git a/ground/openpilotgcs/src/plugins/config/configtxpidwidget.h b/ground/openpilotgcs/src/plugins/config/configtxpidwidget.h
new file mode 100644
index 000000000..9723e141f
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/config/configtxpidwidget.h
@@ -0,0 +1,50 @@
+/**
+ ******************************************************************************
+ *
+ * @file configtxpidwidget.h
+ * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
+ * @addtogroup GCSPlugins GCS Plugins
+ * @{
+ * @addtogroup ConfigPlugin Config Plugin
+ * @{
+ * @brief The Configuration Gadget used to configure TxPID module
+ *****************************************************************************/
+/*
+ * 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 CONFIGTXPIDWIDGET_H
+#define CONFIGTXPIDWIDGET_H
+
+#include "ui_txpid.h"
+#include "configtaskwidget.h"
+
+class ConfigTxPIDWidget : public ConfigTaskWidget
+{
+ Q_OBJECT
+
+public:
+ ConfigTxPIDWidget(QWidget *parent = 0);
+ ~ConfigTxPIDWidget();
+
+private:
+ Ui_TxPIDWidget *m_txpid;
+
+private slots:
+ void refreshValues();
+ void applySettings();
+ void saveSettings();
+};
+
+#endif // CONFIGTXPIDWIDGET_H
diff --git a/ground/openpilotgcs/src/plugins/config/images/txpid.png b/ground/openpilotgcs/src/plugins/config/images/txpid.png
new file mode 100644
index 000000000..7b2f6f035
Binary files /dev/null and b/ground/openpilotgcs/src/plugins/config/images/txpid.png differ
diff --git a/ground/openpilotgcs/src/plugins/config/txpid.ui b/ground/openpilotgcs/src/plugins/config/txpid.ui
new file mode 100644
index 000000000..7931315f0
--- /dev/null
+++ b/ground/openpilotgcs/src/plugins/config/txpid.ui
@@ -0,0 +1,512 @@
+
+
+ TxPIDWidget
+
+
+
+ 0
+ 0
+ 720
+ 567
+
+
+
+ Form
+
+
+ -
+
+
+ QFrame::NoFrame
+
+
+ true
+
+
+
+
+ 0
+ 0
+ 702
+ 497
+
+
+
+
-
+
+
+ This module will periodically update values of stabilization PID settings
+depending on configured input control channels. New values of stabilization
+settings are not saved to flash, but updated in RAM. It is expected that the
+module will be enabled only for tuning. When desired values are found, they
+can be read via GCS and saved permanently. Then this module should be
+disabled again.
+
+Up to 3 separate PID options (or option pairs) can be selected and updated.
+
+
+ Enable TxPID module
+
+
+
+ -
+
+
+ After enabling the module, you must power cycle before using and configuring.
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Preferred
+
+
+
+ 20
+ 10
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 100
+
+
+
+ Module Settings
+
+
+
-
+
+
+ PID option
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ Control Source
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ Min
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ Max
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ Instance 1
+
+
+
+ -
+
+
+ Select PID option or option pair to update.
+Set to Disabled if not used.
+
+
+
+ -
+
+
+ Select input used as a control source for this instance.
+It can be one of Accessory channels or Throttle channel.
+
+If Accessory channel is chosen then its range [0..1] will be mapped
+to PID range [Min..Max] defined for this instance.
+
+If Throttle channel is chosen then Throttle range [Min..Max] will
+be mapped to PID range [Min..Max] defined for this instance. If
+Throttle is out of bounds then PID Min and Max values will be used
+accordingly.
+
+Note that it is possible to set PID Min > Max. In that case increasing
+control input value will decrease the PID option value. This can be
+used, for instance, to decrease PID value when increasing Throttle.
+
+
+
+ -
+
+
+ Minimum PID value mapped to Accessory channel = 0 or
+Throttle channel lesser or equal to Throttle Min value.
+
+
+ 6
+
+
+ 0.000100000000000
+
+
+
+ -
+
+
+ Maximum PID value mapped to Accessory channel = 1 or
+Throttle channel greater or equal to Throttle Max value.
+
+
+ 6
+
+
+ 0.000100000000000
+
+
+
+ -
+
+
+ Instance 2
+
+
+
+ -
+
+
+ Select PID option or option pair to update.
+Set to Disabled if not used.
+
+
+
+ -
+
+
+ Select input used as a control source for this instance.
+It can be one of Accessory channels or Throttle channel.
+
+If Accessory channel is chosen then its range [0..1] will be mapped
+to PID range [Min..Max] defined for this instance.
+
+If Throttle channel is chosen then Throttle range [Min..Max] will
+be mapped to PID range [Min..Max] defined for this instance. If
+Throttle is out of bounds then PID Min and Max values will be used
+accordingly.
+
+Note that it is possible to set PID Min > Max. In that case increasing
+control input value will decrease the PID option value. This can be
+used, for instance, to decrease PID value when increasing Throttle.
+
+
+
+ -
+
+
+ Minimum PID value mapped to Accessory channel = 0 or
+Throttle channel lesser or equal to Throttle Min value.
+
+
+ 6
+
+
+ 0.000100000000000
+
+
+
+ -
+
+
+ Maximum PID value mapped to Accessory channel = 1 or
+Throttle channel greater or equal to Throttle Max value.
+
+
+ 6
+
+
+ 0.000100000000000
+
+
+
+ -
+
+
+ Instance 3
+
+
+
+ -
+
+
+ Select PID option or option pair to update.
+Set to Disabled if not used.
+
+
+
+ -
+
+
+ Select input used as a control source for this instance.
+It can be one of Accessory channels or Throttle channel.
+
+If Accessory channel is chosen then its range [0..1] will be mapped
+to PID range [Min..Max] defined for this instance.
+
+If Throttle channel is chosen then Throttle range [Min..Max] will
+be mapped to PID range [Min..Max] defined for this instance. If
+Throttle is out of bounds then PID Min and Max values will be used
+accordingly.
+
+Note that it is possible to set PID Min > Max. In that case increasing
+control input value will decrease the PID option value. This can be
+used, for instance, to decrease PID value when increasing Throttle.
+
+
+
+ -
+
+
+ Minimum PID value mapped to Accessory channel = 0 or
+Throttle channel lesser or equal to Throttle Min value.
+
+
+ 6
+
+
+ 0.000100000000000
+
+
+
+ -
+
+
+ Maximum PID value mapped to Accessory channel = 1 or
+Throttle channel greater or equal to Throttle Max value.
+
+
+ 6
+
+
+ 0.000100000000000
+
+
+
+ -
+
+
+ Update Mode
+
+
+
+ -
+
+
+ PID values update mode which can be set to:
+- Never: this disables PID updates (but module still will be run if enabled),
+- When Armed: PID updated only when system is armed,
+- Always: PID updated always regardless of arm state.
+
+Since the GCS updates GUI PID values in real time on change, could be
+tricky to change other PID values from the GUI if the module is enabled
+and constantly updates stabilization settings object. As a workaround,
+this option can be used to temporarily disable updates or enable them
+only when system is armed without disabling the module.
+
+
+
+ -
+
+
+ Throttle Range
+
+
+
+ -
+
+
+ Throttle channel lower bound mapped to PID Min value
+
+
+ 1.000000000000000
+
+
+ 0.010000000000000
+
+
+
+ -
+
+
+ Throttle channel upper bound mapped to PID Max value
+
+
+ 1.000000000000000
+
+
+ 0.010000000000000
+
+
+
+ -
+
+
+ Min
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ Max
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Preferred
+
+
+
+ 20
+ 5
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+ -
+
+
-
+
+
+
+
+
+
+ -
+
+
-
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ 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
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+ TxPIDEnable
+ Apply
+ Save
+ scrollArea
+
+
+
+