1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

Merged in f5soh/librepilot/laurent/LP-178_Accessory_mapping (pull request #113)

LP-178 Add Accessory > Output mapping for fixed Wing.
This commit is contained in:
Philippe Renon 2015-12-01 21:56:46 +01:00
commit 0756c0aa76
8 changed files with 768 additions and 93 deletions

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>880</width>
<height>608</height>
<width>920</width>
<height>690</height>
</rect>
</property>
<property name="windowTitle">
@ -66,8 +66,8 @@
</property>
<property name="minimumSize">
<size>
<width>10</width>
<height>10</height>
<width>250</width>
<height>250</height>
</size>
</property>
<property name="styleSheet">
@ -130,8 +130,8 @@
</property>
<property name="minimumSize">
<size>
<width>10</width>
<height>10</height>
<width>250</width>
<height>250</height>
</size>
</property>
<property name="sizeIncrement">
@ -514,7 +514,7 @@ margin:1px;</string>
<property name="title">
<string>Output Channel Assignments</string>
</property>
<layout class="QGridLayout" name="gridLayout_7" columnstretch="1,1">
<layout class="QGridLayout" name="gridLayout_7" columnstretch="1,1,0,0">
<property name="leftMargin">
<number>9</number>
</property>
@ -538,42 +538,6 @@ margin:1px;</string>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="fwElevator2Label">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">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;
font: bold 12px;
margin:1px;</string>
</property>
<property name="text">
<string>Elevator 2</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="fwElevator2ChannelBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Assign your output channel</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="fwRudder1Label">
<property name="minimumSize">
@ -755,8 +719,458 @@ margin:1px;</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="fwElevator2Label">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">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;
font: bold 12px;
margin:1px;</string>
</property>
<property name="text">
<string>Elevator 2</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="fwElevator2ChannelBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Assign your output channel</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="3" rowspan="2">
<layout class="QGridLayout" name="gridLayout_4" columnstretch="0,0,0,0" columnminimumwidth="0,0,0,0">
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<item row="2" column="3">
<widget class="QComboBox" name="rcOutputCurveBoxFw2">
<property name="toolTip">
<string>Select output curve for Accessory1 RcInput</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="rcOutputChannelBoxFw1">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Select output channel for Accessory0 RcInput</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_13">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">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;
font: bold 12px;
margin:1px;</string>
</property>
<property name="text">
<string>Accessory0</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>90</width>
<height>16</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">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;
font: bold 12px;
margin:1px;</string>
</property>
<property name="text">
<string>RC Input</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_12">
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">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;
font: bold 12px;
margin:1px;</string>
</property>
<property name="text">
<string>Accessory1</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>110</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>RcOutput channels</string>
</property>
<property name="styleSheet">
<string notr="true">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;
font: bold 12px;
margin:1px;</string>
</property>
<property name="text">
<string>RC Output 1</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="rcOutputChannelBoxFw3">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Select output channel for Accessory2 RcInput</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="rcOutputChannelBoxFw2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Select output channel for Accessory1 RcInput</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_14">
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">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;
font: bold 12px;
margin:1px;</string>
</property>
<property name="text">
<string>Accessory2</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_15">
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>RcOutput curve</string>
</property>
<property name="styleSheet">
<string notr="true">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;
font: bold 12px;
margin:1px;</string>
</property>
<property name="text">
<string>Curve</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QComboBox" name="rcOutputCurveBoxFw1">
<property name="toolTip">
<string>Select output curve for Accessory0 RcInput</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QComboBox" name="rcOutputCurveBoxFw4">
<property name="toolTip">
<string>Select output curve for Accessory3 RcInput</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QComboBox" name="rcOutputCurveBoxFw3">
<property name="toolTip">
<string>Select output curve for Accessory2 RcInput</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_16">
<property name="minimumSize">
<size>
<width>90</width>
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">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;
font: bold 12px;
margin:1px;</string>
</property>
<property name="text">
<string>Accessory3</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="rcOutputChannelBoxFw4">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Select output channel for Accessory3 RcInput</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>110</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>RcOutput channels</string>
</property>
<property name="styleSheet">
<string notr="true">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;
font: bold 12px;
margin:1px;</string>
</property>
<property name="text">
<string>RC Output 2</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="rcOutputChannelBoxFw1_2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Select output channel for Accessory0 RcInput</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QComboBox" name="rcOutputChannelBoxFw2_2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Select output channel for Accessory1 RcInput</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QComboBox" name="rcOutputChannelBoxFw3_2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Select output channel for Accessory2 RcInput</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QComboBox" name="rcOutputChannelBoxFw4_2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Select output channel for Accessory3 RcInput</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="2" rowspan="2">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -51,7 +51,8 @@ QStringList ConfigFixedWingWidget::getChannelDescriptions()
}
// get the gui config data
GUIConfigDataUnion configData = getConfigData();
GUIConfigDataUnion configData = getConfigData();
fixedGUISettingsStruct fixedwing = configData.fixedwing;
if (configData.fixedwing.FixedWingPitch1 > 0) {
channelDesc[configData.fixedwing.FixedWingPitch1 - 1] = QString("FixedWingPitch1");
@ -74,6 +75,33 @@ QStringList ConfigFixedWingWidget::getChannelDescriptions()
if (configData.fixedwing.FixedWingThrottle > 0) {
channelDesc[configData.fixedwing.FixedWingThrottle - 1] = QString("FixedWingThrottle");
}
if (fixedwing.Accessory0 > 0 && fixedwing.Accessory0 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) {
channelDesc[fixedwing.Accessory0 - 1] = QString("Accessory0-1");
}
if (fixedwing.Accessory1 > 0 && fixedwing.Accessory1 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) {
channelDesc[fixedwing.Accessory1 - 1] = QString("Accessory1-1");
}
if (fixedwing.Accessory2 > 0 && fixedwing.Accessory2 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) {
channelDesc[fixedwing.Accessory2 - 1] = QString("Accessory2-1");
}
if (fixedwing.Accessory3 > 0 && fixedwing.Accessory3 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) {
channelDesc[fixedwing.Accessory3 - 1] = QString("Accessory3-1");
}
if (fixedwing.Accessory0_2 > 0 && fixedwing.Accessory0_2 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) {
channelDesc[fixedwing.Accessory0_2 - 1] = QString("Accessory0-2");
}
if (fixedwing.Accessory1_2 > 0 && fixedwing.Accessory1_2 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) {
channelDesc[fixedwing.Accessory1_2 - 1] = QString("Accessory1-2");
}
if (fixedwing.Accessory2_2 > 0 && fixedwing.Accessory2_2 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) {
channelDesc[fixedwing.Accessory2_2 - 1] = QString("Accessory2-2");
}
if (fixedwing.Accessory3_2 > 0 && fixedwing.Accessory3_2 <= ConfigFixedWingWidget::CHANNEL_NUMELEM) {
channelDesc[fixedwing.Accessory3_2 - 1] = QString("Accessory3-2");
}
return channelDesc;
}
@ -84,6 +112,13 @@ ConfigFixedWingWidget::ConfigFixedWingWidget(QWidget *parent) :
populateChannelComboBoxes();
QStringList mixerCurveList;
mixerCurveList << "Curve1" << "Curve2";
m_aircraft->rcOutputCurveBoxFw1->addItems(mixerCurveList);
m_aircraft->rcOutputCurveBoxFw2->addItems(mixerCurveList);
m_aircraft->rcOutputCurveBoxFw3->addItems(mixerCurveList);
m_aircraft->rcOutputCurveBoxFw4->addItems(mixerCurveList);
QStringList fixedWingTypes;
fixedWingTypes << "Aileron" << "Elevon" << "Vtail";
m_aircraft->fixedWingType->addItems(fixedWingTypes);
@ -238,6 +273,18 @@ void ConfigFixedWingWidget::registerWidgets(ConfigTaskWidget &parent)
parent.addWidget(m_aircraft->elevonSlider1);
parent.addWidget(m_aircraft->elevonSlider2);
parent.addWidget(m_aircraft->elevonSlider3);
parent.addWidget(m_aircraft->rcOutputChannelBoxFw1);
parent.addWidget(m_aircraft->rcOutputChannelBoxFw2);
parent.addWidget(m_aircraft->rcOutputChannelBoxFw3);
parent.addWidget(m_aircraft->rcOutputChannelBoxFw4);
parent.addWidget(m_aircraft->rcOutputChannelBoxFw1_2);
parent.addWidget(m_aircraft->rcOutputChannelBoxFw2_2);
parent.addWidget(m_aircraft->rcOutputChannelBoxFw3_2);
parent.addWidget(m_aircraft->rcOutputChannelBoxFw4_2);
parent.addWidget(m_aircraft->rcOutputCurveBoxFw1);
parent.addWidget(m_aircraft->rcOutputCurveBoxFw2);
parent.addWidget(m_aircraft->rcOutputCurveBoxFw3);
parent.addWidget(m_aircraft->rcOutputCurveBoxFw4);
}
void ConfigFixedWingWidget::resetActuators(GUIConfigDataUnion *configData)
@ -251,6 +298,44 @@ void ConfigFixedWingWidget::resetActuators(GUIConfigDataUnion *configData)
configData->fixedwing.FixedWingThrottle = 0;
}
void ConfigFixedWingWidget::resetRcOutputs(GUIConfigDataUnion *configData)
{
configData->fixedwing.Accessory0 = 0;
configData->fixedwing.Accessory1 = 0;
configData->fixedwing.Accessory2 = 0;
configData->fixedwing.Accessory3 = 0;
configData->fixedwing.Accessory0_2 = 0;
configData->fixedwing.Accessory1_2 = 0;
configData->fixedwing.Accessory2_2 = 0;
configData->fixedwing.Accessory3_2 = 0;
}
void ConfigFixedWingWidget::updateRcCurvesUsed()
{
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(mixer);
setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw1, VehicleConfig::MIXER_THROTTLECURVE1);
setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw2, VehicleConfig::MIXER_THROTTLECURVE1);
setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw3, VehicleConfig::MIXER_THROTTLECURVE1);
setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw4, VehicleConfig::MIXER_THROTTLECURVE1);
for (int channel = 0; channel < (int)ConfigFixedWingWidget::CHANNEL_NUMELEM; channel++) {
QString mixerType = getMixerType(mixer, channel);
if (mixerType == "Accessory0" && getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2)) {
setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw1, VehicleConfig::MIXER_THROTTLECURVE2);
} else if (mixerType == "Accessory1" && getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2)) {
setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw2, VehicleConfig::MIXER_THROTTLECURVE2);
} else if (mixerType == "Accessory2" && getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2)) {
setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw3, VehicleConfig::MIXER_THROTTLECURVE2);
} else if (mixerType == "Accessory3" && getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2)) {
setComboCurrentIndex(m_aircraft->rcOutputCurveBoxFw4, VehicleConfig::MIXER_THROTTLECURVE2);
}
}
}
/**
Virtual function to refresh the UI widget values
*/
@ -287,6 +372,18 @@ void ConfigFixedWingWidget::refreshWidgetsValues(QString frameType)
setComboCurrentIndex(m_aircraft->fwRudder1ChannelBox, fixed.FixedWingYaw1);
setComboCurrentIndex(m_aircraft->fwRudder2ChannelBox, fixed.FixedWingYaw2);
setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw1, fixed.Accessory0);
setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw2, fixed.Accessory1);
setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw3, fixed.Accessory2);
setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw4, fixed.Accessory3);
setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw1_2, fixed.Accessory0_2);
setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw2_2, fixed.Accessory1_2);
setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw3_2, fixed.Accessory2_2);
setComboCurrentIndex(m_aircraft->rcOutputChannelBoxFw4_2, fixed.Accessory3_2);
updateRcCurvesUsed();
// Get mixing values for GUI sliders (values stored onboard)
m_aircraft->elevonSlider3->setValue(getMixerValue(mixer, "RollDifferential"));
if (frameType == "FixedWingElevon" || frameType == "Elevon") {
@ -310,6 +407,13 @@ QString ConfigFixedWingWidget::updateConfigObjectsFromWidgets()
Q_ASSERT(mixer);
// Reset all Mixers type
resetAllMixersType(mixer);
QList<QString> rcOutputList;
rcOutputList << "Accessory0" << "Accessory1" << "Accessory2" << "Accessory3";
setupRcOutputs(rcOutputList);
// Set the throttle curve
setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, m_aircraft->fixedWingThrottle->getCurve());
@ -580,6 +684,118 @@ bool ConfigFixedWingWidget::setupFrameVtail(QString airframeType)
return true;
}
/**
Helper function: setup rc outputs. Takes a list of channel names in input.
*/
void ConfigFixedWingWidget::setupRcOutputs(QList<QString> rcOutputList)
{
QList<QComboBox *> rcList;
rcList << m_aircraft->rcOutputChannelBoxFw1 << m_aircraft->rcOutputChannelBoxFw2
<< m_aircraft->rcOutputChannelBoxFw3 << m_aircraft->rcOutputChannelBoxFw4;
QList<QComboBox *> rcList2;
rcList2 << m_aircraft->rcOutputChannelBoxFw1_2 << m_aircraft->rcOutputChannelBoxFw2_2
<< m_aircraft->rcOutputChannelBoxFw3_2 << m_aircraft->rcOutputChannelBoxFw4_2;
GUIConfigDataUnion configData = getConfigData();
resetRcOutputs(&configData);
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject("MixerSettings"));
Q_ASSERT(mixer);
int curveAccessory0 = m_aircraft->rcOutputCurveBoxFw1->currentIndex();
int curveAccessory1 = m_aircraft->rcOutputCurveBoxFw2->currentIndex();
int curveAccessory2 = m_aircraft->rcOutputCurveBoxFw3->currentIndex();
int curveAccessory3 = m_aircraft->rcOutputCurveBoxFw4->currentIndex();
foreach(QString rc_output, rcOutputList) {
int index = rcList.takeFirst()->currentIndex();
int index2 = rcList2.takeFirst()->currentIndex();
if (rc_output == "Accessory0") {
// First output for Accessory0
configData.fixedwing.Accessory0 = index;
if (index) {
setMixerType(mixer, index - 1, VehicleConfig::MIXERTYPE_ACCESSORY0);
if (curveAccessory0) {
setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127);
} else {
setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);
}
}
// Second output for Accessory0
configData.fixedwing.Accessory0_2 = index2;
if (index2) {
setMixerType(mixer, index2 - 1, VehicleConfig::MIXERTYPE_ACCESSORY0);
if (curveAccessory0) {
setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127);
} else {
setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);
}
}
} else if (rc_output == "Accessory1") {
configData.fixedwing.Accessory1 = index;
configData.fixedwing.Accessory1_2 = index2;
if (index) {
setMixerType(mixer, index - 1, VehicleConfig::MIXERTYPE_ACCESSORY1);
if (curveAccessory1) {
setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127);
} else {
setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);
}
}
if (index2) {
setMixerType(mixer, index2 - 1, VehicleConfig::MIXERTYPE_ACCESSORY1);
if (curveAccessory1) {
setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127);
} else {
setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);
}
}
} else if (rc_output == "Accessory2") {
configData.fixedwing.Accessory2 = index;
configData.fixedwing.Accessory2_2 = index2;
if (index) {
setMixerType(mixer, index - 1, VehicleConfig::MIXERTYPE_ACCESSORY2);
if (curveAccessory2) {
setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127);
} else {
setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);
}
}
if (index2) {
setMixerType(mixer, index2 - 1, VehicleConfig::MIXERTYPE_ACCESSORY2);
if (curveAccessory2) {
setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127);
} else {
setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);
}
}
} else if (rc_output == "Accessory3") {
configData.fixedwing.Accessory3 = index;
configData.fixedwing.Accessory3_2 = index2;
if (index) {
setMixerType(mixer, index - 1, VehicleConfig::MIXERTYPE_ACCESSORY3);
if (curveAccessory3) {
setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127);
} else {
setMixerVectorValue(mixer, index - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);
}
}
if (index2) {
setMixerType(mixer, index2 - 1, VehicleConfig::MIXERTYPE_ACCESSORY3);
if (curveAccessory3) {
setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127);
} else {
setMixerVectorValue(mixer, index2 - 1, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);
}
}
}
}
setConfigData(configData);
}
void ConfigFixedWingWidget::enableControls(bool enable)
{
ConfigTaskWidget::enableControls(enable);
@ -648,6 +864,44 @@ bool ConfigFixedWingWidget::throwConfigError(QString airframeType)
channelNames += (combobox->currentText() == "None") ? "" : combobox->currentText();
}
}
// Iterate through all instances of rcOutputChannelBoxFw
for (int i = 0; i < 5; i++) {
// Find widgets with his name "rcOutputChannelBoxFw.x", where x is an integer
QComboBox *combobox = this->findChild<QComboBox *>("rcOutputChannelBoxFw" + QString::number(i + 1));
if (combobox) {
if (channelNames.contains(combobox->currentText(), Qt::CaseInsensitive)) {
int size = combobox->style()->pixelMetric(QStyle::PM_SmallIconSize);
QPixmap pixmap(size, size);
pixmap.fill(QColor("orange"));
combobox->setItemData(combobox->currentIndex(), pixmap, Qt::DecorationRole); // Set color palettes
combobox->setToolTip(tr("Channel already used"));
} else {
for (int index = 0; index < (int)ConfigFixedWingWidget::CHANNEL_NUMELEM; index++) {
combobox->setItemData(index, 0, Qt::DecorationRole); // Reset all color palettes
combobox->setToolTip(tr("Select first output channel for Accessory%1 RcInput").arg(i));
}
}
channelNames += (combobox->currentText() == "None") ? "" : combobox->currentText();
}
// Find duplicates in second output comboboxes
QComboBox *combobox2 = this->findChild<QComboBox *>("rcOutputChannelBoxFw" + QString::number(i + 1) + "_2");
if (combobox2) {
if (channelNames.contains(combobox2->currentText(), Qt::CaseInsensitive)) {
int size = combobox2->style()->pixelMetric(QStyle::PM_SmallIconSize);
QPixmap pixmap(size, size);
pixmap.fill(QColor("orange"));
combobox2->setItemData(combobox2->currentIndex(), pixmap, Qt::DecorationRole); // Set color palettes
combobox2->setToolTip(tr("Channel already used"));
} else {
for (int index = 0; index < (int)ConfigFixedWingWidget::CHANNEL_NUMELEM; index++) {
combobox2->setItemData(index, 0, Qt::DecorationRole); // Reset all color palettes
combobox2->setToolTip(tr("Select second output channel for Accessory%1 RcInput").arg(i));
}
}
channelNames += (combobox2->currentText() == "None") ? "" : combobox2->currentText();
}
}
return error;
}

View File

@ -58,10 +58,13 @@ private:
virtual void registerWidgets(ConfigTaskWidget &parent);
virtual void resetActuators(GUIConfigDataUnion *configData);
virtual void resetRcOutputs(GUIConfigDataUnion *configData);
bool setupFrameFixedWing(QString airframeType);
bool setupFrameElevon(QString airframeType);
bool setupFrameVtail(QString airframeType);
void setupRcOutputs(QList<QString> rcOutputList);
void updateRcCurvesUsed();
protected:
void enableControls(bool enable);

View File

@ -373,18 +373,6 @@ void ConfigMultiRotorWidget::resetRcOutputs(GUIConfigDataUnion *configData)
configData->multi.Accessory3 = 0;
}
void ConfigMultiRotorWidget::resetMixers()
{
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(mixer);
for (int channel = 0; channel < (int)ConfigMultiRotorWidget::CHANNEL_NUMELEM; channel++) {
resetMixerVector(mixer, channel);
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_DISABLED);
}
}
void ConfigMultiRotorWidget::updateRcCurvesUsed()
{
UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
@ -545,8 +533,8 @@ QString ConfigMultiRotorWidget::updateConfigObjectsFromWidgets()
Q_ASSERT(mixer);
// Reset all Mixers
resetMixers();
// Reset all Mixers types
resetAllMixersType(mixer);
QList<QString> rcOutputList;
rcOutputList << "Accessory0" << "Accessory1" << "Accessory2" << "Accessory3";

View File

@ -73,7 +73,6 @@ private:
bool setupMultiRotorMixer(double mixerFactors[8][3]);
void setupMotors(QList<QString> motorList);
void setupRcOutputs(QList<QString> rcOutputList);
void resetMixers();
void setupQuadMotor(int channel, double roll, double pitch, double yaw);
void setYawMixLevel(int);

View File

@ -232,6 +232,15 @@ void VehicleConfig::resetMotorAndServoMixers(UAVDataObject *mixer)
}
}
// Disable all mixers types
void VehicleConfig::resetAllMixersType(UAVDataObject *mixer)
{
for (int channel = 0; channel < (int)VehicleConfig::CHANNEL_NUMELEM; channel++) {
resetMixerVector(mixer, channel);
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_DISABLED);
}
}
double VehicleConfig::getMixerVectorValue(UAVDataObject *mixer, int channel, MixerVectorElem elementName)
{
Q_ASSERT(mixer);

View File

@ -89,10 +89,17 @@ typedef struct {
uint FixedWingPitch2 : 4;
uint FixedWingYaw1 : 4;
uint FixedWingYaw2 : 4;
uint padding : 4; // 32 bits
uint Accessory0 : 4; // 32 bits
uint Accessory1 : 4;
uint Accessory2 : 4;
uint Accessory3 : 4;
uint Accessory0_2 : 4;
uint Accessory1_2 : 4;
uint Accessory2_2 : 4;
uint Accessory3_2 : 4;
quint32 padding : 4; // 64bits
quint32 padding1;
quint32 padding2;
quint32 padding3; // 128 bits
quint32 padding2; // 128 bits
} __attribute__((packed)) fixedGUISettingsStruct;
typedef struct {
@ -228,6 +235,7 @@ protected:
void setMixerVectorValue(UAVDataObject *mixer, int channel, MixerVectorElem elementName, double value);
void resetMixerVector(UAVDataObject *mixer, int channel);
void resetMotorAndServoMixers(UAVDataObject *mixer);
void resetAllMixersType(UAVDataObject *mixer);
QString getMixerType(UAVDataObject *mixer, int channel);
void setMixerType(UAVDataObject *mixer, int channel, MixerTypeElem mixerType);
void setThrottleCurve(UAVDataObject *mixer, MixerThrottleCurveElem curveType, QList<double> curve);

View File

@ -487,13 +487,13 @@
inkscape:window-height="928"
id="namedview4099"
showgrid="false"
inkscape:zoom="1.0458791"
inkscape:cx="384.95499"
inkscape:cy="955.071"
inkscape:zoom="2.0917582"
inkscape:cx="391.2913"
inkscape:cy="1188.8255"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="elevon"
inkscape:current-layer="aileron-frame"
showborder="true"
inkscape:showpageshadow="false"
inkscape:object-paths="true"
@ -767,32 +767,7 @@
id="path4400-5-6"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:125%;font-family:Prototype;-inkscape-font-specification:Prototype;letter-spacing:0px;word-spacing:0px;fill:#ff6000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 961.2594,723.76703 q 0,-0.8 0.9106,-0.8 l 7.4667,0 q 0.9106,0 0.9106,-0.8 l 0,-8.15999 q 0,-0.8 -0.9106,-0.8 l -7.4667,0 q -0.9106,0 -0.9106,-0.8 l 0,-10 q 0,-0.8 -0.9106,-0.8 l -9.2879,0 q -0.9106,0 -0.9106,0.8 l 0,10 q 0,0.8 -0.9105,0.8 l -4.8261,0 q -0.9106,0 -0.9106,0.8 l 0,8.15999 q 0,0.8 0.9106,0.8 l 4.8261,0 q 0.9105,0 0.9105,0.8 l 0,24.96001 q 0,2.48 2.2765,4.32 q 2.2764,1.84 5.7366,1.84 l 11.4733,0 q 0.9106,0 0.9106,-0.8 l 0,-8.16 q 0,-0.72 -0.7285,-0.8 l -7.6488,0 q -0.9106,0 -0.9106,-0.8 l 0,-20.56001 z"
inkscape:connector-curvature="0" /></g></g></g><g
transform="translate(0.31998545,1013.9245)"
id="aileron-rudder-top"
style="fill:#ffffff;fill-opacity:1"><path
id="path3769"
d="m 398.002,892.888 c -0.523,-9.188 -0.92,-18.377 -1.326,-27.563 l -0.547,-13.783 -0.447,-13.782 c -0.135,-4.594 -0.416,-9.188 -0.63,-13.783 -0.213,-4.595 -0.231,-9.188 -0.033,-13.78 0.194,-4.597 0.512,-9.189 0.972,-13.782 0.475,-4.596 1.061,-9.189 2.012,-13.784 0.055,-0.267 0.248,-0.42 0.432,-0.339 0.114,0.053 0.197,0.184 0.23,0.339 0.951,4.595 1.537,9.188 2.012,13.784 0.46,4.593 0.776,9.188 0.974,13.782 0.195,4.594 0.18,9.188 -0.033,13.78 -0.215,4.596 -0.496,9.189 -0.631,13.783 l -0.446,13.782 -0.547,13.783 c -0.406,9.188 -0.803,18.378 -1.326,27.563 -0.016,0.271 -0.176,0.469 -0.359,0.445 -0.168,-0.02 -0.294,-0.213 -0.307,-0.445 z"
stroke-miterlimit="10"
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.64670002;stroke-miterlimit:10" /><path
id="path3771"
d="m 398.166,894.704 c -0.264,-3.729 -0.464,-7.455 -0.668,-11.188 l -0.276,-5.591 -0.225,-5.593 c -0.068,-1.863 -0.21,-3.728 -0.317,-5.592 -0.106,-1.864 -0.114,-3.729 -0.017,-5.592 0.098,-1.864 0.258,-3.729 0.49,-5.594 0.236,-1.862 0.532,-3.729 1.014,-5.593 0.027,-0.104 0.125,-0.171 0.217,-0.139 0.061,0.021 0.103,0.075 0.117,0.139 0.479,1.863 0.774,3.729 1.014,5.593 0.232,1.863 0.395,3.729 0.49,5.594 0.102,1.862 0.09,3.728 -0.018,5.592 -0.108,1.864 -0.248,3.729 -0.317,5.592 l -0.226,5.593 -0.275,5.591 c -0.205,3.73 -0.404,7.457 -0.668,11.188 -0.008,0.105 -0.089,0.188 -0.182,0.18 -0.083,-0.008 -0.147,-0.086 -0.153,-0.18 z"
stroke-miterlimit="10"
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.48500001;stroke-miterlimit:10" /><path
id="path3773"
d="m 398.278,872.009 c -0.162,-0.874 -0.284,-1.749 -0.409,-2.623 l -0.169,-1.313 -0.138,-1.313 c -0.041,-0.438 -0.131,-0.874 -0.194,-1.312 -0.065,-0.438 -0.071,-0.874 -0.01,-1.313 0.06,-0.438 0.155,-0.875 0.3,-1.311 0.146,-0.438 0.326,-0.877 0.62,-1.313 0.017,-0.024 0.074,-0.041 0.133,-0.032 0.035,0.007 0.062,0.019 0.071,0.032 0.293,0.438 0.474,0.874 0.619,1.313 0.143,0.436 0.238,0.873 0.301,1.311 0.061,0.438 0.056,0.874 -0.012,1.313 -0.064,0.438 -0.151,0.875 -0.193,1.312 l -0.14,1.313 -0.169,1.313 c -0.125,0.874 -0.246,1.749 -0.406,2.623 -0.006,0.025 -0.057,0.045 -0.11,0.043 -0.052,-0.002 -0.09,-0.021 -0.094,-0.043 z"
stroke-miterlimit="10"
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.3233;stroke-miterlimit:10" /><line
id="line3775"
y2="801.84399"
x2="400.82199"
y1="801.78497"
x1="395.849"
stroke-miterlimit="10"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.51120001;stroke-miterlimit:10" /></g><rect
inkscape:connector-curvature="0" /></g></g></g><rect
style="fill:url(#linearGradient9561);fill-opacity:1;stroke:#010101;stroke-width:0.69120002;stroke-linecap:round;stroke-linejoin:round"
x="316.569"
y="1874.4409"
@ -1416,7 +1391,32 @@
d="M 231.089,661.657 V 636.359"
id="path8516_1_"
inkscape:connector-curvature="0"
style="fill:none;stroke:#010101;stroke-width:0.69520003;stroke-linecap:round;stroke-linejoin:round" /></g></g></g><g
style="fill:none;stroke:#010101;stroke-width:0.69520003;stroke-linecap:round;stroke-linejoin:round" /></g><g
transform="translate(0.31998545,1013.9245)"
id="aileron-rudder-top"
style="fill:#ffffff;fill-opacity:1"><path
id="path3769"
d="m 398.002,892.888 c -0.523,-9.188 -0.92,-18.377 -1.326,-27.563 l -0.547,-13.783 -0.447,-13.782 c -0.135,-4.594 -0.416,-9.188 -0.63,-13.783 -0.213,-4.595 -0.231,-9.188 -0.033,-13.78 0.194,-4.597 0.512,-9.189 0.972,-13.782 0.475,-4.596 1.061,-9.189 2.012,-13.784 0.055,-0.267 0.248,-0.42 0.432,-0.339 0.114,0.053 0.197,0.184 0.23,0.339 0.951,4.595 1.537,9.188 2.012,13.784 0.46,4.593 0.776,9.188 0.974,13.782 0.195,4.594 0.18,9.188 -0.033,13.78 -0.215,4.596 -0.496,9.189 -0.631,13.783 l -0.446,13.782 -0.547,13.783 c -0.406,9.188 -0.803,18.378 -1.326,27.563 -0.016,0.271 -0.176,0.469 -0.359,0.445 -0.168,-0.02 -0.294,-0.213 -0.307,-0.445 z"
stroke-miterlimit="10"
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.64670002;stroke-miterlimit:10" /><path
id="path3771"
d="m 398.166,894.704 c -0.264,-3.729 -0.464,-7.455 -0.668,-11.188 l -0.276,-5.591 -0.225,-5.593 c -0.068,-1.863 -0.21,-3.728 -0.317,-5.592 -0.106,-1.864 -0.114,-3.729 -0.017,-5.592 0.098,-1.864 0.258,-3.729 0.49,-5.594 0.236,-1.862 0.532,-3.729 1.014,-5.593 0.027,-0.104 0.125,-0.171 0.217,-0.139 0.061,0.021 0.103,0.075 0.117,0.139 0.479,1.863 0.774,3.729 1.014,5.593 0.232,1.863 0.395,3.729 0.49,5.594 0.102,1.862 0.09,3.728 -0.018,5.592 -0.108,1.864 -0.248,3.729 -0.317,5.592 l -0.226,5.593 -0.275,5.591 c -0.205,3.73 -0.404,7.457 -0.668,11.188 -0.008,0.105 -0.089,0.188 -0.182,0.18 -0.083,-0.008 -0.147,-0.086 -0.153,-0.18 z"
stroke-miterlimit="10"
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.48500001;stroke-miterlimit:10" /><path
id="path3773"
d="m 398.278,872.009 c -0.162,-0.874 -0.284,-1.749 -0.409,-2.623 l -0.169,-1.313 -0.138,-1.313 c -0.041,-0.438 -0.131,-0.874 -0.194,-1.312 -0.065,-0.438 -0.071,-0.874 -0.01,-1.313 0.06,-0.438 0.155,-0.875 0.3,-1.311 0.146,-0.438 0.326,-0.877 0.62,-1.313 0.017,-0.024 0.074,-0.041 0.133,-0.032 0.035,0.007 0.062,0.019 0.071,0.032 0.293,0.438 0.474,0.874 0.619,1.313 0.143,0.436 0.238,0.873 0.301,1.311 0.061,0.438 0.056,0.874 -0.012,1.313 -0.064,0.438 -0.151,0.875 -0.193,1.312 l -0.14,1.313 -0.169,1.313 c -0.125,0.874 -0.246,1.749 -0.406,2.623 -0.006,0.025 -0.057,0.045 -0.11,0.043 -0.052,-0.002 -0.09,-0.021 -0.094,-0.043 z"
stroke-miterlimit="10"
inkscape:connector-curvature="0"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.3233;stroke-miterlimit:10" /><line
id="line3775"
y2="801.84399"
x2="400.82199"
y1="801.78497"
x1="395.849"
stroke-miterlimit="10"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.51120001;stroke-miterlimit:10" /></g></g></g><g
id="vtail"><g
transform="translate(22.636675,7.8126685)"
id="vtail-frame"><path

Before

Width:  |  Height:  |  Size: 204 KiB

After

Width:  |  Height:  |  Size: 204 KiB