diff --git a/ground/openpilotgcs/src/plugins/config/camerastabilization.ui b/ground/openpilotgcs/src/plugins/config/camerastabilization.ui index 28e7740c1..c6ab98e09 100644 --- a/ground/openpilotgcs/src/plugins/config/camerastabilization.ui +++ b/ground/openpilotgcs/src/plugins/config/camerastabilization.ui @@ -138,46 +138,6 @@ None - - - Channel 1 - - - - - Channel 2 - - - - - Channel 3 - - - - - Channel 4 - - - - - Channel 5 - - - - - Channel 6 - - - - - Channel 7 - - - - - Channel 8 - - @@ -187,46 +147,6 @@ None - - - Channel 1 - - - - - Channel 2 - - - - - Channel 3 - - - - - Channel 4 - - - - - Channel 5 - - - - - Channel 6 - - - - - Channel 7 - - - - - Channel 8 - - @@ -243,46 +163,6 @@ None - - - Channel 1 - - - - - Channel 2 - - - - - Channel 3 - - - - - Channel 4 - - - - - Channel 5 - - - - - Channel 6 - - - - - Channel 7 - - - - - Channel 8 - - diff --git a/ground/openpilotgcs/src/plugins/config/configairframewidget.cpp b/ground/openpilotgcs/src/plugins/config/configairframewidget.cpp index 96393b381..9f118532e 100644 --- a/ground/openpilotgcs/src/plugins/config/configairframewidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configairframewidget.cpp @@ -105,10 +105,13 @@ ConfigAirframeWidget::ConfigAirframeWidget(QWidget *parent) : ConfigTaskWidget(p ffTuningInProgress = false; ffTuningPhase = false; - mixerTypes << "Mixer1Type" << "Mixer2Type" << "Mixer3Type" - << "Mixer4Type" << "Mixer5Type" << "Mixer6Type" << "Mixer7Type" << "Mixer8Type"; - mixerVectors << "Mixer1Vector" << "Mixer2Vector" << "Mixer3Vector" - << "Mixer4Vector" << "Mixer5Vector" << "Mixer6Vector" << "Mixer7Vector" << "Mixer8Vector"; + QStringList channels; + channels << "None"; + for (int i = 0; i < ActuatorSettings::CHANNELADDR_NUMELEM; i++) { + mixerTypes << QString("Mixer%1Type").arg(i+1); + mixerVectors << QString("Mixer%1Vector").arg(i+1); + channels << QString("Channel%1").arg(i+1); + } QStringList airframeTypes; airframeTypes << "Fixed Wing" << "Multirotor" << "Helicopter" << "Custom"; @@ -124,11 +127,6 @@ ConfigAirframeWidget::ConfigAirframeWidget(QWidget *parent) : ConfigTaskWidget(p << "Octo Coax X" << "Hexacopter Y6" << "Tricopter Y"; m_aircraft->multirotorFrameType->addItems(multiRotorTypes); - - - QStringList channels; - channels << "None" << "Channel1" << "Channel2" << "Channel3" << - "Channel4" << "Channel5" << "Channel6" << "Channel7" << "Channel8"; // Now load all the channel assignements for fixed wing m_aircraft->fwElevator1Channel->addItems(channels); m_aircraft->fwElevator2Channel->addItems(channels); diff --git a/ground/openpilotgcs/src/plugins/config/configcamerastabilizationwidget.cpp b/ground/openpilotgcs/src/plugins/config/configcamerastabilizationwidget.cpp index afbdae760..739de0241 100644 --- a/ground/openpilotgcs/src/plugins/config/configcamerastabilizationwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configcamerastabilizationwidget.cpp @@ -41,12 +41,26 @@ #include "camerastabsettings.h" #include "hwsettings.h" #include "mixersettings.h" +#include "actuatorcommand.h" ConfigCameraStabilizationWidget::ConfigCameraStabilizationWidget(QWidget *parent) : ConfigTaskWidget(parent) { m_camerastabilization = new Ui_CameraStabilizationWidget(); m_camerastabilization->setupUi(this); + QComboBox * selectors[3] = { + m_camerastabilization->rollChannel, + m_camerastabilization->pitchChannel, + m_camerastabilization->yawChannel + }; + + for (int i = 0; i < 3; i++) { + selectors[i]->clear(); + selectors[i]->addItem("None"); + for (int j = 0; j < ActuatorCommand::CHANNEL_NUMELEM; j++) + selectors[i]->addItem(QString("Channel %1").arg(j+1)); + } + connectUpdates(); // Connect buttons diff --git a/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp b/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp index 0adc41e2c..a4f147a1d 100644 --- a/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp @@ -38,28 +38,31 @@ #include #include #include +#include "actuatorcommand.h" ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(parent) { m_config = new Ui_OutputWidget(); m_config->setupUi(this); - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - setupButtons(m_config->saveRCOutputToRAM,m_config->saveRCOutputToSD); - addUAVObject("ActuatorSettings"); + ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); + setupButtons(m_config->saveRCOutputToRAM,m_config->saveRCOutputToSD); + addUAVObject("ActuatorSettings"); - // First of all, put all the channel widgets into lists, so that we can + // First of all, put all the channel widgets into lists, so that we can // manipulate those: - // NOTE: for historical reasons, we have objects below called ch0 to ch7, but the convention for OP is Channel 1 to Channel 8. + // NOTE: for historical reasons, we have objects below called ch0 to ch7, but the convention for OP is Channel 1 to Channel 8. outLabels << m_config->ch0OutValue - << m_config->ch1OutValue - << m_config->ch2OutValue - << m_config->ch3OutValue - << m_config->ch4OutValue - << m_config->ch5OutValue - << m_config->ch6OutValue - << m_config->ch7OutValue; + << m_config->ch1OutValue + << m_config->ch2OutValue + << m_config->ch3OutValue + << m_config->ch4OutValue + << m_config->ch5OutValue + << m_config->ch6OutValue + << m_config->ch7OutValue + << m_config->ch8OutValue + << m_config->ch9OutValue; outSliders << m_config->ch0OutSlider << m_config->ch1OutSlider @@ -68,7 +71,9 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren << m_config->ch4OutSlider << m_config->ch5OutSlider << m_config->ch6OutSlider - << m_config->ch7OutSlider; + << m_config->ch7OutSlider + << m_config->ch8OutSlider + << m_config->ch9OutSlider; outMin << m_config->ch0OutMin << m_config->ch1OutMin @@ -77,7 +82,9 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren << m_config->ch4OutMin << m_config->ch5OutMin << m_config->ch6OutMin - << m_config->ch7OutMin; + << m_config->ch7OutMin + << m_config->ch8OutMin + << m_config->ch9OutMin; outMax << m_config->ch0OutMax << m_config->ch1OutMax @@ -86,7 +93,9 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren << m_config->ch4OutMax << m_config->ch5OutMax << m_config->ch6OutMax - << m_config->ch7OutMax; + << m_config->ch7OutMax + << m_config->ch8OutMax + << m_config->ch9OutMax; reversals << m_config->ch0Rev << m_config->ch1Rev @@ -95,7 +104,9 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren << m_config->ch4Rev << m_config->ch5Rev << m_config->ch6Rev - << m_config->ch7Rev; + << m_config->ch7Rev + << m_config->ch8Rev + << m_config->ch9Rev; links << m_config->ch0Link << m_config->ch1Link @@ -104,15 +115,23 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren << m_config->ch4Link << m_config->ch5Link << m_config->ch6Link - << m_config->ch7Link; + << m_config->ch7Link + << m_config->ch8Link + << m_config->ch9Link; // Register for ActuatorSettings changes: - for (int i = 0; i < 8; i++) { + for (int i = 0; i < ActuatorCommand::CHANNEL_NUMELEM; i++) { connect(outMin[i], SIGNAL(editingFinished()), this, SLOT(setChOutRange())); connect(outMax[i], SIGNAL(editingFinished()), this, SLOT(setChOutRange())); connect(reversals[i], SIGNAL(toggled(bool)), this, SLOT(reverseChannel(bool))); // Now connect the channel out sliders to our signal to send updates in test mode connect(outSliders[i], SIGNAL(valueChanged(int)), this, SLOT(sendChannelTest(int))); + + addWidget(outMin[i]); + addWidget(outMax[i]); + addWidget(reversals[i]); + addWidget(outSliders[i]); + addWidget(links[i]); } connect(m_config->channelOutTest, SIGNAL(toggled(bool)), this, SLOT(runChannelTests(bool))); @@ -134,39 +153,7 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren addWidget(m_config->outputRate3); addWidget(m_config->outputRate2); addWidget(m_config->outputRate1); - addWidget(m_config->ch0OutMin); - addWidget(m_config->ch0OutSlider); - addWidget(m_config->ch0OutMax); - addWidget(m_config->ch0Rev); - addWidget(m_config->ch0Link); - addWidget(m_config->ch1OutMin); - addWidget(m_config->ch1OutSlider); - addWidget(m_config->ch1OutMax); - addWidget(m_config->ch1Rev); - addWidget(m_config->ch2OutMin); - addWidget(m_config->ch2OutSlider); - addWidget(m_config->ch2OutMax); - addWidget(m_config->ch2Rev); - addWidget(m_config->ch3OutMin); - addWidget(m_config->ch3OutSlider); - addWidget(m_config->ch3OutMax); - addWidget(m_config->ch3Rev); - addWidget(m_config->ch4OutMin); - addWidget(m_config->ch4OutSlider); - addWidget(m_config->ch4OutMax); - addWidget(m_config->ch4Rev); - addWidget(m_config->ch5OutMin); - addWidget(m_config->ch5OutSlider); - addWidget(m_config->ch5OutMax); - addWidget(m_config->ch5Rev); - addWidget(m_config->ch6OutMin); - addWidget(m_config->ch6OutSlider); - addWidget(m_config->ch6OutMax); - addWidget(m_config->ch6Rev); - addWidget(m_config->ch7OutMin); - addWidget(m_config->ch7OutSlider); - addWidget(m_config->ch7OutMax); - addWidget(m_config->ch7Rev); + addWidget(m_config->spinningArmed); } @@ -384,14 +371,8 @@ void ConfigOutputWidget::refreshWidgetsValues() UAVObjectManager *objManager = pm->getObject(); // Reset all channel assignements: - m_config->ch0Output->setText("-"); - m_config->ch1Output->setText("-"); - m_config->ch2Output->setText("-"); - m_config->ch3Output->setText("-"); - m_config->ch4Output->setText("-"); - m_config->ch5Output->setText("-"); - m_config->ch6Output->setText("-"); - m_config->ch7Output->setText("-"); + for (int i = 0; i < ActuatorCommand::CHANNEL_NUMELEM; i++) + outLabels[i]->setText("-"); // Get the channel assignements: UAVDataObject * obj = dynamic_cast(objManager->getObject(QString("ActuatorSettings"))); @@ -443,7 +424,7 @@ void ConfigOutputWidget::refreshWidgetsValues() // Get Channel ranges: - for (int i=0;i<8;i++) { + for (int i=0;igetField(QString("ChannelMin")); int minValue = field->getValue(i).toInt(); outMin[i]->setValue(minValue); @@ -462,7 +443,7 @@ void ConfigOutputWidget::refreshWidgetsValues() } field = obj->getField(QString("ChannelNeutral")); - for (int i=0; i<8; i++) { + for (int i=0; igetValue(i).toInt(); outSliders[i]->setValue(value); outLabels[i]->setText(QString::number(value)); @@ -483,17 +464,17 @@ void ConfigOutputWidget::updateObjectsFromWidgets() // Now send channel ranges: UAVObjectField * field = obj->getField(QString("ChannelMax")); - for (int i = 0; i < 8; i++) { + for (int i = 0; i < ActuatorCommand::CHANNEL_NUMELEM; i++) { field->setValue(outMax[i]->value(),i); } field = obj->getField(QString("ChannelMin")); - for (int i = 0; i < 8; i++) { + for (int i = 0; i < ActuatorCommand::CHANNEL_NUMELEM; i++) { field->setValue(outMin[i]->value(),i); } field = obj->getField(QString("ChannelNeutral")); - for (int i = 0; i < 8; i++) { + for (int i = 0; i < ActuatorCommand::CHANNEL_NUMELEM; i++) { field->setValue(outSliders[i]->value(),i); } diff --git a/ground/openpilotgcs/src/plugins/config/output.ui b/ground/openpilotgcs/src/plugins/config/output.ui index b7855221f..b66c12cdc 100644 --- a/ground/openpilotgcs/src/plugins/config/output.ui +++ b/ground/openpilotgcs/src/plugins/config/output.ui @@ -970,6 +970,172 @@ p, li { white-space: pre-wrap; } + + + + Channel 9: + + + + + + + Channel 10: + + + + + + + + 9 + + + + - + + + Qt::AlignCenter + + + + + + + + 9 + + + + - + + + Qt::AlignCenter + + + + + + + 9999 + + + + + + + 9999 + + + + + + + 9999 + + + Qt::Horizontal + + + + + + + 9999 + + + Qt::Horizontal + + + + + + + 9999 + + + + + + + 9999 + + + + + + + 0000 + + + + + + + 0000 + + + + + + + + FreeSans + 8 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'FreeSans'; font-size:8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Check to invert the channel.</p></body></html> + + + + + + + + + + + FreeSans + 8 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'FreeSans'; font-size:8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Check to invert the channel.</p></body></html> + + + + + + + + + + Only used with Test Output mode + + + + + + + + + + Only used with Test Output mode + + + + + + diff --git a/shared/uavobjectdefinition/actuatorcommand.xml b/shared/uavobjectdefinition/actuatorcommand.xml index 0d7de05a6..c0b65bbbc 100644 --- a/shared/uavobjectdefinition/actuatorcommand.xml +++ b/shared/uavobjectdefinition/actuatorcommand.xml @@ -1,7 +1,7 @@ Contains the pulse duration sent to each of the channels. Set by @ref ActuatorModule - +