1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-04-10 02:02:21 +02:00

Fix tab indentation to be consistent with QT Creator

This commit is contained in:
James Cotton 2012-07-27 20:14:42 -05:00
parent 9f1a8416f5
commit a75ed21012

View File

@ -58,7 +58,7 @@ ConfigMultiRotorWidget::ConfigMultiRotorWidget(Ui_AircraftWidget *aircraft, QWid
*/ */
ConfigMultiRotorWidget::~ConfigMultiRotorWidget() ConfigMultiRotorWidget::~ConfigMultiRotorWidget()
{ {
// Do nothing // Do nothing
} }
@ -86,13 +86,13 @@ 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"); quad->setElementId("tri");
//Enable all necessary motor channel boxes... //Enable all necessary motor channel boxes...
for (i=1; i <=3; i++) { for (i=1; i <=3; i++) {
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true); enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), 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); m_aircraft->mrYawMixLevel->setValue(50);
@ -102,132 +102,132 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
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"); quad->setElementId("quad-x");
//Enable all necessary motor channel boxes... //Enable all necessary motor channel boxes...
for (i=1; i <=4; i++) { for (i=1; i <=4; i++) {
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true); enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
} }
// 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); m_aircraft->mrYawMixLevel->setValue(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"); quad->setElementId("quad-plus");
//Enable all necessary motor channel boxes... //Enable all necessary motor channel boxes...
for (i=1; i <=4; i++) { for (i=1; i <=4; i++) {
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true); enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), 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); m_aircraft->mrYawMixLevel->setValue(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"); quad->setElementId("quad-hexa");
//Enable all necessary motor channel boxes... //Enable all necessary motor channel boxes...
for (i=1; i <=6; i++) { for (i=1; i <=6; i++) {
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true); enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), 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); m_aircraft->mrYawMixLevel->setValue(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"); quad->setElementId("quad-hexa-H");
//Enable all necessary motor channel boxes... //Enable all necessary motor channel boxes...
for (i=1; i <=6; i++) { for (i=1; i <=6; i++) {
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true); enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
} }
m_aircraft->mrRollMixLevel->setValue(33);
m_aircraft->mrPitchMixLevel->setValue(50);
m_aircraft->mrYawMixLevel->setValue(33);
m_aircraft->mrRollMixLevel->setValue(33);
m_aircraft->mrPitchMixLevel->setValue(50);
m_aircraft->mrYawMixLevel->setValue(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"); quad->setElementId("hexa-coax");
//Enable all necessary motor channel boxes... //Enable all necessary motor channel boxes...
for (i=1; i <=6; i++) { for (i=1; i <=6; i++) {
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true); enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
} }
m_aircraft->mrRollMixLevel->setValue(100);
m_aircraft->mrPitchMixLevel->setValue(50);
m_aircraft->mrYawMixLevel->setValue(66);
m_aircraft->mrRollMixLevel->setValue(100);
m_aircraft->mrPitchMixLevel->setValue(50);
m_aircraft->mrYawMixLevel->setValue(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"); quad->setElementId("quad-octo");
//Enable all necessary motor channel boxes //Enable all necessary motor channel boxes
for (i=1; i <=8; i++) { for (i=1; i <=8; i++) {
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true); enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), 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); m_aircraft->mrYawMixLevel->setValue(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"); quad->setElementId("quad-octo-v");
//Enable all necessary motor channel boxes //Enable all necessary motor channel boxes
for (i=1; i <=8; i++) { for (i=1; i <=8; i++) {
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true); enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
} }
m_aircraft->mrRollMixLevel->setValue(25);
m_aircraft->mrPitchMixLevel->setValue(25);
m_aircraft->mrYawMixLevel->setValue(25);
m_aircraft->mrRollMixLevel->setValue(25);
m_aircraft->mrPitchMixLevel->setValue(25);
m_aircraft->mrYawMixLevel->setValue(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"); quad->setElementId("octo-coax-P");
//Enable all necessary motor channel boxes //Enable all necessary motor channel boxes
for (int i=1; i <=8; i++) { for (int i=1; i <=8; i++) {
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true); enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
} }
m_aircraft->mrRollMixLevel->setValue(100);
m_aircraft->mrPitchMixLevel->setValue(100);
m_aircraft->mrYawMixLevel->setValue(50);
m_aircraft->mrRollMixLevel->setValue(100);
m_aircraft->mrPitchMixLevel->setValue(100);
m_aircraft->mrYawMixLevel->setValue(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"); quad->setElementId("octo-coax-X");
//Enable all necessary motor channel boxes //Enable all necessary motor channel boxes
for (int i=1; i <=8; i++) { for (int i=1; i <=8; i++) {
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true); enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), 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); m_aircraft->mrYawMixLevel->setValue(50);
} }
} }
void ConfigMultiRotorWidget::ResetActuators(GUIConfigDataUnion* configData) void ConfigMultiRotorWidget::ResetActuators(GUIConfigDataUnion* configData)
@ -473,12 +473,12 @@ QString ConfigMultiRotorWidget::updateConfigObjectsFromWidgets()
setMixerType(mixerObj, channel, VehicleConfig::MIXERTYPE_SERVO); setMixerType(mixerObj, channel, VehicleConfig::MIXERTYPE_SERVO);
setMixerVectorValue(mixerObj, channel, VehicleConfig::MIXERVECTOR_YAW, 127); setMixerVectorValue(mixerObj, channel, VehicleConfig::MIXERVECTOR_YAW, 127);
} }
m_aircraft->mrStatusLabel->setText("SUCCESS: Mixer Saved OK"); m_aircraft->mrStatusLabel->setText("SUCCESS: Mixer Saved OK");
} }
return airframeType; return airframeType;
} }
@ -497,16 +497,16 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
UAVDataObject* mixer = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings"))); UAVDataObject* mixer = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(mixer); Q_ASSERT(mixer);
if (frameType == "QuadP") { if (frameType == "QuadP") {
// Motors 1/2/3/4 are: N / E / S / W // Motors 1/2/3/4 are: N / E / S / W
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorN); setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorN);
setComboCurrentIndex(m_aircraft->multiMotorChannelBox2,multi.VTOLMotorE); setComboCurrentIndex(m_aircraft->multiMotorChannelBox2,multi.VTOLMotorE);
setComboCurrentIndex(m_aircraft->multiMotorChannelBox3,multi.VTOLMotorS); setComboCurrentIndex(m_aircraft->multiMotorChannelBox3,multi.VTOLMotorS);
setComboCurrentIndex(m_aircraft->multiMotorChannelBox4,multi.VTOLMotorW); setComboCurrentIndex(m_aircraft->multiMotorChannelBox4,multi.VTOLMotorW);
// Now, read the 1st mixer R/P/Y levels and initialize the mix sliders. // Now, read the 1st mixer R/P/Y levels and initialize the mix sliders.
// This assumes that all vectors are identical - if not, the user should use the // This assumes that all vectors are identical - if not, the user should use the
// "custom" setting. // "custom" setting.
channel = m_aircraft->multiMotorChannelBox1->currentIndex() - 1; channel = m_aircraft->multiMotorChannelBox1->currentIndex() - 1;
if (channel > -1) if (channel > -1)
@ -522,7 +522,7 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
m_aircraft->mrRollMixLevel->setValue( -value/1.27); m_aircraft->mrRollMixLevel->setValue( -value/1.27);
} }
} else if (frameType == "QuadX") { } else if (frameType == "QuadX") {
// Motors 1/2/3/4 are: NW / NE / SE / SW // Motors 1/2/3/4 are: NW / NE / SE / SW
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNW); setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNW);
setComboCurrentIndex(m_aircraft->multiMotorChannelBox2,multi.VTOLMotorNE); setComboCurrentIndex(m_aircraft->multiMotorChannelBox2,multi.VTOLMotorNE);
@ -546,8 +546,8 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
} }
} else if (frameType == "Hexa") { } else if (frameType == "Hexa") {
// Motors 1/2/3 4/5/6 are: N / NE / SE / S / SW / NW // Motors 1/2/3 4/5/6 are: N / NE / SE / S / SW / NW
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorN); setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorN);
setComboCurrentIndex(m_aircraft->multiMotorChannelBox2,multi.VTOLMotorNE); setComboCurrentIndex(m_aircraft->multiMotorChannelBox2,multi.VTOLMotorNE);
@ -577,7 +577,7 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
} }
} else if (frameType == "HexaX") { } else if (frameType == "HexaX") {
// Motors 1/2/3 4/5/6 are: NE / E / SE / SW / W / NW // Motors 1/2/3 4/5/6 are: NE / E / SE / SW / W / NW
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNE); setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNE);
@ -604,7 +604,7 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL); value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
m_aircraft->mrRollMixLevel->setValue( floor(1-value/1.27) ); m_aircraft->mrRollMixLevel->setValue( floor(1-value/1.27) );
} }
} else if (frameType == "HexaCoax") { } else if (frameType == "HexaCoax") {
// Motors 1/2/3 4/5/6 are: NW/W NE/E S/SE // Motors 1/2/3 4/5/6 are: NW/W NE/E S/SE
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNW); setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNW);
@ -630,8 +630,8 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
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);
} }
} else if (frameType == "Octo" || frameType == "OctoV" || } else if (frameType == "Octo" || frameType == "OctoV" ||
frameType == "OctoCoaxP") { frameType == "OctoCoaxP") {
// Motors 1 to 8 are N / NE / E / etc // Motors 1 to 8 are N / NE / E / etc
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorN); setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorN);
@ -687,7 +687,7 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
} }
} }
} else if (frameType == "OctoCoaxX") { } else if (frameType == "OctoCoaxX") {
// Motors 1 to 8 are N / NE / E / etc // Motors 1 to 8 are N / NE / E / etc
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNW); setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNW);
@ -732,7 +732,7 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
m_aircraft->mrRollMixLevel->setValue( floor(value/1.27) ); m_aircraft->mrRollMixLevel->setValue( floor(value/1.27) );
} }
} }
} }
@ -809,23 +809,23 @@ void ConfigMultiRotorWidget::setupMotors(QList<QString> motorList)
bool ConfigMultiRotorWidget::setupQuad(bool pLayout) bool ConfigMultiRotorWidget::setupQuad(bool pLayout)
{ {
// Check coherence: // Check coherence:
//Show any config errors in GUI //Show any config errors in GUI
if (throwConfigError(4)) { if (throwConfigError(4)) {
return false; return false;
} }
QList<QString> motorList; QList<QString> motorList;
if (pLayout) { if (pLayout) {
motorList << "VTOLMotorN" << "VTOLMotorE" << "VTOLMotorS" motorList << "VTOLMotorN" << "VTOLMotorE" << "VTOLMotorS"
<< "VTOLMotorW"; << "VTOLMotorW";
} else { } else {
motorList << "VTOLMotorNW" << "VTOLMotorNE" << "VTOLMotorSE" motorList << "VTOLMotorNW" << "VTOLMotorNE" << "VTOLMotorSE"
<< "VTOLMotorSW"; << "VTOLMotorSW";
} }
setupMotors(motorList); setupMotors(motorList);
// Now, setup the mixer: // Now, setup the mixer:
// Motor 1 to 4, X Layout: // Motor 1 to 4, X Layout:
// pitch roll yaw // pitch roll yaw
@ -834,15 +834,15 @@ bool ConfigMultiRotorWidget::setupQuad(bool pLayout)
// {-0.5 ,-0.5 ,-0.5 //rear right motor (CW) // {-0.5 ,-0.5 ,-0.5 //rear right motor (CW)
// {-0.5 ,0.5 ,0.5 //Rear left motor (CCW) // {-0.5 ,0.5 ,0.5 //Rear left motor (CCW)
double xMixer [8][3] = { double xMixer [8][3] = {
{ 1, 1, -1}, { 1, 1, -1},
{ 1, -1, 1}, { 1, -1, 1},
{-1, -1, -1}, {-1, -1, -1},
{-1, 1, 1}, {-1, 1, 1},
{ 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0} { 0, 0, 0}
}; };
// //
// Motor 1 to 4, P Layout: // Motor 1 to 4, P Layout:
// pitch roll yaw // pitch roll yaw
@ -851,16 +851,16 @@ bool ConfigMultiRotorWidget::setupQuad(bool pLayout)
// {-1 ,0 ,-0.5 //Rear motor (CW) // {-1 ,0 ,-0.5 //Rear motor (CW)
// {0 ,1 ,0.5 //Left motor (CCW) // {0 ,1 ,0.5 //Left motor (CCW)
double pMixer [8][3] = { double pMixer [8][3] = {
{ 1, 0, -1}, { 1, 0, -1},
{ 0, -1, 1}, { 0, -1, 1},
{-1, 0, -1}, {-1, 0, -1},
{ 0, 1, 1}, { 0, 1, 1},
{ 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0} { 0, 0, 0}
}; };
if (pLayout) { if (pLayout) {
setupMultiRotorMixer(pMixer); setupMultiRotorMixer(pMixer);
} else { } else {
@ -878,22 +878,22 @@ bool ConfigMultiRotorWidget::setupQuad(bool pLayout)
bool ConfigMultiRotorWidget::setupHexa(bool pLayout) bool ConfigMultiRotorWidget::setupHexa(bool pLayout)
{ {
// Check coherence: // Check coherence:
//Show any config errors in GUI //Show any config errors in GUI
if (throwConfigError(6)) if (throwConfigError(6))
return false; return false;
QList<QString> motorList; QList<QString> motorList;
if (pLayout) { if (pLayout) {
motorList << "VTOLMotorN" << "VTOLMotorNE" << "VTOLMotorSE" motorList << "VTOLMotorN" << "VTOLMotorNE" << "VTOLMotorSE"
<< "VTOLMotorS" << "VTOLMotorSW" << "VTOLMotorNW"; << "VTOLMotorS" << "VTOLMotorSW" << "VTOLMotorNW";
} else { } else {
motorList << "VTOLMotorNE" << "VTOLMotorE" << "VTOLMotorSE" motorList << "VTOLMotorNE" << "VTOLMotorE" << "VTOLMotorSE"
<< "VTOLMotorSW" << "VTOLMotorW" << "VTOLMotorNW"; << "VTOLMotorSW" << "VTOLMotorW" << "VTOLMotorNW";
} }
setupMotors(motorList); setupMotors(motorList);
// and set only the relevant channels: // and set only the relevant channels:
// Motor 1 to 6, P Layout: // Motor 1 to 6, P Layout:
// pitch roll yaw // pitch roll yaw
// 1 { 0.3 , 0 ,-0.3 // N CW // 1 { 0.3 , 0 ,-0.3 // N CW
@ -902,8 +902,8 @@ bool ConfigMultiRotorWidget::setupHexa(bool pLayout)
// 4 {-0.3 , 0 , 0.3 // S CCW // 4 {-0.3 , 0 , 0.3 // S CCW
// 5 {-0.3 , 0.5 ,-0.3 // SW CW // 5 {-0.3 , 0.5 ,-0.3 // SW CW
// 6 { 0.3 , 0.5 , 0.3 // NW CCW // 6 { 0.3 , 0.5 , 0.3 // NW CCW
double pMixer [8][3] = { double pMixer [8][3] = {
{ 1, 0, -1}, { 1, 0, -1},
{ 1, -1, 1}, { 1, -1, 1},
{-1, -1, -1}, {-1, -1, -1},
@ -913,8 +913,8 @@ bool ConfigMultiRotorWidget::setupHexa(bool pLayout)
{ 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0} { 0, 0, 0}
}; };
// //
// Motor 1 to 6, X Layout: // Motor 1 to 6, X Layout:
// 1 [ 0.5, -0.3, -0.3 ] NE // 1 [ 0.5, -0.3, -0.3 ] NE
// 2 [ 0 , -0.3, 0.3 ] E // 2 [ 0 , -0.3, 0.3 ] E
@ -922,24 +922,24 @@ bool ConfigMultiRotorWidget::setupHexa(bool pLayout)
// 4 [ -0.5, 0.3, 0.3 ] SW // 4 [ -0.5, 0.3, 0.3 ] SW
// 5 [ 0 , 0.3, -0.3 ] W // 5 [ 0 , 0.3, -0.3 ] W
// 6 [ 0.5, 0.3, 0.3 ] NW // 6 [ 0.5, 0.3, 0.3 ] NW
double xMixer [8][3] = { double xMixer [8][3] = {
{ 1, -1, -1}, { 1, -1, -1},
{ 0, -1, 1}, { 0, -1, 1},
{ -1, -1, -1}, { -1, -1, -1},
{ -1, 1, 1}, { -1, 1, 1},
{ 0, 1, -1}, { 0, 1, -1},
{ 1, 1, 1}, { 1, 1, 1},
{ 0, 0, 0}, { 0, 0, 0},
{ 0, 0, 0} { 0, 0, 0}
}; };
if (pLayout) { if (pLayout) {
setupMultiRotorMixer(pMixer); setupMultiRotorMixer(pMixer);
} else { } else {
setupMultiRotorMixer(xMixer); setupMultiRotorMixer(xMixer);
} }
m_aircraft->mrStatusLabel->setText("SUCCESS: Mixer Saved OK"); m_aircraft->mrStatusLabel->setText("SUCCESS: Mixer Saved OK");
return true; return true;
} }
@ -960,8 +960,8 @@ bool ConfigMultiRotorWidget::setupMultiRotorMixer(double mixerFactors[8][3])
QList<QComboBox*> mmList; QList<QComboBox*> mmList;
mmList << m_aircraft->multiMotorChannelBox1 << m_aircraft->multiMotorChannelBox2 << m_aircraft->multiMotorChannelBox3 mmList << m_aircraft->multiMotorChannelBox1 << m_aircraft->multiMotorChannelBox2 << m_aircraft->multiMotorChannelBox3
<< m_aircraft->multiMotorChannelBox4 << m_aircraft->multiMotorChannelBox5 << m_aircraft->multiMotorChannelBox6 << m_aircraft->multiMotorChannelBox4 << m_aircraft->multiMotorChannelBox5 << m_aircraft->multiMotorChannelBox6
<< m_aircraft->multiMotorChannelBox7 << m_aircraft->multiMotorChannelBox8; << m_aircraft->multiMotorChannelBox7 << m_aircraft->multiMotorChannelBox8;
UAVDataObject* mixer = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings"))); UAVDataObject* mixer = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(mixer); Q_ASSERT(mixer);
@ -984,10 +984,10 @@ bool ConfigMultiRotorWidget::setupMultiRotorMixer(double mixerFactors[8][3])
int channel = mmList.at(i)->currentIndex()-1; int channel = mmList.at(i)->currentIndex()-1;
if (channel > -1) if (channel > -1)
setupQuadMotor(channel, mixerFactors[i][0]*pFactor, setupQuadMotor(channel, mixerFactors[i][0]*pFactor,
rFactor*mixerFactors[i][1], yFactor*mixerFactors[i][2]); rFactor*mixerFactors[i][1], yFactor*mixerFactors[i][2]);
} }
} }
// obj->updated(); // obj->updated();
return true; return true;
} }
@ -997,31 +997,31 @@ bool ConfigMultiRotorWidget::setupMultiRotorMixer(double mixerFactors[8][3])
*/ */
bool ConfigMultiRotorWidget::throwConfigError(int numMotors) bool ConfigMultiRotorWidget::throwConfigError(int numMotors)
{ {
//Initialize configuration error flag //Initialize configuration error flag
bool error=false; bool error=false;
//Iterate through all instances of multiMotorChannelBox //Iterate through all instances of multiMotorChannelBox
for (int i=0; i<numMotors; i++) { for (int i=0; i<numMotors; i++) {
//Fine widgets with text "multiMotorChannelBox.x", where x is an integer //Fine widgets with text "multiMotorChannelBox.x", where x is an integer
QComboBox *combobox = qFindChild<QComboBox*>(uiowner, "multiMotorChannelBox" + QString::number(i+1)); QComboBox *combobox = qFindChild<QComboBox*>(uiowner, "multiMotorChannelBox" + QString::number(i+1));
if (combobox){ if (combobox){
if (combobox->currentText() == "None") { if (combobox->currentText() == "None") {
int size = combobox->style()->pixelMetric(QStyle::PM_SmallIconSize); int size = combobox->style()->pixelMetric(QStyle::PM_SmallIconSize);
QPixmap pixmap(size,size); QPixmap pixmap(size,size);
pixmap.fill(QColor("red")); pixmap.fill(QColor("red"));
combobox->setItemData(0, pixmap, Qt::DecorationRole);//Set color palettes combobox->setItemData(0, pixmap, Qt::DecorationRole);//Set color palettes
error=true; error=true;
} }
else { else {
combobox->setItemData(0, 0, Qt::DecorationRole);//Reset color palettes combobox->setItemData(0, 0, Qt::DecorationRole);//Reset color palettes
} }
} }
} }
if (error){
m_aircraft->mrStatusLabel->setText(QString("<font color='red'>ERROR: Assign all %1 motor channels</font>").arg(numMotors)); if (error){
} m_aircraft->mrStatusLabel->setText(QString("<font color='red'>ERROR: Assign all %1 motor channels</font>").arg(numMotors));
}
return error; return error;
} }