1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

Merge branch 'kenz/extraGUIchanges' of ssh://git.openpilot.org/OpenPilot into cp/extraGUIchanges

This commit is contained in:
chris pember 2012-09-24 20:26:04 -07:00
commit 086232406d
8 changed files with 5581 additions and 251 deletions

View File

@ -1092,7 +1092,7 @@ margin:1px;</string>
Typical value is 50% for + or X configuration on quads.</string> Typical value is 50% for + or X configuration on quads.</string>
</property> </property>
<property name="minimum"> <property name="minimum">
<number>-100</number> <number>0</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>100</number> <number>100</number>
@ -1450,7 +1450,7 @@ font: bold 12px;
margin:1px;</string> margin:1px;</string>
</property> </property>
<property name="text"> <property name="text">
<string>Multirotor Yaw Direction</string> <string>Multirotor Motor Direction</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
@ -1506,9 +1506,9 @@ margin:1px;</string>
</widget> </widget>
</item> </item>
<item row="3" column="4"> <item row="3" column="4">
<widget class="QCheckBox" name="TricopterRevMixercheckBox"> <widget class="QCheckBox" name="MultirotorRevMixercheckBox">
<property name="text"> <property name="text">
<string>Reverse Yaw Mix</string> <string>Reverse all motors</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -21,12 +21,12 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing"> <property name="spacing">
<number>-1</number> <number>6</number>
</property> </property>
<item> <item>
<widget class="QTabWidget" name="Autotune_tabs"> <widget class="QTabWidget" name="Autotune_tabs">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="Preautotune_tab"> <widget class="QWidget" name="Preautotune_tab">
<attribute name="title"> <attribute name="title">
@ -80,17 +80,18 @@
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:20pt; font-weight:600; color:#ff0000;&quot;&gt;WARNING:&lt;/span&gt;&lt;/p&gt; &lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:20pt; font-weight:600; color:#ff0000;&quot;&gt;WARNING:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Lucida Grande'; font-size:13pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;This is an experimental plugin for the GCS that is going to make your aircraft shake etc so test with lots of space and be &lt;span style=&quot; font-weight:600;&quot;&gt;very very wary&lt;/span&gt; for it creating bad tuning values.  Basically there is no reason to think this will work at all.&lt;br /&gt;&lt;br /&gt;To use autotuning, here are the steps:&lt;/p&gt; &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:13pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Go to the UAVOBrowser and under HwSettings.OptionalModules enable Autotune.  Click send then save.  Power cycle your board (disconnect battery AND usb).&lt;br /&gt;&lt;/li&gt; &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:13pt;&quot;&gt;This is an experimental plugin for the GCS that is going to make your aircraft shake etc so test with lots of space and be &lt;/span&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:13pt; font-weight:600;&quot;&gt;very very wary&lt;/span&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:13pt;&quot;&gt; for it creating bad tuning values.  Basically there is no reason to think this will work at all.&lt;br /&gt;&lt;br /&gt;To use autotuning, here are the steps:&lt;/span&gt;&lt;/p&gt;
&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;In Input configuration set one of your flight modes to &amp;quot;Autotune&amp;quot;&lt;br /&gt;&lt;/li&gt; &lt;ul style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; font-family:'Lucida Grande'; font-size:13pt;&quot; style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Go to the UAVOBrowser and under HwSettings.OptionalModules enable Autotune.  Click send then save.  Power cycle your board (disconnect battery AND usb).&lt;br /&gt;&lt;/li&gt;
&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Take off, flip to autotune, keep it in the air while it's shaking&lt;br /&gt;&lt;/li&gt; &lt;li style=&quot; font-family:'Lucida Grande'; font-size:13pt;&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;In Input configuration set one of your flight modes to &amp;quot;Autotune&amp;quot;&lt;br /&gt;&lt;/li&gt;
&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Land and disarm.  (note - you &lt;span style=&quot; font-weight:600;&quot;&gt;MUST&lt;/span&gt; stay in autotune mode through this point, leaving autotune before disarming aborts the process)&lt;br /&gt;&lt;/li&gt; &lt;li style=&quot; font-family:'Lucida Grande'; font-size:13pt;&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Take off, flip to autotune, keep it in the air while it's shaking&lt;br /&gt;&lt;/li&gt;
&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;We'd recommend checking your stabilization settings before trying them out. &lt;br /&gt;&lt;/li&gt; &lt;li style=&quot; font-family:'Lucida Grande'; font-size:13pt;&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Land and disarm.  (note - you &lt;span style=&quot; font-weight:600;&quot;&gt;MUST&lt;/span&gt; stay in autotune mode through this point, leaving autotune before disarming aborts the process)&lt;br /&gt;&lt;/li&gt;
&lt;li style=&quot; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Test fly then new settings&lt;/li&gt; &lt;li style=&quot; font-family:'Lucida Grande'; font-size:13pt;&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;We'd recommend checking your stabilization settings before trying them out. &lt;br /&gt;&lt;/li&gt;
&lt;li style=&quot; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;If you're ready to proceed, click the &amp;quot;Enable Autotune Module&amp;quot; checkbox below this text, and go to the next tab.&lt;/li&gt;&lt;/ul&gt;&lt;/body&gt;&lt;/html&gt;</string> &lt;li style=&quot; font-family:'Lucida Grande'; font-size:13pt;&quot; style=&quot; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Test fly then new settings&lt;/li&gt;
&lt;li style=&quot; font-family:'Lucida Grande'; font-size:13pt;&quot; style=&quot; margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;If you're ready to proceed, click the &amp;quot;Enable Autotune Module&amp;quot; checkbox below this text, and go to the next tab.&lt;/li&gt;&lt;/ul&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -194,8 +195,8 @@ p, li { white-space: pre-wrap; }
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>709</width> <width>717</width>
<height>588</height> <height>602</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -690,8 +691,6 @@ Useful if you have accidentally changed some settings.</string>
</item> </item>
</layout> </layout>
</widget> </widget>
<resources> <resources/>
<include location="../coreplugin/core.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>

View File

@ -49,7 +49,7 @@ const QString ConfigMultiRotorWidget::CHANNELBOXNAME = QString("multiMotorChanne
/** /**
Constructor Constructor
*/ */
ConfigMultiRotorWidget::ConfigMultiRotorWidget(Ui_AircraftWidget *aircraft, QWidget *parent) : VehicleConfig(parent) ConfigMultiRotorWidget::ConfigMultiRotorWidget(Ui_AircraftWidget *aircraft, QWidget *parent) : VehicleConfig(parent), invertMotors(1)
{ {
m_aircraft = aircraft; m_aircraft = aircraft;
} }
@ -87,20 +87,18 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
if (frameType == "Tri" || frameType == "Tricopter Y") { if (frameType == "Tri" || frameType == "Tricopter Y") {
setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Tricopter Y")); setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Tricopter Y"));
quad->setElementId("tri");
//Enable all necessary motor channel boxes... //Enable all necessary motor channel boxes...
enableComboBoxes(uiowner, CHANNELBOXNAME, 3, true); enableComboBoxes(uiowner, CHANNELBOXNAME, 3, true);
m_aircraft->mrRollMixLevel->setValue(100); m_aircraft->mrRollMixLevel->setValue(100);
m_aircraft->mrPitchMixLevel->setValue(100); m_aircraft->mrPitchMixLevel->setValue(100);
m_aircraft->mrYawMixLevel->setValue(50); setYawMixLevel(50);
m_aircraft->triYawChannelBox->setEnabled(true); m_aircraft->triYawChannelBox->setEnabled(true);
} }
else if (frameType == "QuadX" || frameType == "Quad X") { else if (frameType == "QuadX" || frameType == "Quad X") {
setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Quad X")); setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Quad X"));
quad->setElementId("quad-x");
//Enable all necessary motor channel boxes... //Enable all necessary motor channel boxes...
enableComboBoxes(uiowner, CHANNELBOXNAME, 4, true); enableComboBoxes(uiowner, CHANNELBOXNAME, 4, true);
@ -108,104 +106,173 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
// init mixer levels // init mixer levels
m_aircraft->mrRollMixLevel->setValue(50); m_aircraft->mrRollMixLevel->setValue(50);
m_aircraft->mrPitchMixLevel->setValue(50); m_aircraft->mrPitchMixLevel->setValue(50);
m_aircraft->mrYawMixLevel->setValue(50); setYawMixLevel(50);
} }
else if (frameType == "QuadP" || frameType == "Quad +") { else if (frameType == "QuadP" || frameType == "Quad +") {
setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Quad +")); setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Quad +"));
quad->setElementId("quad-plus");
//Enable all necessary motor channel boxes... //Enable all necessary motor channel boxes...
enableComboBoxes(uiowner, CHANNELBOXNAME, 4, true); enableComboBoxes(uiowner, CHANNELBOXNAME, 4, true);
m_aircraft->mrRollMixLevel->setValue(100); m_aircraft->mrRollMixLevel->setValue(100);
m_aircraft->mrPitchMixLevel->setValue(100); m_aircraft->mrPitchMixLevel->setValue(100);
m_aircraft->mrYawMixLevel->setValue(50); setYawMixLevel(50);
} }
else if (frameType == "Hexa" || frameType == "Hexacopter") else if (frameType == "Hexa" || frameType == "Hexacopter")
{ {
setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Hexacopter")); setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Hexacopter"));
quad->setElementId("quad-hexa");
//Enable all necessary motor channel boxes... //Enable all necessary motor channel boxes...
enableComboBoxes(uiowner, CHANNELBOXNAME, 6, true); enableComboBoxes(uiowner, CHANNELBOXNAME, 6, true);
m_aircraft->mrRollMixLevel->setValue(50); m_aircraft->mrRollMixLevel->setValue(50);
m_aircraft->mrPitchMixLevel->setValue(33); m_aircraft->mrPitchMixLevel->setValue(33);
m_aircraft->mrYawMixLevel->setValue(33); setYawMixLevel(33);
} }
else if (frameType == "HexaX" || frameType == "Hexacopter X" ) { else if (frameType == "HexaX" || frameType == "Hexacopter X" ) {
setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Hexacopter X")); setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Hexacopter X"));
quad->setElementId("quad-hexa-H");
//Enable all necessary motor channel boxes... //Enable all necessary motor channel boxes...
enableComboBoxes(uiowner, CHANNELBOXNAME, 6, true); enableComboBoxes(uiowner, CHANNELBOXNAME, 6, true);
m_aircraft->mrRollMixLevel->setValue(33); m_aircraft->mrRollMixLevel->setValue(33);
m_aircraft->mrPitchMixLevel->setValue(50); m_aircraft->mrPitchMixLevel->setValue(50);
m_aircraft->mrYawMixLevel->setValue(33); setYawMixLevel(33);
} }
else if (frameType == "HexaCoax" || frameType == "Hexacopter Y6") else if (frameType == "HexaCoax" || frameType == "Hexacopter Y6")
{ {
setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Hexacopter Y6")); setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Hexacopter Y6"));
quad->setElementId("hexa-coax");
//Enable all necessary motor channel boxes... //Enable all necessary motor channel boxes...
enableComboBoxes(uiowner, CHANNELBOXNAME, 6, true); enableComboBoxes(uiowner, CHANNELBOXNAME, 6, true);
m_aircraft->mrRollMixLevel->setValue(100); m_aircraft->mrRollMixLevel->setValue(100);
m_aircraft->mrPitchMixLevel->setValue(50); m_aircraft->mrPitchMixLevel->setValue(50);
m_aircraft->mrYawMixLevel->setValue(66); setYawMixLevel(66);
} }
else if (frameType == "Octo" || frameType == "Octocopter") else if (frameType == "Octo" || frameType == "Octocopter")
{ {
setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Octocopter")); setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Octocopter"));
quad->setElementId("quad-octo");
//Enable all necessary motor channel boxes //Enable all necessary motor channel boxes
enableComboBoxes(uiowner, CHANNELBOXNAME, 8, true); enableComboBoxes(uiowner, CHANNELBOXNAME, 8, true);
m_aircraft->mrRollMixLevel->setValue(33); m_aircraft->mrRollMixLevel->setValue(33);
m_aircraft->mrPitchMixLevel->setValue(33); m_aircraft->mrPitchMixLevel->setValue(33);
m_aircraft->mrYawMixLevel->setValue(25); setYawMixLevel(25);
} }
else if (frameType == "OctoV" || frameType == "Octocopter V") else if (frameType == "OctoV" || frameType == "Octocopter V")
{ {
setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Octocopter V")); setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Octocopter V"));
quad->setElementId("quad-octo-v");
//Enable all necessary motor channel boxes //Enable all necessary motor channel boxes
enableComboBoxes(uiowner, CHANNELBOXNAME, 8, true); enableComboBoxes(uiowner, CHANNELBOXNAME, 8, true);
m_aircraft->mrRollMixLevel->setValue(25); m_aircraft->mrRollMixLevel->setValue(25);
m_aircraft->mrPitchMixLevel->setValue(25); m_aircraft->mrPitchMixLevel->setValue(25);
m_aircraft->mrYawMixLevel->setValue(25); setYawMixLevel(25);
} }
else if (frameType == "OctoCoaxP" || frameType == "Octo Coax +") else if (frameType == "OctoCoaxP" || frameType == "Octo Coax +")
{ {
setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Octo Coax +")); setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Octo Coax +"));
quad->setElementId("octo-coax-P");
//Enable all necessary motor channel boxes //Enable all necessary motor channel boxes
enableComboBoxes(uiowner, CHANNELBOXNAME, 8, true); enableComboBoxes(uiowner, CHANNELBOXNAME, 8, true);
m_aircraft->mrRollMixLevel->setValue(100); m_aircraft->mrRollMixLevel->setValue(100);
m_aircraft->mrPitchMixLevel->setValue(100); m_aircraft->mrPitchMixLevel->setValue(100);
m_aircraft->mrYawMixLevel->setValue(50); setYawMixLevel(50);
} }
else if (frameType == "OctoCoaxX" || frameType == "Octo Coax X") else if (frameType == "OctoCoaxX" || frameType == "Octo Coax X")
{ {
setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Octo Coax X")); setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Octo Coax X"));
quad->setElementId("octo-coax-X");
//Enable all necessary motor channel boxes
enableComboBoxes(uiowner, CHANNELBOXNAME, 8, true); enableComboBoxes(uiowner, CHANNELBOXNAME, 8, true);
m_aircraft->mrRollMixLevel->setValue(50); m_aircraft->mrRollMixLevel->setValue(50);
m_aircraft->mrPitchMixLevel->setValue(50); m_aircraft->mrPitchMixLevel->setValue(50);
m_aircraft->mrYawMixLevel->setValue(50); setYawMixLevel(50);
}
//Draw the appropriate airframe
drawAirframe(frameType);
}
void ConfigMultiRotorWidget::drawAirframe(QString frameType){
invertMotors = m_aircraft->MultirotorRevMixercheckBox->isChecked() ? -1:1;
if (frameType == "Tri" || frameType == "Tricopter Y") {
if(invertMotors > 0)
quad->setElementId("tri");
else
quad->setElementId("tri_reverse");
}
else if (frameType == "QuadX" || frameType == "Quad X") {
if(invertMotors > 0)
quad->setElementId("quad-x");
else
quad->setElementId("quad-x_reverse");
}
else if (frameType == "QuadP" || frameType == "Quad +") {
if(invertMotors > 0)
quad->setElementId("quad-plus");
else
quad->setElementId("quad-plus_reverse");
}
else if (frameType == "Hexa" || frameType == "Hexacopter")
{
if(invertMotors > 0)
quad->setElementId("quad-hexa");
else
quad->setElementId("quad-hexa_reverse");
}
else if (frameType == "HexaX" || frameType == "Hexacopter X" ) {
if(invertMotors > 0)
quad->setElementId("quad-hexa-H");
else
quad->setElementId("quad-hexa-H_reverse");
}
else if (frameType == "HexaCoax" || frameType == "Hexacopter Y6")
{
if(invertMotors > 0)
quad->setElementId("hexa-coax");
else
quad->setElementId("hexa-coax_reverse");
}
else if (frameType == "Octo" || frameType == "Octocopter")
{
if(invertMotors > 0)
quad->setElementId("quad-octo");
else
quad->setElementId("quad-octo_reverse");
}
else if (frameType == "OctoV" || frameType == "Octocopter V")
{
if(invertMotors > 0)
quad->setElementId("quad-octo-v");
else
quad->setElementId("quad-octo-v_reverse");
}
else if (frameType == "OctoCoaxP" || frameType == "Octo Coax +")
{
if(invertMotors > 0)
quad->setElementId("octo-coax-P");
else
quad->setElementId("octo-coax-P_reverse");
}
else if (frameType == "OctoCoaxX" || frameType == "Octo Coax X")
{
if(invertMotors > 0)
quad->setElementId("octo-coax-X");
else
quad->setElementId("octo-coax-X_reverse");
} }
} }
@ -259,6 +326,21 @@ QStringList ConfigMultiRotorWidget::getChannelDescriptions()
return channelDesc; return channelDesc;
} }
void ConfigMultiRotorWidget::setYawMixLevel(int value)
{
if(value<0)
{
m_aircraft->mrYawMixLevel->setValue((-1)*value);
m_aircraft->MultirotorRevMixercheckBox->setChecked(true);
}
else
{
m_aircraft->mrYawMixLevel->setValue(value);
m_aircraft->MultirotorRevMixercheckBox->setChecked(false);
}
}
@ -500,7 +582,7 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
m_aircraft->mrPitchMixLevel->setValue( value/1.27 ); m_aircraft->mrPitchMixLevel->setValue( value/1.27 );
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW); value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
m_aircraft->mrYawMixLevel->setValue( 1-value/1.27 ); setYawMixLevel( 1-value/1.27 );
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1; channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL); value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
@ -526,7 +608,7 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
m_aircraft->mrPitchMixLevel->setValue( value/1.27 ); m_aircraft->mrPitchMixLevel->setValue( value/1.27 );
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW); value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
m_aircraft->mrYawMixLevel->setValue( 1-value/1.27 ); setYawMixLevel( 1-value/1.27 );
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL); value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
m_aircraft->mrRollMixLevel->setValue( value/1.27); m_aircraft->mrRollMixLevel->setValue( value/1.27);
@ -556,7 +638,7 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
m_aircraft->mrPitchMixLevel->setValue( floor(value/1.27) ); m_aircraft->mrPitchMixLevel->setValue( floor(value/1.27) );
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW); value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
m_aircraft->mrYawMixLevel->setValue( floor(-value/1.27) ); setYawMixLevel( floor(-value/1.27) );
//change channels //change channels
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1; channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
@ -589,7 +671,7 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
m_aircraft->mrPitchMixLevel->setValue( floor(value/1.27) ); m_aircraft->mrPitchMixLevel->setValue( floor(value/1.27) );
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW); value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
m_aircraft->mrYawMixLevel->setValue( floor(-value/1.27) ); setYawMixLevel( floor(-value/1.27) );
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1; channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL); value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
@ -617,7 +699,7 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
m_aircraft->mrPitchMixLevel->setValue( value/1.27 ); m_aircraft->mrPitchMixLevel->setValue( value/1.27 );
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW); value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
m_aircraft->mrYawMixLevel->setValue( value/1.27 ); setYawMixLevel( value/1.27 );
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1; channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL); value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
@ -648,7 +730,7 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
m_aircraft->mrPitchMixLevel->setValue( floor(value/1.27) ); m_aircraft->mrPitchMixLevel->setValue( floor(value/1.27) );
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW); value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
m_aircraft->mrYawMixLevel->setValue( floor(-value/1.27) ); setYawMixLevel( floor(-value/1.27) );
//change channels //change channels
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1; channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
@ -660,7 +742,7 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
m_aircraft->mrPitchMixLevel->setValue( floor(value/1.27) ); m_aircraft->mrPitchMixLevel->setValue( floor(value/1.27) );
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW); value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
m_aircraft->mrYawMixLevel->setValue( floor(-value/1.27) ); setYawMixLevel( floor(-value/1.27) );
//change channels //change channels
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1; channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
@ -672,7 +754,7 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
m_aircraft->mrPitchMixLevel->setValue( floor(value/1.27) ); m_aircraft->mrPitchMixLevel->setValue( floor(value/1.27) );
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW); value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
m_aircraft->mrYawMixLevel->setValue( floor(-value/1.27) ); setYawMixLevel( floor(-value/1.27) );
//change channels //change channels
channel = m_aircraft->multiMotorChannelBox3->currentIndex() - 1; channel = m_aircraft->multiMotorChannelBox3->currentIndex() - 1;
@ -705,7 +787,7 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
m_aircraft->mrPitchMixLevel->setValue( floor(value/1.27) ); m_aircraft->mrPitchMixLevel->setValue( floor(value/1.27) );
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW); value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
m_aircraft->mrYawMixLevel->setValue( floor(-value/1.27) ); setYawMixLevel( floor(-value/1.27) );
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL); value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
m_aircraft->mrRollMixLevel->setValue( floor(value/1.27) ); m_aircraft->mrRollMixLevel->setValue( floor(value/1.27) );
@ -732,6 +814,8 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
} }
} }
drawAirframe(frameType);
} }
@ -959,7 +1043,8 @@ bool ConfigMultiRotorWidget::setupMultiRotorMixer(double mixerFactors[8][3])
// and enable only the relevant channels: // and enable only the relevant channels:
double pFactor = (double)m_aircraft->mrPitchMixLevel->value()/100; double pFactor = (double)m_aircraft->mrPitchMixLevel->value()/100;
double rFactor = (double)m_aircraft->mrRollMixLevel->value()/100; double rFactor = (double)m_aircraft->mrRollMixLevel->value()/100;
double yFactor = (double)m_aircraft->mrYawMixLevel->value()/100; invertMotors = m_aircraft->MultirotorRevMixercheckBox->isChecked() ? -1:1;
double yFactor =invertMotors * (double)m_aircraft->mrYawMixLevel->value()/100;
for (int i=0 ; i<8; i++) { for (int i=0 ; i<8; i++) {
if(mmList.at(i)->isEnabled()) if(mmList.at(i)->isEnabled())
{ {

View File

@ -64,9 +64,14 @@ private:
void setupMotors(QList<QString> motorList); void setupMotors(QList<QString> motorList);
void setupQuadMotor(int channel, double roll, double pitch, double yaw); void setupQuadMotor(int channel, double roll, double pitch, double yaw);
float invertMotors;
virtual void ResetActuators(GUIConfigDataUnion* configData); virtual void ResetActuators(GUIConfigDataUnion* configData);
static QStringList getChannelDescriptions(); static QStringList getChannelDescriptions();
static const QString CHANNELBOXNAME; static const QString CHANNELBOXNAME;
void setYawMixLevel(int);
void drawAirframe(QString multiRotorType);
private slots: private slots:
virtual void setupUI(QString airframeType); virtual void setupUI(QString airframeType);

View File

@ -56,7 +56,6 @@ public slots:
private slots: private slots:
void recomputeStabilization(); void recomputeStabilization();
void saveStabilization(); void saveStabilization();
void refreshValues();
}; };
#endif // CONFIGAUTOTUNE_H #endif // CONFIGAUTOTUNE_H

View File

@ -215,6 +215,9 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi
connect(m_aircraft->ffTestBox2, SIGNAL(clicked(bool)), this, SLOT(enableFFTest())); connect(m_aircraft->ffTestBox2, SIGNAL(clicked(bool)), this, SLOT(enableFFTest()));
connect(m_aircraft->ffTestBox3, SIGNAL(clicked(bool)), this, SLOT(enableFFTest())); connect(m_aircraft->ffTestBox3, SIGNAL(clicked(bool)), this, SLOT(enableFFTest()));
//Connect the multirotor motor reverse checkbox
connect(m_aircraft->MultirotorRevMixercheckBox, SIGNAL(clicked(bool)), this, SLOT(reverseMultirotorMotor()));
// Connect the help pushbutton // Connect the help pushbutton
connect(m_aircraft->airframeHelp, SIGNAL(clicked()), this, SLOT(openHelp())); connect(m_aircraft->airframeHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
enableControls(false); enableControls(false);
@ -483,7 +486,7 @@ void ConfigVehicleTypeWidget::refreshWidgetsValues(UAVObject * o)
UAVObjectField *field = system->getField(QString("AirframeType")); UAVObjectField *field = system->getField(QString("AirframeType"));
Q_ASSERT(field); Q_ASSERT(field);
// At this stage, we will need to have some hardcoded settings in this code, this // At this stage, we will need to have some hardcoded settings in this code, this
// is not ideal, but here you go. // is not ideal, but there you go.
QString frameType = field->getValue().toString(); QString frameType = field->getValue().toString();
setupAirframeUI(frameType); setupAirframeUI(frameType);
@ -766,6 +769,12 @@ void ConfigVehicleTypeWidget::setComboCurrentIndex(QComboBox* box, int index)
box->setCurrentIndex(index); box->setCurrentIndex(index);
} }
void ConfigVehicleTypeWidget::reverseMultirotorMotor(){
QString frameType = m_aircraft->multirotorFrameType->currentText();
m_multirotor->drawAirframe(frameType);
}
/** /**
WHAT DOES THIS DO??? WHAT DOES THIS DO???
*/ */

View File

@ -95,6 +95,7 @@ private slots:
void enableFFTest(); void enableFFTest();
void openHelp(); void openHelp();
void reverseMultirotorMotor();
protected: protected:
void showEvent(QShowEvent *event); void showEvent(QShowEvent *event);

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 407 KiB

After

Width:  |  Height:  |  Size: 758 KiB