mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-18 08:54:15 +01:00
Removed commented code, as per reviewer comments. Made other small reviewer requested changes. Fixed bug with capitalization.
This commit is contained in:
parent
90e4686d70
commit
6461b91f18
@ -1,8 +1,8 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file configccpmwidget.cpp
|
||||
* @author E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @file configfixedwidget.cpp
|
||||
* @author E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup ConfigPlugin Config Plugin
|
||||
|
@ -1,8 +1,8 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file configccpmwidget.cpp
|
||||
* @author E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @file configgroundvehiclemwidget.cpp
|
||||
* @author K. Sebesta & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup ConfigPlugin Config Plugin
|
||||
|
@ -1,8 +1,8 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file configccpmwidget.cpp
|
||||
* @author E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @file configmultirotorwidget.cpp
|
||||
* @author E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup ConfigPlugin Config Plugin
|
||||
@ -66,11 +66,6 @@ void ConfigVehicleTypeWidget::setupMultiRotorUI(QString frameType)
|
||||
combobox->setEnabled(false);
|
||||
}
|
||||
|
||||
// m_aircraft->multiMotorChannelBox4->setEnabled(false);
|
||||
// m_aircraft->multiMotorChannelBox5->setEnabled(false);
|
||||
// m_aircraft->multiMotorChannelBox6->setEnabled(false);
|
||||
// m_aircraft->multiMotorChannelBox7->setEnabled(false);
|
||||
// m_aircraft->multiMotorChannelBox8->setEnabled(false);
|
||||
m_aircraft->triYawChannelBox->setEnabled(true);
|
||||
} else if (frameType == "QuadX" || frameType == "Quad X") {
|
||||
m_aircraft->aircraftType->setCurrentIndex(m_aircraft->aircraftType->findText("Multirotor"));
|
||||
@ -88,11 +83,6 @@ void ConfigVehicleTypeWidget::setupMultiRotorUI(QString frameType)
|
||||
combobox->setEnabled(false);
|
||||
}
|
||||
|
||||
// m_aircraft->multiMotorChannelBox4->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox5->setEnabled(false);
|
||||
// m_aircraft->multiMotorChannelBox6->setEnabled(false);
|
||||
// m_aircraft->multiMotorChannelBox7->setEnabled(false);
|
||||
// m_aircraft->multiMotorChannelBox8->setEnabled(false);
|
||||
m_aircraft->triYawChannelBox->setEnabled(false);
|
||||
m_aircraft->mrRollMixLevel->setValue(50);
|
||||
m_aircraft->mrPitchMixLevel->setValue(50);
|
||||
@ -112,11 +102,7 @@ void ConfigVehicleTypeWidget::setupMultiRotorUI(QString frameType)
|
||||
QComboBox *combobox = qFindChild<QComboBox*>(this, "multiMotorChannelBox" + QString::number(i));
|
||||
combobox->setEnabled(false);
|
||||
}
|
||||
// m_aircraft->multiMotorChannelBox4->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox5->setEnabled(false);
|
||||
// m_aircraft->multiMotorChannelBox6->setEnabled(false);
|
||||
// m_aircraft->multiMotorChannelBox7->setEnabled(false);
|
||||
// m_aircraft->multiMotorChannelBox8->setEnabled(false);
|
||||
|
||||
m_aircraft->triYawChannelBox->setEnabled(false);
|
||||
m_aircraft->mrRollMixLevel->setValue(100);
|
||||
m_aircraft->mrPitchMixLevel->setValue(100);
|
||||
@ -137,11 +123,6 @@ void ConfigVehicleTypeWidget::setupMultiRotorUI(QString frameType)
|
||||
combobox->setEnabled(false);
|
||||
}
|
||||
|
||||
// m_aircraft->multiMotorChannelBox4->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox5->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox6->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox7->setEnabled(false);
|
||||
// m_aircraft->multiMotorChannelBox8->setEnabled(false);
|
||||
m_aircraft->triYawChannelBox->setEnabled(false);
|
||||
m_aircraft->mrRollMixLevel->setValue(50);
|
||||
m_aircraft->mrPitchMixLevel->setValue(33);
|
||||
@ -162,11 +143,6 @@ void ConfigVehicleTypeWidget::setupMultiRotorUI(QString frameType)
|
||||
combobox->setEnabled(false);
|
||||
}
|
||||
|
||||
// m_aircraft->multiMotorChannelBox4->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox5->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox6->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox7->setEnabled(false);
|
||||
// m_aircraft->multiMotorChannelBox8->setEnabled(false);
|
||||
m_aircraft->triYawChannelBox->setEnabled(false);
|
||||
m_aircraft->mrRollMixLevel->setValue(33);
|
||||
m_aircraft->mrPitchMixLevel->setValue(50);
|
||||
@ -188,11 +164,6 @@ void ConfigVehicleTypeWidget::setupMultiRotorUI(QString frameType)
|
||||
combobox->setEnabled(false);
|
||||
}
|
||||
|
||||
// m_aircraft->multiMotorChannelBox4->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox5->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox6->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox7->setEnabled(false);
|
||||
// m_aircraft->multiMotorChannelBox8->setEnabled(false);
|
||||
m_aircraft->triYawChannelBox->setEnabled(false);
|
||||
m_aircraft->mrRollMixLevel->setValue(100);
|
||||
m_aircraft->mrPitchMixLevel->setValue(50);
|
||||
@ -209,11 +180,6 @@ void ConfigVehicleTypeWidget::setupMultiRotorUI(QString frameType)
|
||||
combobox->setEnabled(true);
|
||||
}
|
||||
|
||||
// m_aircraft->multiMotorChannelBox4->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox5->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox6->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox7->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox8->setEnabled(true);
|
||||
m_aircraft->triYawChannelBox->setEnabled(false);
|
||||
m_aircraft->mrRollMixLevel->setValue(33);
|
||||
m_aircraft->mrPitchMixLevel->setValue(33);
|
||||
@ -229,11 +195,6 @@ void ConfigVehicleTypeWidget::setupMultiRotorUI(QString frameType)
|
||||
combobox->setEnabled(true);
|
||||
}
|
||||
|
||||
// m_aircraft->multiMotorChannelBox4->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox5->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox6->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox7->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox8->setEnabled(true);
|
||||
m_aircraft->triYawChannelBox->setEnabled(false);
|
||||
m_aircraft->mrRollMixLevel->setValue(25);
|
||||
m_aircraft->mrPitchMixLevel->setValue(25);
|
||||
@ -250,11 +211,6 @@ void ConfigVehicleTypeWidget::setupMultiRotorUI(QString frameType)
|
||||
combobox->setEnabled(true);
|
||||
}
|
||||
|
||||
// m_aircraft->multiMotorChannelBox4->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox5->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox6->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox7->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox8->setEnabled(true);
|
||||
m_aircraft->triYawChannelBox->setEnabled(false);
|
||||
m_aircraft->mrRollMixLevel->setValue(100);
|
||||
m_aircraft->mrPitchMixLevel->setValue(100);
|
||||
@ -271,11 +227,6 @@ void ConfigVehicleTypeWidget::setupMultiRotorUI(QString frameType)
|
||||
combobox->setEnabled(true);
|
||||
}
|
||||
|
||||
// m_aircraft->multiMotorChannelBox4->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox5->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox6->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox7->setEnabled(true);
|
||||
// m_aircraft->multiMotorChannelBox8->setEnabled(true);
|
||||
m_aircraft->triYawChannelBox->setEnabled(false);
|
||||
m_aircraft->mrRollMixLevel->setValue(50);
|
||||
m_aircraft->mrPitchMixLevel->setValue(50);
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "configahrswidget.h"
|
||||
#include "configgadgetwidget.h"
|
||||
|
||||
#include "ConfigVehicleTypeWidget.h"
|
||||
#include "configvehicletypewidget.h"
|
||||
#include "configccattitudewidget.h"
|
||||
#include "configinputwidget.h"
|
||||
#include "configoutputwidget.h"
|
||||
|
@ -2,7 +2,7 @@
|
||||
******************************************************************************
|
||||
*
|
||||
* @file configvehicletypewidget.cpp
|
||||
* @author E. Lafargue & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @author E. Lafargue, K. Sebesta & The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup ConfigPlugin Config Plugin
|
||||
@ -128,7 +128,6 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi
|
||||
|
||||
QStringList groundVehicleTypes;
|
||||
groundVehicleTypes << "Turnable (car)" << "Differential (tank)" << "Motorcycle";
|
||||
// groundVehicleTypes << "Turnable (car)";
|
||||
m_aircraft->groundVehicleType->addItems(groundVehicleTypes);
|
||||
m_aircraft->groundVehicleType->setCurrentIndex(0); //Set default model to "Turnable (car)"
|
||||
|
||||
@ -610,487 +609,23 @@ void ConfigVehicleTypeWidget::refreshWidgetsValues()
|
||||
if (frameType.startsWith("FixedWing")) {
|
||||
|
||||
// Retrieve fixed wing settings
|
||||
if(1){
|
||||
refreshFixedWingWidgetsValues(frameType);
|
||||
}
|
||||
// // Then retrieve how channels are setup
|
||||
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorSettings")));
|
||||
// Q_ASSERT(obj);
|
||||
// field = obj->getField(QString("FixedWingThrottle"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->fwEngineChannelBox->setCurrentIndex(m_aircraft->fwEngineChannelBox->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("FixedWingRoll1"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->fwAileron1ChannelBox->setCurrentIndex(m_aircraft->fwAileron1ChannelBox->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("FixedWingRoll2"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->fwAileron2ChannelBox->setCurrentIndex(m_aircraft->fwAileron2ChannelBox->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("FixedWingPitch1"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->fwElevator1ChannelBox->setCurrentIndex(m_aircraft->fwElevator1ChannelBox->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("FixedWingPitch2"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->fwElevator2ChannelBox->setCurrentIndex(m_aircraft->fwElevator2ChannelBox->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("FixedWingYaw1"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->fwRudder1ChannelBox->setCurrentIndex(m_aircraft->fwRudder1ChannelBox->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("FixedWingYaw2"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->fwRudder2ChannelBox->setCurrentIndex(m_aircraft->fwRudder2ChannelBox->findText(field->getValue().toString()));
|
||||
//
|
||||
// if (frameType == "FixedWingElevon") {
|
||||
// // If the airframe is elevon, restore the slider setting
|
||||
// // Find the channel number for Elevon1 (FixedWingRoll1)
|
||||
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// Q_ASSERT(obj);
|
||||
// int chMixerNumber = m_aircraft->fwAileron1ChannelBox->currentIndex()-1;
|
||||
// if (chMixerNumber >= 0) { // If for some reason the actuators were incoherent, we might fail here, hence the check.
|
||||
// field = obj->getField(mixerVectors.at(chMixerNumber));
|
||||
// int ti = field->getElementNames().indexOf("Roll");
|
||||
// m_aircraft->elevonSlider1->setValue(field->getDouble(ti)*100);
|
||||
// ti = field->getElementNames().indexOf("Pitch");
|
||||
// m_aircraft->elevonSlider2->setValue(field->getDouble(ti)*100);
|
||||
// }
|
||||
// }
|
||||
// if (frameType == "FixedWingVtail") {
|
||||
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// Q_ASSERT(obj);
|
||||
// int chMixerNumber = m_aircraft->fwElevator1ChannelBox->currentIndex()-1;
|
||||
// if (chMixerNumber >=0) {
|
||||
// field = obj->getField(mixerVectors.at(chMixerNumber));
|
||||
// int ti = field->getElementNames().indexOf("Yaw");
|
||||
// m_aircraft->elevonSlider1->setValue(field->getDouble(ti)*100);
|
||||
// ti = field->getElementNames().indexOf("Pitch");
|
||||
// m_aircraft->elevonSlider2->setValue(field->getDouble(ti)*100);
|
||||
// }
|
||||
// }
|
||||
|
||||
} else if (frameType == "Tri" ||
|
||||
frameType == "QuadX" || frameType == "QuadP" ||
|
||||
frameType == "Hexa" || frameType == "HexaCoax" || frameType == "HexaX" ||
|
||||
frameType == "Octo" || frameType == "OctoV" || frameType == "OctoCoaxP" || frameType == "OctoCoaxX" ) {
|
||||
|
||||
// Retrieve multirotor settings
|
||||
if(1){
|
||||
refreshMultiRotorWidgetsValues(frameType);
|
||||
}
|
||||
else{//
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
// // Retrieve Multirotor settings
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorSettings")));
|
||||
// Q_ASSERT(obj);
|
||||
// if (frameType == "QuadP") {
|
||||
// // Motors 1/2/3/4 are: N / E / S / W
|
||||
// field = obj->getField(QString("VTOLMotorN"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor1->setCurrentIndex(m_aircraft->multiMotor1->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorE"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor2->setCurrentIndex(m_aircraft->multiMotor2->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorS"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor3->setCurrentIndex(m_aircraft->multiMotor3->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorW"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor4->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString()));
|
||||
//
|
||||
// // 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
|
||||
// // "custom" setting.
|
||||
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// Q_ASSERT(obj);
|
||||
// int tmpVal= m_aircraft->multiMotor1->currentIndex()-1;
|
||||
// // tmpVal will be -1 if value is set to "None"
|
||||
// if (tmpVal > -1) {
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// int i = field->getElementNames().indexOf("Pitch");
|
||||
// double val = field->getDouble(i)/1.27;
|
||||
// m_aircraft->mrPitchMixLevel->setValue(val);
|
||||
// i = field->getElementNames().indexOf("Yaw");
|
||||
// val = (1-field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrYawMixLevel->setValue(val);
|
||||
// tmpVal = m_aircraft->multiMotor2->currentIndex()-1;
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// i = field->getElementNames().indexOf("Roll");
|
||||
// val = -field->getDouble(i)/1.27;
|
||||
// m_aircraft->mrRollMixLevel->setValue(val);
|
||||
// }
|
||||
// } else if (frameType == "QuadX") {
|
||||
// // Motors 1/2/3/4 are: NW / NE / SE / SW
|
||||
// field = obj->getField(QString("VTOLMotorNW"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor1->setCurrentIndex(m_aircraft->multiMotor1->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorNE"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor2->setCurrentIndex(m_aircraft->multiMotor2->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorSE"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor3->setCurrentIndex(m_aircraft->multiMotor3->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorSW"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor4->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString()));
|
||||
//
|
||||
// // 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
|
||||
// // "custom" setting.
|
||||
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// Q_ASSERT(obj);
|
||||
// int tmpVal= m_aircraft->multiMotor1->currentIndex()-1;
|
||||
// // tmpVal will be -1 if value is set to "None"
|
||||
// if (tmpVal > -1) {
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// int i = field->getElementNames().indexOf("Pitch");
|
||||
// double val = field->getDouble(i)/1.27;
|
||||
// m_aircraft->mrPitchMixLevel->setValue(val);
|
||||
// i = field->getElementNames().indexOf("Yaw");
|
||||
// val = 1-field->getDouble(i)/1.27;
|
||||
// m_aircraft->mrYawMixLevel->setValue(val);
|
||||
// i = field->getElementNames().indexOf("Roll");
|
||||
// val = field->getDouble(i)/1.27;
|
||||
// m_aircraft->mrRollMixLevel->setValue(val);
|
||||
// }
|
||||
// } else if (frameType == "Hexa") {
|
||||
// // Motors 1/2/3 4/5/6 are: N / NE / SE / S / SW / NW
|
||||
// field = obj->getField(QString("VTOLMotorN"));
|
||||
// m_aircraft->multiMotor1->setCurrentIndex(m_aircraft->multiMotor1->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorNE"));
|
||||
// m_aircraft->multiMotor2->setCurrentIndex(m_aircraft->multiMotor2->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorSE"));
|
||||
// m_aircraft->multiMotor3->setCurrentIndex(m_aircraft->multiMotor3->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorS"));
|
||||
// m_aircraft->multiMotor4->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorSW"));
|
||||
// m_aircraft->multiMotor5->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorNW"));
|
||||
// m_aircraft->multiMotor6->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString()));
|
||||
//
|
||||
// // 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
|
||||
// // "custom" setting.
|
||||
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// int tmpVal= m_aircraft->multiMotor1->currentIndex()-1;
|
||||
// // tmpVal will be -1 if value is set to "None"
|
||||
// if (tmpVal > -1) {
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// int i = field->getElementNames().indexOf("Pitch");
|
||||
// double val = floor(field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrPitchMixLevel->setValue(val);
|
||||
// i = field->getElementNames().indexOf("Yaw");
|
||||
// val = floor(-field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrYawMixLevel->setValue(val);
|
||||
// tmpVal = m_aircraft->multiMotor2->currentIndex()-1;
|
||||
// if(tmpVal>-1)
|
||||
// {
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// i = field->getElementNames().indexOf("Roll");
|
||||
// val = floor(1-field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrRollMixLevel->setValue(val);
|
||||
// }
|
||||
// }
|
||||
// } else if (frameType == "HexaX") {
|
||||
// // Motors 1/2/3 4/5/6 are: NE / E / SE / SW / W / NW
|
||||
// field = obj->getField(QString("VTOLMotorNE"));
|
||||
// m_aircraft->multiMotor1->setCurrentIndex(m_aircraft->multiMotor1->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorE"));
|
||||
// m_aircraft->multiMotor2->setCurrentIndex(m_aircraft->multiMotor2->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorSE"));
|
||||
// m_aircraft->multiMotor3->setCurrentIndex(m_aircraft->multiMotor3->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorSW"));
|
||||
// m_aircraft->multiMotor4->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorW"));
|
||||
// m_aircraft->multiMotor5->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorNW"));
|
||||
// m_aircraft->multiMotor6->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString()));
|
||||
//
|
||||
// // 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
|
||||
// // "custom" setting.
|
||||
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// int tmpVal= m_aircraft->multiMotor1->currentIndex()-1;
|
||||
// // tmpVal will be -1 if value is set to "None"
|
||||
// if (tmpVal > -1) {
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// int i = field->getElementNames().indexOf("Pitch");
|
||||
// double val = floor(field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrPitchMixLevel->setValue(val);
|
||||
// i = field->getElementNames().indexOf("Yaw");
|
||||
// val = floor(-field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrYawMixLevel->setValue(val);
|
||||
// tmpVal = m_aircraft->multiMotor2->currentIndex()-1;
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// i = field->getElementNames().indexOf("Roll");
|
||||
// val = floor(1-field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrRollMixLevel->setValue(val);
|
||||
// }
|
||||
// } else if (frameType == "HexaCoax") {
|
||||
// // Motors 1/2/3 4/5/6 are: NW/W NE/E S/SE
|
||||
// field = obj->getField(QString("VTOLMotorNW"));
|
||||
// m_aircraft->multiMotor1->setCurrentIndex(m_aircraft->multiMotor1->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorW"));
|
||||
// m_aircraft->multiMotor2->setCurrentIndex(m_aircraft->multiMotor2->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorNE"));
|
||||
// m_aircraft->multiMotor3->setCurrentIndex(m_aircraft->multiMotor3->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorE"));
|
||||
// m_aircraft->multiMotor4->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorS"));
|
||||
// m_aircraft->multiMotor5->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorSE"));
|
||||
// m_aircraft->multiMotor6->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString()));
|
||||
//
|
||||
// // 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
|
||||
// // "custom" setting.
|
||||
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// int tmpVal= m_aircraft->multiMotor1->currentIndex()-1;
|
||||
// // tmpVal will be -1 if value is set to "None"
|
||||
// if (tmpVal > -1) {
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// int i = field->getElementNames().indexOf("Pitch");
|
||||
// double val = floor(2*field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrPitchMixLevel->setValue(val);
|
||||
// i = field->getElementNames().indexOf("Yaw");
|
||||
// val = floor(-field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrYawMixLevel->setValue(val);
|
||||
// i = field->getElementNames().indexOf("Roll");
|
||||
// val = floor(field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrRollMixLevel->setValue(val);
|
||||
// }
|
||||
// } else if (frameType == "Octo" || frameType == "OctoV" ||
|
||||
// frameType == "OctoCoaxP") {
|
||||
// // Motors 1 to 8 are N / NE / E / etc
|
||||
// field = obj->getField(QString("VTOLMotorN"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor1->setCurrentIndex(m_aircraft->multiMotor1->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorNE"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor2->setCurrentIndex(m_aircraft->multiMotor2->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorE"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor3->setCurrentIndex(m_aircraft->multiMotor3->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorSE"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor4->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorS"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor5->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorSW"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor6->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorW"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor7->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorNW"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor8->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString()));
|
||||
//
|
||||
// // 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
|
||||
// // "custom" setting.
|
||||
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// int tmpVal= m_aircraft->multiMotor1->currentIndex()-1;
|
||||
// // tmpVal will be -1 if value is set to "None"
|
||||
// if (tmpVal > -1) {
|
||||
// if (frameType == "Octo") {
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// int i = field->getElementNames().indexOf("Pitch");
|
||||
// double val = floor(field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrPitchMixLevel->setValue(val);
|
||||
// i = field->getElementNames().indexOf("Yaw");
|
||||
// val = floor(-field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrYawMixLevel->setValue(val);
|
||||
// tmpVal = m_aircraft->multiMotor2->currentIndex()-1;
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// i = field->getElementNames().indexOf("Roll");
|
||||
// val = floor(-field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrRollMixLevel->setValue(val);
|
||||
// } else if (frameType == "OctoV") {
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// int i = field->getElementNames().indexOf("Yaw");
|
||||
// double val = floor(-field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrYawMixLevel->setValue(val);
|
||||
// i = field->getElementNames().indexOf("Roll");
|
||||
// val = floor(-field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrRollMixLevel->setValue(val);
|
||||
// tmpVal = m_aircraft->multiMotor2->currentIndex()-1;
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// i = field->getElementNames().indexOf("Pitch");
|
||||
// val = floor(field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrPitchMixLevel->setValue(val);
|
||||
//
|
||||
// } else if (frameType == "OctoCoaxP") {
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// int i = field->getElementNames().indexOf("Pitch");
|
||||
// double val = floor(field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrPitchMixLevel->setValue(val);
|
||||
// i = field->getElementNames().indexOf("Yaw");
|
||||
// val = floor(-field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrYawMixLevel->setValue(val);
|
||||
// tmpVal = m_aircraft->multiMotor3->currentIndex()-1;
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// i = field->getElementNames().indexOf("Roll");
|
||||
// val = floor(-field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrRollMixLevel->setValue(val);
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// } else if (frameType == "OctoCoaxX") {
|
||||
// // Motors 1 to 8 are N / NE / E / etc
|
||||
// field = obj->getField(QString("VTOLMotorNW"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor1->setCurrentIndex(m_aircraft->multiMotor1->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorN"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor2->setCurrentIndex(m_aircraft->multiMotor2->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorNE"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor3->setCurrentIndex(m_aircraft->multiMotor3->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorE"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor4->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorSE"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor5->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorS"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor6->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorSW"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor7->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorW"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor8->setCurrentIndex(m_aircraft->multiMotor4->findText(field->getValue().toString()));
|
||||
//
|
||||
// // 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
|
||||
// // "custom" setting.
|
||||
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// int tmpVal= m_aircraft->multiMotor1->currentIndex()-1;
|
||||
// // tmpVal will be -1 if value is set to "None"
|
||||
// if (tmpVal > -1) {
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// int i = field->getElementNames().indexOf("Pitch");
|
||||
// double val = floor(field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrPitchMixLevel->setValue(val);
|
||||
// i = field->getElementNames().indexOf("Yaw");
|
||||
// val = floor(-field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrYawMixLevel->setValue(val);
|
||||
// i = field->getElementNames().indexOf("Roll");
|
||||
// val = floor(field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrRollMixLevel->setValue(val);
|
||||
// }
|
||||
// } else if (frameType == "Tri") {
|
||||
// // Motors 1 to 8 are N / NE / E / etc
|
||||
// field = obj->getField(QString("VTOLMotorNW"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor1->setCurrentIndex(m_aircraft->multiMotor1->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorNE"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor2->setCurrentIndex(m_aircraft->multiMotor2->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("VTOLMotorS"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->multiMotor3->setCurrentIndex(m_aircraft->multiMotor3->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("FixedWingYaw1"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->triYawChannelBoxBox->setCurrentIndex(m_aircraft->multiMotor3->findText(field->getValue().toString()));
|
||||
//
|
||||
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// int tmpVal= m_aircraft->multiMotor1->currentIndex()-1;
|
||||
// // tmpVal will be -1 if value is set to "None"
|
||||
// if (tmpVal > -1) {
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// int i = field->getElementNames().indexOf("Pitch");
|
||||
// double val = floor(2*field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrPitchMixLevel->setValue(val);
|
||||
// i = field->getElementNames().indexOf("Roll");
|
||||
// val = floor(field->getDouble(i)/1.27);
|
||||
// m_aircraft->mrRollMixLevel->setValue(val);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// Q_ASSERT(obj);
|
||||
// // Now, retrieve the Feedforward values:
|
||||
// field = obj->getField(QString("FeedForward"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->feedForwardSlider->setValue(field->getDouble()*100);
|
||||
// field = obj->getField(QString("AccelTime"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->accelTime->setValue(field->getDouble());
|
||||
// field = obj->getField(QString("DecelTime"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->decelTime->setValue(field->getDouble());
|
||||
// field = obj->getField(QString("MaxAccel"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->maxAccelSlider->setValue(field->getDouble());
|
||||
}
|
||||
// Retrieve multirotor settings
|
||||
refreshMultiRotorWidgetsValues(frameType);
|
||||
} else if (frameType == "HeliCP") {
|
||||
m_aircraft->widget_3->requestccpmUpdate();
|
||||
m_aircraft->aircraftType->setCurrentIndex(m_aircraft->aircraftType->findText("Helicopter"));//"Helicopter"
|
||||
} else if (frameType.startsWith("GroundVehicle")) {
|
||||
|
||||
// Retrieve ground vehicle settings
|
||||
if(1){
|
||||
refreshGroundVehicleWidgetsValues(frameType);
|
||||
}
|
||||
refreshGroundVehicleWidgetsValues(frameType);
|
||||
|
||||
// //THIS SECTION STILL NEEDS WORK. FOR THE MOMENT, USE THE FIXED-WING ONBOARD SETTING IN ORDER TO MINIMIZE CHANCES OF BOLLOXING REAL CODE
|
||||
// // Then retrieve channel setup values
|
||||
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorSettings")));
|
||||
// Q_ASSERT(obj);
|
||||
// field = obj->getField(QString("FixedWingThrottle"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->fwEngineChannelBox->setCurrentIndex(m_aircraft->fwEngineChannelBox->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("FixedWingRoll1"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->fwAileron1ChannelBox->setCurrentIndex(m_aircraft->fwAileron1ChannelBox->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("FixedWingRoll2"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->fwAileron2ChannelBox->setCurrentIndex(m_aircraft->fwAileron2ChannelBox->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("FixedWingPitch1"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->fwElevator1ChannelBox->setCurrentIndex(m_aircraft->fwElevator1ChannelBox->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("FixedWingPitch2"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->fwElevator2ChannelBox->setCurrentIndex(m_aircraft->fwElevator2ChannelBox->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("FixedWingYaw1"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->fwRudder1ChannelBox->setCurrentIndex(m_aircraft->fwRudder1ChannelBox->findText(field->getValue().toString()));
|
||||
// field = obj->getField(QString("FixedWingYaw2"));
|
||||
// Q_ASSERT(field);
|
||||
// m_aircraft->fwRudder2ChannelBox->setCurrentIndex(m_aircraft->fwRudder2ChannelBox->findText(field->getValue().toString()));
|
||||
//
|
||||
// if (frameType == "GroundDifferential") {
|
||||
// //CURRENTLY BROKEN UNTIL WE DECIDE HOW DIFFERENTIAL SHOULD BEHAVE
|
||||
// // If the airframe is differential, restore the slider setting
|
||||
// // Find the channel number for Elevon1 (FixedWingRoll1)
|
||||
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// Q_ASSERT(obj);
|
||||
// int chMixerNumber = m_aircraft->fwAileron1ChannelBox->currentIndex()-1;
|
||||
// if (chMixerNumber >= 0) { // If for some reason the actuators were incoherent, we might fail here, hence the check.
|
||||
// field = obj->getField(mixerVectors.at(chMixerNumber));
|
||||
// int ti = field->getElementNames().indexOf("Roll");
|
||||
// m_aircraft->differentialSteeringSlider1->setValue(field->getDouble(ti)*100);
|
||||
//
|
||||
// ti = field->getElementNames().indexOf("Pitch");
|
||||
// m_aircraft->differentialSteeringSlider2->setValue(field->getDouble(ti)*100);
|
||||
// }
|
||||
// }
|
||||
// if (frameType == "GroundMotorcycle") {
|
||||
// //CURRENTLY BROKEN UNTIL WE DECIDE HOW MOTORCYCLE SHOULD BEHAVE
|
||||
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// Q_ASSERT(obj);
|
||||
// int chMixerNumber = m_aircraft->gvMotor1ChannelBox->currentIndex()-1;
|
||||
// if (chMixerNumber >=0) {
|
||||
// field = obj->getField(mixerVectors.at(chMixerNumber));
|
||||
// int ti = field->getElementNames().indexOf("Yaw");
|
||||
// m_aircraft->differentialSteeringSlider1->setValue(field->getDouble(ti)*100);
|
||||
//
|
||||
// ti = field->getElementNames().indexOf("Pitch");
|
||||
// m_aircraft->differentialSteeringSlider2->setValue(field->getDouble(ti)*100);
|
||||
// }
|
||||
// }
|
||||
} else if (frameType == "Custom") {
|
||||
m_aircraft->aircraftType->setCurrentIndex(m_aircraft->aircraftType->findText("Custom"));
|
||||
}
|
||||
@ -1109,71 +644,9 @@ void ConfigVehicleTypeWidget::setupAirframeUI(QString frameType)
|
||||
|
||||
bool dirty=isDirty();
|
||||
if(frameType == "FixedWing" || frameType == "Elevator aileron rudder" ||
|
||||
frameType == "FixedWingElevon" || frameType == "Elevon" ||
|
||||
frameType == "FixedWingVtail" || frameType == "Vtail"){
|
||||
frameType == "FixedWingElevon" || frameType == "Elevon" ||
|
||||
frameType == "FixedWingVtail" || frameType == "Vtail"){
|
||||
setupFixedWingUI(frameType);
|
||||
// }
|
||||
// else if (frameType == "FixedWing" || frameType == "Elevator aileron rudder") {
|
||||
// // Setup the UI
|
||||
// m_aircraft->aircraftType->setCurrentIndex(m_aircraft->aircraftType->findText("Fixed Wing"));
|
||||
// m_aircraft->fixedWingType->setCurrentIndex(m_aircraft->fixedWingType->findText("Elevator aileron rudder"));
|
||||
// m_aircraft->fwRudder1ChannelBox->setEnabled(true);
|
||||
// m_aircraft->fwRudder1Label->setEnabled(true);
|
||||
// m_aircraft->fwRudder2ChannelBox->setEnabled(true);
|
||||
// m_aircraft->fwRudder2Label->setEnabled(true);
|
||||
// m_aircraft->fwElevator1ChannelBox->setEnabled(true);
|
||||
// m_aircraft->fwElevator1Label->setEnabled(true);
|
||||
// m_aircraft->fwElevator2ChannelBox->setEnabled(true);
|
||||
// m_aircraft->fwElevator2Label->setEnabled(true);
|
||||
// m_aircraft->fwAileron1ChannelBox->setEnabled(true);
|
||||
// m_aircraft->fwAileron1Label->setEnabled(true);
|
||||
// m_aircraft->fwAileron2ChannelBox->setEnabled(true);
|
||||
// m_aircraft->fwAileron2Label->setEnabled(true);
|
||||
//
|
||||
// m_aircraft->fwAileron1Label->setText("Aileron 1");
|
||||
// m_aircraft->fwAileron2Label->setText("Aileron 2");
|
||||
// m_aircraft->fwElevator1Label->setText("Elevator 1");
|
||||
// m_aircraft->fwElevator2Label->setText("Elevator 2");
|
||||
// m_aircraft->elevonMixBox->setHidden(true);
|
||||
//
|
||||
// } else if (frameType == "FixedWingElevon" || frameType == "Elevon") {
|
||||
// m_aircraft->aircraftType->setCurrentIndex(m_aircraft->aircraftType->findText("Fixed Wing"));
|
||||
// m_aircraft->fixedWingType->setCurrentIndex(m_aircraft->fixedWingType->findText("Elevon"));
|
||||
// m_aircraft->fwAileron1Label->setText("Elevon 1");
|
||||
// m_aircraft->fwAileron2Label->setText("Elevon 2");
|
||||
// m_aircraft->fwElevator1ChannelBox->setEnabled(false);
|
||||
// m_aircraft->fwElevator1Label->setEnabled(false);
|
||||
// m_aircraft->fwElevator2ChannelBox->setEnabled(false);
|
||||
// m_aircraft->fwElevator2Label->setEnabled(false);
|
||||
// m_aircraft->fwRudder1ChannelBox->setEnabled(true);
|
||||
// m_aircraft->fwRudder1Label->setEnabled(true);
|
||||
// m_aircraft->fwRudder2ChannelBox->setEnabled(true);
|
||||
// m_aircraft->fwRudder2Label->setEnabled(true);
|
||||
// m_aircraft->fwElevator1Label->setText("Elevator 1");
|
||||
// m_aircraft->fwElevator2Label->setText("Elevator 2");
|
||||
// m_aircraft->elevonMixBox->setHidden(false);
|
||||
// m_aircraft->elevonLabel1->setText("Roll");
|
||||
// m_aircraft->elevonLabel2->setText("Pitch");
|
||||
//
|
||||
// } else if (frameType == "FixedWingVtail" || frameType == "Vtail") {
|
||||
// m_aircraft->aircraftType->setCurrentIndex(m_aircraft->aircraftType->findText("Fixed Wing"));
|
||||
// m_aircraft->fixedWingType->setCurrentIndex(m_aircraft->fixedWingType->findText("Vtail"));
|
||||
// m_aircraft->fwRudder1ChannelBox->setEnabled(false);
|
||||
// m_aircraft->fwRudder1Label->setEnabled(false);
|
||||
// m_aircraft->fwRudder2ChannelBox->setEnabled(false);
|
||||
// m_aircraft->fwRudder2Label->setEnabled(false);
|
||||
// m_aircraft->fwElevator1ChannelBox->setEnabled(true);
|
||||
// m_aircraft->fwElevator1Label->setEnabled(true);
|
||||
// m_aircraft->fwElevator1Label->setText("Vtail 1");
|
||||
// m_aircraft->fwElevator2Label->setText("Vtail 2");
|
||||
// m_aircraft->elevonMixBox->setHidden(false);
|
||||
// m_aircraft->fwElevator2ChannelBox->setEnabled(true);
|
||||
// m_aircraft->fwElevator2Label->setEnabled(true);
|
||||
// m_aircraft->fwAileron1Label->setText("Aileron 1");
|
||||
// m_aircraft->fwAileron2Label->setText("Aileron 2");
|
||||
// m_aircraft->elevonLabel1->setText("Rudder");
|
||||
// m_aircraft->elevonLabel2->setText("Pitch");
|
||||
|
||||
} else if (frameType == "Tri" || frameType == "Tricopter Y" ||
|
||||
frameType == "QuadX" || frameType == "Quad X" ||
|
||||
frameType == "QuadP" || frameType == "Quad +" ||
|
||||
@ -1187,190 +660,10 @@ void ConfigVehicleTypeWidget::setupAirframeUI(QString frameType)
|
||||
//Call multi-rotor setup UI
|
||||
setupMultiRotorUI(frameType);
|
||||
}
|
||||
// } else if (frameType == "QuadX" || frameType == "Quad X") {
|
||||
// m_aircraft->aircraftType->setCurrentIndex(m_aircraft->aircraftType->findText("Multirotor"));
|
||||
// m_aircraft->multirotorFrameType->setCurrentIndex(m_aircraft->multirotorFrameType->findText("Quad X"));
|
||||
// quad->setElementId("quad-X");
|
||||
// m_aircraft->multiMotor4->setEnabled(true);
|
||||
// m_aircraft->multiMotor5->setEnabled(false);
|
||||
// m_aircraft->multiMotor6->setEnabled(false);
|
||||
// m_aircraft->multiMotor7->setEnabled(false);
|
||||
// m_aircraft->multiMotor8->setEnabled(false);
|
||||
// m_aircraft->triYawChannelBox->setEnabled(false);
|
||||
// m_aircraft->mrRollMixLevel->setValue(50);
|
||||
// m_aircraft->mrPitchMixLevel->setValue(50);
|
||||
// m_aircraft->mrYawMixLevel->setValue(50);
|
||||
// } else if (frameType == "QuadP" || frameType == "Quad +") {
|
||||
// m_aircraft->aircraftType->setCurrentIndex(m_aircraft->aircraftType->findText("Multirotor"));
|
||||
// m_aircraft->multirotorFrameType->setCurrentIndex(m_aircraft->multirotorFrameType->findText("Quad +"));
|
||||
// quad->setElementId("quad-plus");
|
||||
// m_aircraft->multiMotor4->setEnabled(true);
|
||||
// m_aircraft->multiMotor5->setEnabled(false);
|
||||
// m_aircraft->multiMotor6->setEnabled(false);
|
||||
// m_aircraft->multiMotor7->setEnabled(false);
|
||||
// m_aircraft->multiMotor8->setEnabled(false);
|
||||
// m_aircraft->triYawChannelBox->setEnabled(false);
|
||||
// m_aircraft->mrRollMixLevel->setValue(100);
|
||||
// m_aircraft->mrPitchMixLevel->setValue(100);
|
||||
// m_aircraft->mrYawMixLevel->setValue(50);
|
||||
// } else if (frameType == "Hexa" || frameType == "Hexacopter") {
|
||||
// m_aircraft->aircraftType->setCurrentIndex(m_aircraft->aircraftType->findText("Multirotor"));
|
||||
// m_aircraft->multirotorFrameType->setCurrentIndex(m_aircraft->multirotorFrameType->findText("Hexacopter"));
|
||||
// quad->setElementId("quad-hexa");
|
||||
// m_aircraft->multiMotor4->setEnabled(true);
|
||||
// m_aircraft->multiMotor5->setEnabled(true);
|
||||
// m_aircraft->multiMotor6->setEnabled(true);
|
||||
// m_aircraft->multiMotor7->setEnabled(false);
|
||||
// m_aircraft->multiMotor8->setEnabled(false);
|
||||
// m_aircraft->triYawChannelBox->setEnabled(false);
|
||||
// m_aircraft->mrRollMixLevel->setValue(50);
|
||||
// m_aircraft->mrPitchMixLevel->setValue(33);
|
||||
// m_aircraft->mrYawMixLevel->setValue(33);
|
||||
// } else if (frameType == "Octo" || frameType == "Octocopter") {
|
||||
// m_aircraft->aircraftType->setCurrentIndex(m_aircraft->aircraftType->findText("Multirotor"));
|
||||
// m_aircraft->multirotorFrameType->setCurrentIndex(m_aircraft->multirotorFrameType->findText("Octocopter"));
|
||||
// quad->setElementId("quad-octo");
|
||||
// m_aircraft->multiMotor4->setEnabled(true);
|
||||
// m_aircraft->multiMotor5->setEnabled(true);
|
||||
// m_aircraft->multiMotor6->setEnabled(true);
|
||||
// m_aircraft->multiMotor7->setEnabled(true);
|
||||
// m_aircraft->multiMotor8->setEnabled(true);
|
||||
// m_aircraft->triYawChannelBox->setEnabled(false);
|
||||
// m_aircraft->mrRollMixLevel->setValue(33);
|
||||
// m_aircraft->mrPitchMixLevel->setValue(33);
|
||||
// m_aircraft->mrYawMixLevel->setValue(25);
|
||||
// } else if (frameType == "HexaX" || frameType == "Hexacopter X" ) {
|
||||
// m_aircraft->aircraftType->setCurrentIndex(m_aircraft->aircraftType->findText("Multirotor"));
|
||||
// m_aircraft->multirotorFrameType->setCurrentIndex(m_aircraft->multirotorFrameType->findText("Hexacopter X"));
|
||||
// quad->setElementId("quad-hexa-H");
|
||||
// m_aircraft->multiMotor4->setEnabled(true);
|
||||
// m_aircraft->multiMotor5->setEnabled(true);
|
||||
// m_aircraft->multiMotor6->setEnabled(true);
|
||||
// m_aircraft->multiMotor7->setEnabled(false);
|
||||
// m_aircraft->multiMotor8->setEnabled(false);
|
||||
// m_aircraft->triYawChannelBox->setEnabled(false);
|
||||
// m_aircraft->mrRollMixLevel->setValue(33);
|
||||
// m_aircraft->mrPitchMixLevel->setValue(50);
|
||||
// m_aircraft->mrYawMixLevel->setValue(33);
|
||||
//
|
||||
// } else if (frameType == "OctoV" || frameType == "Octocopter V") {
|
||||
// m_aircraft->aircraftType->setCurrentIndex(m_aircraft->aircraftType->findText("Multirotor"));
|
||||
// m_aircraft->multirotorFrameType->setCurrentIndex(m_aircraft->multirotorFrameType->findText("Octocopter V"));
|
||||
// quad->setElementId("quad-octo-v");
|
||||
// m_aircraft->multiMotor4->setEnabled(true);
|
||||
// m_aircraft->multiMotor5->setEnabled(true);
|
||||
// m_aircraft->multiMotor6->setEnabled(true);
|
||||
// m_aircraft->multiMotor7->setEnabled(true);
|
||||
// m_aircraft->multiMotor8->setEnabled(true);
|
||||
// m_aircraft->triYawChannelBox->setEnabled(false);
|
||||
// m_aircraft->mrRollMixLevel->setValue(25);
|
||||
// m_aircraft->mrPitchMixLevel->setValue(25);
|
||||
// m_aircraft->mrYawMixLevel->setValue(25);
|
||||
//
|
||||
// } else if (frameType == "OctoCoaxP" || frameType == "Octo Coax +") {
|
||||
// m_aircraft->aircraftType->setCurrentIndex(m_aircraft->aircraftType->findText("Multirotor"));
|
||||
// m_aircraft->multirotorFrameType->setCurrentIndex(m_aircraft->multirotorFrameType->findText("Octo Coax +"));
|
||||
// quad->setElementId("octo-coax-P");
|
||||
// m_aircraft->multiMotor4->setEnabled(true);
|
||||
// m_aircraft->multiMotor5->setEnabled(true);
|
||||
// m_aircraft->multiMotor6->setEnabled(true);
|
||||
// m_aircraft->multiMotor7->setEnabled(true);
|
||||
// m_aircraft->multiMotor8->setEnabled(true);
|
||||
// m_aircraft->triYawChannelBox->setEnabled(false);
|
||||
// m_aircraft->mrRollMixLevel->setValue(100);
|
||||
// m_aircraft->mrPitchMixLevel->setValue(100);
|
||||
// m_aircraft->mrYawMixLevel->setValue(50);
|
||||
//
|
||||
// } else if (frameType == "OctoCoaxX" || frameType == "Octo Coax X") {
|
||||
// m_aircraft->aircraftType->setCurrentIndex(m_aircraft->aircraftType->findText("Multirotor"));
|
||||
// m_aircraft->multirotorFrameType->setCurrentIndex(m_aircraft->multirotorFrameType->findText("Octo Coax X"));
|
||||
// quad->setElementId("octo-coax-X");
|
||||
// m_aircraft->multiMotor4->setEnabled(true);
|
||||
// m_aircraft->multiMotor5->setEnabled(true);
|
||||
// m_aircraft->multiMotor6->setEnabled(true);
|
||||
// m_aircraft->multiMotor7->setEnabled(true);
|
||||
// m_aircraft->multiMotor8->setEnabled(true);
|
||||
// m_aircraft->triYawChannelBox->setEnabled(false);
|
||||
// m_aircraft->mrRollMixLevel->setValue(50);
|
||||
// m_aircraft->mrPitchMixLevel->setValue(50);
|
||||
// m_aircraft->mrYawMixLevel->setValue(50);
|
||||
//
|
||||
// } else if (frameType == "HexaCoax" || frameType == "Hexacopter Y6") {
|
||||
// m_aircraft->aircraftType->setCurrentIndex(m_aircraft->aircraftType->findText("Multirotor"));
|
||||
// m_aircraft->multirotorFrameType->setCurrentIndex(m_aircraft->multirotorFrameType->findText("Hexacopter Y6"));
|
||||
// quad->setElementId("hexa-coax");
|
||||
// m_aircraft->multiMotor4->setEnabled(true);
|
||||
// m_aircraft->multiMotor5->setEnabled(true);
|
||||
// m_aircraft->multiMotor6->setEnabled(true);
|
||||
// m_aircraft->multiMotor7->setEnabled(false);
|
||||
// m_aircraft->multiMotor8->setEnabled(false);
|
||||
// m_aircraft->triYawChannelBox->setEnabled(false);
|
||||
// m_aircraft->mrRollMixLevel->setValue(100);
|
||||
// m_aircraft->mrPitchMixLevel->setValue(50);
|
||||
// m_aircraft->mrYawMixLevel->setValue(66);
|
||||
//
|
||||
// } else if (frameType == "Tri" || frameType == "Tricopter Y") {
|
||||
// m_aircraft->aircraftType->setCurrentIndex(m_aircraft->aircraftType->findText("Multirotor"));
|
||||
// m_aircraft->multirotorFrameType->setCurrentIndex(m_aircraft->multirotorFrameType->findText("Tricopter Y"));
|
||||
// quad->setElementId("tri");
|
||||
// m_aircraft->multiMotor4->setEnabled(false);
|
||||
// m_aircraft->multiMotor5->setEnabled(false);
|
||||
// m_aircraft->multiMotor6->setEnabled(false);
|
||||
// m_aircraft->multiMotor7->setEnabled(false);
|
||||
// m_aircraft->multiMotor8->setEnabled(false);
|
||||
// m_aircraft->triYawChannelBox->setEnabled(true);
|
||||
//
|
||||
else if (frameType == "GroundVehicleCar" || frameType == "Turnable (car)" ||
|
||||
frameType == "GroundVehicleDifferential" || frameType == "Differential (tank)" ||
|
||||
frameType == "GroundVehicleMotorcyle" || frameType == "Motorcycle") {
|
||||
setupGroundVehicleUI(frameType);
|
||||
|
||||
//// } else if (m_aircraft->aircraftType->currentText() == "Ground") {
|
||||
// m_aircraft->differentialSteeringMixBox->setHidden(true);
|
||||
// //STILL NEEDS WORK
|
||||
// // Setup the UI
|
||||
// m_aircraft->aircraftType->setCurrentIndex(m_aircraft->aircraftType->findText("Ground"));
|
||||
//
|
||||
// m_aircraft->gvSteering1Label->setEnabled(true);
|
||||
// m_aircraft->gvSteering1Label->setEnabled(true);
|
||||
// m_aircraft->gvSteering2Label->setEnabled(true);
|
||||
// m_aircraft->gvSteering2Label->setEnabled(true);
|
||||
// m_aircraft->gvMotor1ChannelBox->setEnabled(true);
|
||||
// m_aircraft->gvMotor1Label->setEnabled(true);
|
||||
// m_aircraft->gvAileron1ChannelBox->setEnabled(true);
|
||||
// m_aircraft->gvAileron1Label->setEnabled(true);
|
||||
// m_aircraft->gvAileron2ChannelBox->setEnabled(true);
|
||||
// m_aircraft->gvAileron2Label->setEnabled(true);
|
||||
//
|
||||
// if (frameType == "GroundVehicleDifferential" || frameType == "Differential (tank)"){
|
||||
// m_aircraft->groundVehicleType->setCurrentIndex(m_aircraft->groundVehicleType->findText("Differential (tank)"));
|
||||
// m_aircraft->gvMotor2ChannelBox->setEnabled(true);
|
||||
// m_aircraft->gvMotor2Label->setEnabled(true);
|
||||
//
|
||||
// m_aircraft->gvMotor1Label->setText("Left motor");
|
||||
// m_aircraft->gvMotor2Label->setText("Right motor");
|
||||
// m_aircraft->differentialSteeringMixBox->setHidden(false);
|
||||
// }
|
||||
// else if (frameType == "GroundVehicleMotorcyle" || frameType == "Motorcycle"){
|
||||
// m_aircraft->groundVehicleType->setCurrentIndex(m_aircraft->groundVehicleType->findText("Motorcycle"));
|
||||
// m_aircraft->gvMotor2ChannelBox->setEnabled(false);
|
||||
// m_aircraft->gvMotor2Label->setEnabled(false);
|
||||
//
|
||||
// m_aircraft->gvMotor1Label->setText("Motor");
|
||||
// m_aircraft->gvMotor2Label->setText("Elevator 2");
|
||||
// m_aircraft->differentialSteeringMixBox->setHidden(true);
|
||||
// }
|
||||
// else {
|
||||
// m_aircraft->groundVehicleType->setCurrentIndex(m_aircraft->groundVehicleType->findText("Turnable (car)"));
|
||||
//
|
||||
// m_aircraft->gvMotor2ChannelBox->setEnabled(true);
|
||||
// m_aircraft->gvMotor2Label->setEnabled(true);
|
||||
//
|
||||
// m_aircraft->gvMotor1Label->setText("Front motor");
|
||||
// m_aircraft->gvMotor2Label->setText("Rear motor");
|
||||
// m_aircraft->differentialSteeringMixBox->setHidden(true);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
//SHOULDN'T THIS BE DONE ONLY IN QUAD SETUP, AND NOT ALL THE REST???
|
||||
@ -1380,6 +673,7 @@ void ConfigVehicleTypeWidget::setupAirframeUI(QString frameType)
|
||||
setDirty(dirty);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Reset the contents of a field
|
||||
*/
|
||||
@ -1390,6 +684,7 @@ void ConfigVehicleTypeWidget::resetField(UAVObjectField * field)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Reset actuator values
|
||||
*/
|
||||
@ -1407,821 +702,6 @@ void ConfigVehicleTypeWidget::resetActuators()
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
///**
|
||||
// Setup Elevator/Aileron/Rudder airframe.
|
||||
//
|
||||
// If both Aileron channels are set to 'None' (EasyStar), do Pitch/Rudder mixing
|
||||
//
|
||||
// Returns False if impossible to create the mixer.
|
||||
// */
|
||||
//bool ConfigVehicleTypeWidget::setupFrameFixedWing()
|
||||
//{
|
||||
// // Check coherence:
|
||||
// // - At least Pitch and either Roll or Yaw
|
||||
// if (m_aircraft->fwEngineChannelBox->currentText() == "None" ||
|
||||
// m_aircraft->fwElevator1ChannelBox->currentText() == "None" ||
|
||||
// ((m_aircraft->fwAileron1ChannelBox->currentText() == "None") &&
|
||||
// (m_aircraft->fwRudder1ChannelBox->currentText() == "None"))) {
|
||||
// // TODO: explain the problem in the UI
|
||||
// m_aircraft->fwStatusLabel->setText("ERROR: check channel assignment");
|
||||
// return false;
|
||||
// }
|
||||
// // Now setup the channels:
|
||||
// resetActuators();
|
||||
//
|
||||
// UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorSettings")));
|
||||
// Q_ASSERT(obj);
|
||||
//
|
||||
// // Elevator
|
||||
// UAVObjectField *field = obj->getField("FixedWingPitch1");
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue(m_aircraft->fwElevator1ChannelBox->currentText());
|
||||
// field = obj->getField("FixedWingPitch2");
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue(m_aircraft->fwElevator2ChannelBox->currentText());
|
||||
// // Aileron
|
||||
// field = obj->getField("FixedWingRoll1");
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue(m_aircraft->fwAileron1ChannelBox->currentText());
|
||||
// field = obj->getField("FixedWingRoll2");
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue(m_aircraft->fwAileron2ChannelBox->currentText());
|
||||
// // Rudder
|
||||
// field = obj->getField("FixedWingYaw1");
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue(m_aircraft->fwRudder1ChannelBox->currentText());
|
||||
// // Throttle
|
||||
// field = obj->getField("FixedWingThrottle");
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue(m_aircraft->fwEngineChannelBox->currentText());
|
||||
//
|
||||
// obj->updated();
|
||||
//
|
||||
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// Q_ASSERT(obj);
|
||||
// // ... and compute the matrix:
|
||||
// // In order to make code a bit nicer, we assume:
|
||||
// // - ChannelBox dropdowns start with 'None', then 0 to 7
|
||||
//
|
||||
// // 1. Assign the servo/motor/none for each channel
|
||||
// // Disable all
|
||||
// foreach(QString mixer, mixerTypes) {
|
||||
// field = obj->getField(mixer);
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue("Disabled");
|
||||
// }
|
||||
// // and set only the relevant channels:
|
||||
// // Engine
|
||||
// int tmpVal = m_aircraft->fwEngineChannelBox->currentIndex()-1;
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Motor");
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// // First of all reset the vector
|
||||
// resetField(field);
|
||||
// int ti = field->getElementNames().indexOf("ThrottleCurve1");
|
||||
// field->setValue(127, ti);
|
||||
//
|
||||
// // Rudder
|
||||
// tmpVal = m_aircraft->fwRudder1ChannelBox->currentIndex()-1;
|
||||
// // tmpVal will be -1 if rudder is set to "None"
|
||||
// if (tmpVal > -1) {
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo");
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("Yaw");
|
||||
// field->setValue(127, ti);
|
||||
// } // Else: we have no rudder, only ailerons, we're fine with it.
|
||||
//
|
||||
// // Ailerons
|
||||
// tmpVal = m_aircraft->fwAileron1ChannelBox->currentIndex()-1;
|
||||
// if (tmpVal > -1) {
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo");
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("Roll");
|
||||
// field->setValue(127, ti);
|
||||
// // Only set Aileron 2 if Aileron 1 is defined
|
||||
// tmpVal = m_aircraft->fwAileron2ChannelBox->currentIndex()-1;
|
||||
// if (tmpVal > -1) {
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo");
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("Roll");
|
||||
// field->setValue(127, ti);
|
||||
// }
|
||||
// } // Else we have no ailerons. Our consistency check guarantees we have
|
||||
// // rudder in this case, so we're fine with it too.
|
||||
//
|
||||
// // Elevator
|
||||
// tmpVal = m_aircraft->fwElevator1ChannelBox->currentIndex()-1;
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo");
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("Pitch");
|
||||
// field->setValue(127, ti);
|
||||
// // Only set Elevator 2 if it is defined
|
||||
// tmpVal = m_aircraft->fwElevator2ChannelBox->currentIndex()-1;
|
||||
// if (tmpVal > -1) {
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo");
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("Pitch");
|
||||
// field->setValue(127, ti);
|
||||
// }
|
||||
//
|
||||
// obj->updated();
|
||||
// m_aircraft->fwStatusLabel->setText("Mixer generated");
|
||||
//
|
||||
// return true;
|
||||
//}
|
||||
//
|
||||
///**
|
||||
// Setup Elevon
|
||||
// */
|
||||
//bool ConfigVehicleTypeWidget::setupFrameElevon()
|
||||
//{
|
||||
// // Check coherence:
|
||||
// // - At least Aileron1 and Aileron 2, and engine
|
||||
// if (m_aircraft->fwEngineChannelBox->currentText() == "None" ||
|
||||
// m_aircraft->fwAileron1ChannelBox->currentText() == "None" ||
|
||||
// m_aircraft->fwAileron2ChannelBox->currentText() == "None") {
|
||||
// // TODO: explain the problem in the UI
|
||||
// m_aircraft->fwStatusLabel->setText("ERROR: check channel assignment");
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// resetActuators();
|
||||
// UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorSettings")));
|
||||
// Q_ASSERT(obj);
|
||||
//
|
||||
// // Elevons
|
||||
// UAVObjectField *field = obj->getField("FixedWingRoll1");
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue(m_aircraft->fwAileron1ChannelBox->currentText());
|
||||
// field = obj->getField("FixedWingRoll2");
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue(m_aircraft->fwAileron2ChannelBox->currentText());
|
||||
// // Rudder 1 (can be None)
|
||||
// field = obj->getField("FixedWingYaw1");
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue(m_aircraft->fwRudder1ChannelBox->currentText());
|
||||
// // Rudder 2 (can be None)
|
||||
// field = obj->getField("FixedWingYaw2");
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue(m_aircraft->fwRudder2ChannelBox->currentText());
|
||||
// // Throttle
|
||||
// field = obj->getField("FixedWingThrottle");
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue(m_aircraft->fwEngineChannelBox->currentText());
|
||||
//
|
||||
// obj->updated();
|
||||
//
|
||||
// // Save the curve:
|
||||
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// Q_ASSERT(obj);
|
||||
// // ... and compute the matrix:
|
||||
// // In order to make code a bit nicer, we assume:
|
||||
// // - ChannelBox dropdowns start with 'None', then 0 to 7
|
||||
//
|
||||
// // 1. Assign the servo/motor/none for each channel
|
||||
// // Disable all
|
||||
// foreach(QString mixer, mixerTypes) {
|
||||
// field = obj->getField(mixer);
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue("Disabled");
|
||||
// }
|
||||
// // and set only the relevant channels:
|
||||
// // Engine
|
||||
// int tmpVal = m_aircraft->fwEngineChannelBox->currentIndex()-1;
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Motor");
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// // First of all reset the vector
|
||||
// resetField(field);
|
||||
// int ti = field->getElementNames().indexOf("ThrottleCurve1");
|
||||
// field->setValue(127, ti);
|
||||
//
|
||||
// // Rudder 1
|
||||
// tmpVal = m_aircraft->fwRudder1ChannelBox->currentIndex()-1;
|
||||
// // tmpVal will be -1 if rudder 1 is set to "None"
|
||||
// if (tmpVal > -1) {
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo");
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("Yaw");
|
||||
// field->setValue(127, ti);
|
||||
// } // Else: we have no rudder, only elevons, we're fine with it.
|
||||
//
|
||||
// // Rudder 2
|
||||
// tmpVal = m_aircraft->fwRudder2ChannelBox->currentIndex()-1;
|
||||
// // tmpVal will be -1 if rudder 2 is set to "None"
|
||||
// if (tmpVal > -1) {
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo");
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("Yaw");
|
||||
// field->setValue(-127, ti);
|
||||
// } // Else: we have no rudder, only elevons, we're fine with it.
|
||||
//
|
||||
// tmpVal = m_aircraft->fwAileron1ChannelBox->currentIndex()-1;
|
||||
// if (tmpVal > -1) {
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo");
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("Pitch");
|
||||
// field->setValue((double)m_aircraft->elevonSlider2->value()*1.27, ti);
|
||||
// ti = field->getElementNames().indexOf("Roll");
|
||||
// field->setValue((double)m_aircraft->elevonSlider1->value()*1.27,ti);
|
||||
// }
|
||||
//
|
||||
// tmpVal = m_aircraft->fwAileron2ChannelBox->currentIndex()-1;
|
||||
// if (tmpVal > -1) {
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo");
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("Pitch");
|
||||
// field->setValue((double)m_aircraft->elevonSlider2->value()*1.27, ti);
|
||||
// ti = field->getElementNames().indexOf("Roll");
|
||||
// field->setValue(-(double)m_aircraft->elevonSlider1->value()*1.27,ti);
|
||||
// }
|
||||
//
|
||||
// obj->updated();
|
||||
// m_aircraft->fwStatusLabel->setText("Mixer generated");
|
||||
// return true;
|
||||
//}
|
||||
//
|
||||
//
|
||||
///**
|
||||
// Setup VTail
|
||||
// */
|
||||
//bool ConfigVehicleTypeWidget::setupFrameVtail()
|
||||
//{
|
||||
// // Check coherence:
|
||||
// // - At least Pitch1 and Pitch2, and engine
|
||||
// if (m_aircraft->fwEngineChannelBox->currentText() == "None" ||
|
||||
// m_aircraft->fwElevator1ChannelBox->currentText() == "None" ||
|
||||
// m_aircraft->fwElevator2ChannelBox->currentText() == "None") {
|
||||
// // TODO: explain the problem in the UI
|
||||
// m_aircraft->fwStatusLabel->setText("WARNING: check channel assignment");
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// resetActuators();
|
||||
// UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorSettings")));
|
||||
// Q_ASSERT(obj);
|
||||
//
|
||||
// // Elevons
|
||||
// UAVObjectField *field = obj->getField("FixedWingPitch1");
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue(m_aircraft->fwElevator1ChannelBox->currentText());
|
||||
// field = obj->getField("FixedWingPitch2");
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue(m_aircraft->fwElevator2ChannelBox->currentText());
|
||||
// field = obj->getField("FixedWingRoll1");
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue(m_aircraft->fwAileron1ChannelBox->currentText());
|
||||
// field = obj->getField("FixedWingRoll2");
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue(m_aircraft->fwAileron2ChannelBox->currentText());
|
||||
//
|
||||
// // Throttle
|
||||
// field = obj->getField("FixedWingThrottle");
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue(m_aircraft->fwEngineChannelBox->currentText());
|
||||
//
|
||||
// obj->updated();
|
||||
//
|
||||
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// Q_ASSERT(obj);
|
||||
// // ... and compute the matrix:
|
||||
// // In order to make code a bit nicer, we assume:
|
||||
// // - ChannelBox dropdowns start with 'None', then 0 to 7
|
||||
//
|
||||
// // 1. Assign the servo/motor/none for each channel
|
||||
// // Disable all
|
||||
// foreach(QString mixer, mixerTypes) {
|
||||
// field = obj->getField(mixer);
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue("Disabled");
|
||||
// }
|
||||
// // and set only the relevant channels:
|
||||
// // Engine
|
||||
// int tmpVal = m_aircraft->fwEngineChannelBox->currentIndex()-1;
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Motor");
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// // First of all reset the vector
|
||||
// resetField(field);
|
||||
// int ti = field->getElementNames().indexOf("ThrottleCurve1");
|
||||
// field->setValue(127, ti);
|
||||
//
|
||||
// tmpVal = m_aircraft->fwAileron1ChannelBox->currentIndex()-1;
|
||||
// if (tmpVal > -1) {
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo");
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("Roll");
|
||||
// field->setValue(127,ti);
|
||||
// }
|
||||
//
|
||||
// tmpVal = m_aircraft->fwAileron2ChannelBox->currentIndex()-1;
|
||||
// if (tmpVal > -1) {
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo");
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("Roll");
|
||||
// field->setValue(-127,ti);
|
||||
// }
|
||||
//
|
||||
// // Now compute the VTail
|
||||
// tmpVal = m_aircraft->fwElevator1ChannelBox->currentIndex()-1;
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo");
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("Pitch");
|
||||
// field->setValue((double)m_aircraft->elevonSlider2->value()*1.27, ti);
|
||||
// ti = field->getElementNames().indexOf("Yaw");
|
||||
// field->setValue((double)m_aircraft->elevonSlider1->value()*1.27,ti);
|
||||
//
|
||||
// tmpVal = m_aircraft->fwElevator2ChannelBox->currentIndex()-1;
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo");
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("Pitch");
|
||||
// field->setValue((double)m_aircraft->elevonSlider2->value()*1.27, ti);
|
||||
// ti = field->getElementNames().indexOf("Yaw");
|
||||
// field->setValue(-(double)m_aircraft->elevonSlider1->value()*1.27,ti);
|
||||
//
|
||||
// obj->updated();
|
||||
// m_aircraft->fwStatusLabel->setText("Mixer generated");
|
||||
// return true;
|
||||
//}
|
||||
|
||||
|
||||
///**
|
||||
// Setup steerable ground vehicle.
|
||||
//
|
||||
// If both Aileron channels are set to 'None' (EasyStar), do Pitch/Rudder mixing
|
||||
//
|
||||
// Returns False if impossible to create the mixer.
|
||||
// */
|
||||
//bool ConfigVehicleTypeWidget::setupGroundVehicle()
|
||||
//{
|
||||
// // Check coherence:
|
||||
// // - At least Pitch and either Roll or Yaw
|
||||
// if ((m_aircraft->gvMotor1ChannelBox->currentText() == "None" &&
|
||||
// m_aircraft->gvMotor2ChannelBox->currentText() == "None") ||
|
||||
// (m_aircraft->gvSteering1ChannelBox->currentText() == "None" &&
|
||||
// m_aircraft->gvSteering2ChannelBox->currentText() == "None")) {
|
||||
// // TODO: explain the problem in the UI
|
||||
// m_aircraft->gvStatusLabel->setText("<font color='red'>ERROR: check channel assignments</font>");
|
||||
// if(m_aircraft->gvMotor1ChannelBox->currentText() == "None" && m_aircraft->gvMotor2ChannelBox->currentText() == "None"){
|
||||
// m_aircraft->gvStatusLabel->setText("<font color='red'>ERROR: check motor channel assignment</font>");
|
||||
// m_aircraft->gvMotor1Label->setText("<font color='red'>" + m_aircraft->gvMotor1Label->text() + "</font>");
|
||||
// m_aircraft->gvMotor2Label->setText("<font color='red'>" + m_aircraft->gvMotor2Label->text() + "</font>");
|
||||
//
|
||||
// }
|
||||
// else{
|
||||
// QTextEdit* htmlText=new QTextEdit(m_aircraft->gvMotor1Label->text()); // HtmlText is any QString with html tags.
|
||||
// m_aircraft->gvMotor1Label->setText(htmlText->toPlainText());
|
||||
// delete htmlText;
|
||||
//
|
||||
// htmlText=new QTextEdit(m_aircraft->gvMotor2Label->text()); // HtmlText is any QString with html tags.
|
||||
// m_aircraft->gvMotor2Label->setText(htmlText->toPlainText());
|
||||
// }
|
||||
//
|
||||
// if (m_aircraft->gvSteering1ChannelBox->currentText() == "None" && m_aircraft->gvSteering2ChannelBox->currentText() == "None") {
|
||||
// m_aircraft->gvStatusLabel->setText("<font color='red'>ERROR: check steering channel assignment</font>");
|
||||
// m_aircraft->gvSteering1Label->setText("<font color='red'>" + m_aircraft->gvSteering1Label->text() + "</font>");
|
||||
// m_aircraft->gvSteering2Label->setText("<font color='red'>" + m_aircraft->gvSteering2Label->text() + "</font>");
|
||||
// }
|
||||
// else{
|
||||
// QTextEdit* htmlText=new QTextEdit(m_aircraft->gvSteering1Label->text()); // HtmlText is any QString with html tags.
|
||||
// m_aircraft->gvSteering1Label->setText(htmlText->toPlainText());
|
||||
// delete htmlText;
|
||||
//
|
||||
// htmlText=new QTextEdit(m_aircraft->gvSteering2Label->text()); // HtmlText is any QString with html tags.
|
||||
// m_aircraft->gvSteering2Label->setText(htmlText->toPlainText());
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
// else{
|
||||
//// m_aircraft->gvStatusLabel->setText("Mixer generated");
|
||||
// QTextEdit* htmlText=new QTextEdit(m_aircraft->gvSteering1Label->text()); // HtmlText is any QString with html tags.
|
||||
// m_aircraft->gvSteering1Label->setText(htmlText->toPlainText());
|
||||
// delete htmlText;
|
||||
//
|
||||
// htmlText=new QTextEdit(m_aircraft->gvSteering2Label->text()); // HtmlText is any QString with html tags.
|
||||
// m_aircraft->gvSteering2Label->setText(htmlText->toPlainText());
|
||||
// delete htmlText;
|
||||
//
|
||||
// htmlText=new QTextEdit(m_aircraft->gvMotor1Label->text()); // HtmlText is any QString with html tags.
|
||||
// m_aircraft->gvMotor1Label->setText(htmlText->toPlainText());
|
||||
// delete htmlText;
|
||||
//
|
||||
// htmlText=new QTextEdit(m_aircraft->gvMotor2Label->text()); // HtmlText is any QString with html tags.
|
||||
// m_aircraft->gvMotor2Label->setText(htmlText->toPlainText());
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
////#if 0
|
||||
// // Now setup the channels:
|
||||
// resetActuators();
|
||||
//
|
||||
// UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorSettings")));
|
||||
// Q_ASSERT(obj);
|
||||
//
|
||||
// // Elevator
|
||||
// UAVObjectField *field = obj->getField("FixedWingPitch1");
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue(m_aircraft->gvMotor1ChannelBox->currentText());
|
||||
// field = obj->getField("FixedWingPitch2");
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue(m_aircraft->gvMotor2ChannelBox->currentText());
|
||||
// // Aileron
|
||||
// field = obj->getField("FixedWingRoll1");
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue(m_aircraft->fwAileron1ChannelBox->currentText());
|
||||
// field = obj->getField("FixedWingRoll2");
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue(m_aircraft->fwAileron2ChannelBox->currentText());
|
||||
// // Rudder
|
||||
// field = obj->getField("FixedWingYaw1");
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue(m_aircraft->gvSteering1ChannelBox->currentText());
|
||||
// // Throttle
|
||||
// field = obj->getField("FixedWingThrottle");
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue(m_aircraft->gvSteering2ChannelBox->currentText());
|
||||
//
|
||||
// obj->updated();
|
||||
//
|
||||
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// Q_ASSERT(obj);
|
||||
// // ... and compute the matrix:
|
||||
// // In order to make code a bit nicer, we assume:
|
||||
// // - ChannelBox dropdowns start with 'None', then 0 to 7
|
||||
//
|
||||
// // 1. Assign the servo/motor/none for each channel
|
||||
// // Disable all
|
||||
// foreach(QString mixer, mixerTypes) {
|
||||
// field = obj->getField(mixer);
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue("Disabled");
|
||||
// }
|
||||
//
|
||||
// int tmpVal, ti;
|
||||
//#if 0
|
||||
// // and set only the relevant channels:
|
||||
// // Engine
|
||||
// tmpVal = m_aircraft->fwEngineChannelBox->currentIndex()-1;
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Motor");
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// // First of all reset the vector
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("ThrottleCurve1");
|
||||
// field->setValue(127, ti);
|
||||
//#endif
|
||||
// // Steering
|
||||
// tmpVal = m_aircraft->gvSteering1ChannelBox->currentIndex()-1;
|
||||
// // tmpVal will be -1 if steering is set to "None"
|
||||
// if (tmpVal > -1) {
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo");
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("Yaw");
|
||||
// field->setValue(127, ti);
|
||||
// } // Else: we have no rudder, only ailerons, we're fine with it.
|
||||
//
|
||||
//#if 0
|
||||
// // Ailerons
|
||||
// tmpVal = m_aircraft->fwAileron1ChannelBox->currentIndex()-1;
|
||||
// if (tmpVal > -1) {
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo");
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("Roll");
|
||||
// field->setValue(127, ti);
|
||||
// // Only set Aileron 2 if Aileron 1 is defined
|
||||
// tmpVal = m_aircraft->fwAileron2ChannelBox->currentIndex()-1;
|
||||
// if (tmpVal > -1) {
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo");
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("Roll");
|
||||
// field->setValue(127, ti);
|
||||
// }
|
||||
// } // Else we have no ailerons. Our consistency check guarantees we have
|
||||
// // rudder in this case, so we're fine with it too.
|
||||
//#endif
|
||||
//
|
||||
// // Motor
|
||||
// tmpVal = m_aircraft->gvMotor1ChannelBox->currentIndex()-1;
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo");
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("ThrottleCurve1");
|
||||
// field->setValue(127, ti);
|
||||
//
|
||||
// // Only set Motor 2 if it is defined
|
||||
// tmpVal = m_aircraft->gvMotor2ChannelBox->currentIndex()-1;
|
||||
// if (tmpVal > -1) {
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo");
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("ThrottleCurve2");
|
||||
// field->setValue(127, ti);
|
||||
// }
|
||||
//
|
||||
// obj->updated();
|
||||
////#endif
|
||||
// m_aircraft->gvStatusLabel->setText("Mixer generated");
|
||||
//
|
||||
// return true;
|
||||
//}
|
||||
|
||||
|
||||
/**
|
||||
Set up a complete mixer, taking a table of factors. The factors
|
||||
shoudl mainly be +/- 1 factors, since they will be weighted by the
|
||||
value of the Pitch/Roll/Yaw sliders.
|
||||
|
||||
Example:
|
||||
double xMixer [8][3] = {
|
||||
P R Y
|
||||
{ 1, 1, -1}, Motor 1
|
||||
{ 1, -1, 1}, Motor 2
|
||||
{-1, -1, -1}, Motor 3
|
||||
{-1, 1, 1}, ...
|
||||
{ 0, 0, 0},
|
||||
{ 0, 0, 0},
|
||||
{ 0, 0, 0},
|
||||
{ 0, 0, 0}
|
||||
};
|
||||
*/
|
||||
//bool ConfigVehicleTypeWidget::setupMultiRotorMixer(double mixerFactors[8][3])
|
||||
//{
|
||||
// qDebug()<<"Mixer factors";
|
||||
// qDebug()<<mixerFactors[0][0]<<" "<<mixerFactors[0][1]<<" "<<mixerFactors[0][2];
|
||||
// qDebug()<<mixerFactors[1][0]<<" "<<mixerFactors[1][1]<<" "<<mixerFactors[1][2];
|
||||
// qDebug()<<mixerFactors[2][0]<<" "<<mixerFactors[2][1]<<" "<<mixerFactors[2][2];
|
||||
// qDebug()<<mixerFactors[3][0]<<" "<<mixerFactors[3][1]<<" "<<mixerFactors[3][2];
|
||||
// qDebug()<<mixerFactors[4][0]<<" "<<mixerFactors[4][1]<<" "<<mixerFactors[4][2];
|
||||
// qDebug()<<mixerFactors[5][0]<<" "<<mixerFactors[5][1]<<" "<<mixerFactors[5][2];
|
||||
// qDebug()<<mixerFactors[6][0]<<" "<<mixerFactors[6][1]<<" "<<mixerFactors[6][2];
|
||||
// qDebug()<<mixerFactors[7][0]<<" "<<mixerFactors[7][1]<<" "<<mixerFactors[7][2];
|
||||
//
|
||||
// UAVObjectField *field;
|
||||
// QList<QComboBox*> mmList;
|
||||
// mmList << m_aircraft->multiMotorChannelBox1 << m_aircraft->multiMotorChannelBox2 << m_aircraft->multiMotorChannelBox3
|
||||
// << m_aircraft->multiMotorChannelBox4 << m_aircraft->multiMotorChannelBox5 << m_aircraft->multiMotorChannelBox6
|
||||
// << m_aircraft->multiMotorChannelBox7 << m_aircraft->multiMotorChannelBox8;
|
||||
// UAVDataObject *obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// // 1. Assign the servo/motor/none for each channel
|
||||
// // Disable all
|
||||
// foreach(QString mixer, mixerTypes) {
|
||||
// field = obj->getField(mixer);
|
||||
// Q_ASSERT(field);
|
||||
// field->setValue("Disabled");
|
||||
// }
|
||||
// // and enable only the relevant channels:
|
||||
// double pFactor = (double)m_aircraft->mrPitchMixLevel->value()/100;
|
||||
// double rFactor = (double)m_aircraft->mrRollMixLevel->value()/100;
|
||||
// double yFactor = (double)m_aircraft->mrYawMixLevel->value()/100;
|
||||
// qDebug()<<QString("pFactor=%0 rFactor=%1 yFactor=%2").arg(pFactor).arg(rFactor).arg(yFactor);
|
||||
// for (int i=0 ; i<8; i++) {
|
||||
// if(mmList.at(i)->isEnabled())
|
||||
// {
|
||||
// int channel = mmList.at(i)->currentIndex()-1;
|
||||
// if (channel > -1)
|
||||
// setupQuadMotor(channel, mixerFactors[i][0]*pFactor,
|
||||
// rFactor*mixerFactors[i][1], yFactor*mixerFactors[i][2]);
|
||||
// }
|
||||
// }
|
||||
//// obj->updated();
|
||||
// return true;
|
||||
//}
|
||||
|
||||
|
||||
///**
|
||||
// Helper function: setupQuadMotor
|
||||
// */
|
||||
//void ConfigVehicleTypeWidget::setupQuadMotor(int channel, double pitch, double roll, double yaw)
|
||||
//{
|
||||
// qDebug()<<QString("Setup quad motor channel=%0 pitch=%1 roll=%2 yaw=%3").arg(channel).arg(pitch).arg(roll).arg(yaw);
|
||||
// UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// Q_ASSERT(obj);
|
||||
// UAVObjectField *field = obj->getField(mixerTypes.at(channel));
|
||||
// field->setValue("Motor");
|
||||
// field = obj->getField(mixerVectors.at(channel));
|
||||
// // First of all reset the vector
|
||||
// resetField(field);
|
||||
// int ti = field->getElementNames().indexOf("ThrottleCurve1");
|
||||
// field->setValue(127, ti);
|
||||
// ti = field->getElementNames().indexOf("Roll");
|
||||
// field->setValue(roll*127,ti);
|
||||
// qDebug()<<"Set roll="<<roll*127;
|
||||
// ti = field->getElementNames().indexOf("Pitch");
|
||||
// field->setValue(pitch*127,ti);
|
||||
// qDebug()<<"Set pitch="<<pitch*127;
|
||||
// ti = field->getElementNames().indexOf("Yaw");
|
||||
// field->setValue(yaw*127,ti);
|
||||
// qDebug()<<"Set yaw="<<yaw*127;
|
||||
//}
|
||||
|
||||
///**
|
||||
// Helper function: setup motors. Takes a list of channel names in input.
|
||||
// */
|
||||
//void ConfigVehicleTypeWidget::setupMotors(QList<QString> motorList)
|
||||
//{
|
||||
// resetActuators();
|
||||
// UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorSettings")));
|
||||
// Q_ASSERT(obj);
|
||||
// UAVObjectField *field;
|
||||
// QList<QComboBox*> mmList;
|
||||
// mmList << m_aircraft->multiMotor1 << m_aircraft->multiMotor2 << m_aircraft->multiMotor3
|
||||
// << m_aircraft->multiMotor4 << m_aircraft->multiMotor5 << m_aircraft->multiMotor6
|
||||
// << m_aircraft->multiMotor7 << m_aircraft->multiMotor8;
|
||||
// foreach (QString motor, motorList) {
|
||||
// field = obj->getField(motor);
|
||||
// field->setValue(mmList.takeFirst()->currentText());
|
||||
// }
|
||||
// //obj->updated(); // Save...
|
||||
//}
|
||||
|
||||
|
||||
///**
|
||||
// Set up a Quad-X or Quad-P
|
||||
//*/
|
||||
//bool ConfigVehicleTypeWidget::setupQuad(bool pLayout)
|
||||
//{
|
||||
// // Check coherence:
|
||||
// // - Four engines have to be defined
|
||||
// if (m_aircraft->multiMotor1->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor2->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor3->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor4->currentText() == "None") {
|
||||
// m_aircraft->mrStatusLabel->setText("ERROR: Assign 4 motor channels");
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// QList<QString> motorList;
|
||||
// if (pLayout) {
|
||||
// motorList << "VTOLMotorN" << "VTOLMotorE" << "VTOLMotorS"
|
||||
// << "VTOLMotorW";
|
||||
// } else {
|
||||
// motorList << "VTOLMotorNW" << "VTOLMotorNE" << "VTOLMotorSE"
|
||||
// << "VTOLMotorSW";
|
||||
// }
|
||||
// setupMotors(motorList);
|
||||
//
|
||||
// // Now, setup the mixer:
|
||||
// // Motor 1 to 4, X Layout:
|
||||
// // pitch roll yaw
|
||||
// // {0.5 ,0.5 ,-0.5 //Front left motor (CW)
|
||||
// // {0.5 ,-0.5 ,0.5 //Front right motor(CCW)
|
||||
// // {-0.5 ,-0.5 ,-0.5 //rear right motor (CW)
|
||||
// // {-0.5 ,0.5 ,0.5 //Rear left motor (CCW)
|
||||
// double xMixer [8][3] = {
|
||||
// { 1, 1, -1},
|
||||
// { 1, -1, 1},
|
||||
// {-1, -1, -1},
|
||||
// {-1, 1, 1},
|
||||
// { 0, 0, 0},
|
||||
// { 0, 0, 0},
|
||||
// { 0, 0, 0},
|
||||
// { 0, 0, 0}
|
||||
// };
|
||||
// //
|
||||
// // Motor 1 to 4, P Layout:
|
||||
// // pitch roll yaw
|
||||
// // {1 ,0 ,-0.5 //Front motor (CW)
|
||||
// // {0 ,-1 ,0.5 //Right motor(CCW)
|
||||
// // {-1 ,0 ,-0.5 //Rear motor (CW)
|
||||
// // {0 ,1 ,0.5 //Left motor (CCW)
|
||||
// double pMixer [8][3] = {
|
||||
// { 1, 0, -1},
|
||||
// { 0, -1, 1},
|
||||
// {-1, 0, -1},
|
||||
// { 0, 1, 1},
|
||||
// { 0, 0, 0},
|
||||
// { 0, 0, 0},
|
||||
// { 0, 0, 0},
|
||||
// { 0, 0, 0}
|
||||
// };
|
||||
//
|
||||
// if (pLayout) {
|
||||
// setupMultiRotorMixer(pMixer);
|
||||
// } else {
|
||||
// setupMultiRotorMixer(xMixer);
|
||||
// }
|
||||
// m_aircraft->mrStatusLabel->setText("SUCCESS: Mixer Saved OK");
|
||||
// return true;
|
||||
//}
|
||||
//
|
||||
//
|
||||
//
|
||||
///**
|
||||
// Set up a Hexa-X or Hexa-P
|
||||
//*/
|
||||
//bool ConfigVehicleTypeWidget::setupHexa(bool pLayout)
|
||||
//{
|
||||
// // Check coherence:
|
||||
// // - Four engines have to be defined
|
||||
// if (m_aircraft->multiMotor1->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor2->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor3->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor4->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor5->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor6->currentText() == "None") {
|
||||
// m_aircraft->mrStatusLabel->setText("ERROR: Assign 6 motor channels");
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// QList<QString> motorList;
|
||||
// if (pLayout) {
|
||||
// motorList << "VTOLMotorN" << "VTOLMotorNE" << "VTOLMotorSE"
|
||||
// << "VTOLMotorS" << "VTOLMotorSW" << "VTOLMotorNW";
|
||||
// } else {
|
||||
// motorList << "VTOLMotorNE" << "VTOLMotorE" << "VTOLMotorSE"
|
||||
// << "VTOLMotorSW" << "VTOLMotorW" << "VTOLMotorNW";
|
||||
// }
|
||||
// setupMotors(motorList);
|
||||
//
|
||||
// // and set only the relevant channels:
|
||||
//
|
||||
// // Motor 1 to 6, P Layout:
|
||||
// // pitch roll yaw
|
||||
// // 1 { 0.3 , 0 ,-0.3 // N CW
|
||||
// // 2 { 0.3 ,-0.5 , 0.3 // NE CCW
|
||||
// // 3 {-0.3 ,-0.5 ,-0.3 // SE CW
|
||||
// // 4 {-0.3 , 0 , 0.3 // S CCW
|
||||
// // 5 {-0.3 , 0.5 ,-0.3 // SW CW
|
||||
// // 6 { 0.3 , 0.5 , 0.3 // NW CCW
|
||||
//
|
||||
// double pMixer [8][3] = {
|
||||
// { 1, 0, -1},
|
||||
// { 1, -1, 1},
|
||||
// {-1, -1, -1},
|
||||
// {-1, 0, 1},
|
||||
// {-1, 1, -1},
|
||||
// { 1, 1, 1},
|
||||
// { 0, 0, 0},
|
||||
// { 0, 0, 0}
|
||||
// };
|
||||
//
|
||||
// //
|
||||
// // Motor 1 to 6, X Layout:
|
||||
// // 1 [ 0.5, -0.3, -0.3 ] NE
|
||||
// // 2 [ 0 , -0.3, 0.3 ] E
|
||||
// // 3 [ -0.5, -0.3, -0.3 ] SE
|
||||
// // 4 [ -0.5, 0.3, 0.3 ] SW
|
||||
// // 5 [ 0 , 0.3, -0.3 ] W
|
||||
// // 6 [ 0.5, 0.3, 0.3 ] NW
|
||||
// double xMixer [8][3] = {
|
||||
// { 1, -1, -1},
|
||||
// { 0, -1, 1},
|
||||
// { -1, -1, -1},
|
||||
// { -1, 1, 1},
|
||||
// { 0, 1, -1},
|
||||
// { 1, 1, 1},
|
||||
// { 0, 0, 0},
|
||||
// { 0, 0, 0}
|
||||
// };
|
||||
//
|
||||
// if (pLayout) {
|
||||
// setupMultiRotorMixer(pMixer);
|
||||
// } else {
|
||||
// setupMultiRotorMixer(xMixer);
|
||||
// }
|
||||
// m_aircraft->mrStatusLabel->setText("SUCCESS: Mixer Saved OK");
|
||||
// return true;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -2299,320 +779,15 @@ void ConfigVehicleTypeWidget::updateObjectsFromWidgets()
|
||||
qDebug()<<"updateObjectsFromWidgets";
|
||||
QString airframeType = "Custom"; //Sets airframe type default to "Custom"
|
||||
if (m_aircraft->aircraftType->currentText() == "Fixed Wing") {
|
||||
if(1){
|
||||
airframeType = updateFixedWingObjectsFromWidgets();
|
||||
}
|
||||
else{
|
||||
// // Save the curve (common to all Fixed wing frames)
|
||||
// UAVDataObject *obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// // Remove Feed Forward, it is pointless on a plane:
|
||||
// UAVObjectField* field = obj->getField(QString("FeedForward"));
|
||||
// field->setDouble(0);
|
||||
// field = obj->getField("ThrottleCurve1");
|
||||
// QList<double> curve = m_aircraft->fixedWingThrottle->getCurve();
|
||||
// for (int i=0;i<curve.length();i++) {
|
||||
// field->setValue(curve.at(i),i);
|
||||
// }
|
||||
//
|
||||
// if (m_aircraft->fixedWingType->currentText() == "Elevator aileron rudder" ) {
|
||||
// airframeType = "FixedWing";
|
||||
// setupFrameFixedWing();
|
||||
// } else if (m_aircraft->fixedWingType->currentText() == "Elevon") {
|
||||
// airframeType = "FixedWingElevon";
|
||||
// setupFrameElevon();
|
||||
// } else { // "Vtail"
|
||||
// airframeType = "FixedWingVtail";
|
||||
// setupFrameVtail();
|
||||
// }
|
||||
// // Now reflect those settings in the "Custom" panel as well
|
||||
// updateCustomAirframeUI();
|
||||
}
|
||||
} else if (m_aircraft->aircraftType->currentText() == "Multirotor") {
|
||||
|
||||
airframeType = updateFixedWingObjectsFromWidgets();
|
||||
} else if (m_aircraft->aircraftType->currentText() == "Multirotor") {
|
||||
//update the mixer
|
||||
if(1){
|
||||
airframeType = updateMultiRotorObjectsFromWidgets();
|
||||
}
|
||||
else{
|
||||
//
|
||||
// QList<QString> motorList;
|
||||
//
|
||||
// // We can already setup the feedforward here, as it is common to all platforms
|
||||
// UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// UAVObjectField* field = obj->getField(QString("FeedForward"));
|
||||
// field->setDouble((double)m_aircraft->feedForwardSlider->value()/100);
|
||||
// field = obj->getField(QString("AccelTime"));
|
||||
// field->setDouble(m_aircraft->accelTime->value());
|
||||
// field = obj->getField(QString("DecelTime"));
|
||||
// field->setDouble(m_aircraft->decelTime->value());
|
||||
// field = obj->getField(QString("MaxAccel"));
|
||||
// field->setDouble(m_aircraft->maxAccelSlider->value());
|
||||
//
|
||||
// // Curve is also common to all quads:
|
||||
// field = obj->getField("ThrottleCurve1");
|
||||
// QList<double> curve = m_aircraft->multiThrottleCurve->getCurve();
|
||||
// for (int i=0;i<curve.length();i++) {
|
||||
// field->setValue(curve.at(i),i);
|
||||
// }
|
||||
//
|
||||
// if (m_aircraft->multirotorFrameType->currentText() == "Quad +") {
|
||||
// airframeType = "QuadP";
|
||||
// setupQuad(true);
|
||||
// } else if (m_aircraft->multirotorFrameType->currentText() == "Quad X") {
|
||||
// airframeType = "QuadX";
|
||||
// setupQuad(false);
|
||||
// } else if (m_aircraft->multirotorFrameType->currentText() == "Hexacopter") {
|
||||
// airframeType = "Hexa";
|
||||
// setupHexa(true);
|
||||
// } else if (m_aircraft->multirotorFrameType->currentText() == "Octocopter") {
|
||||
// airframeType = "Octo";
|
||||
// if (m_aircraft->multiMotor1->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor2->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor3->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor4->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor5->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor6->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor7->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor8->currentText() == "None") {
|
||||
// m_aircraft->mrStatusLabel->setText("ERROR: Assign 8 motor channels");
|
||||
// return;
|
||||
// }
|
||||
// motorList << "VTOLMotorN" << "VTOLMotorNE" << "VTOLMotorE" << "VTOLMotorSE"
|
||||
// << "VTOLMotorS" << "VTOLMotorSW" << "VTOLMotorW" << "VTOLMotorNW";
|
||||
// setupMotors(motorList);
|
||||
// // Motor 1 to 8:
|
||||
// // pitch roll yaw
|
||||
// double mixer [8][3] = {
|
||||
// { 1, 0, -1},
|
||||
// { 1, -1, 1},
|
||||
// { 0, -1, -1},
|
||||
// { -1, -1, 1},
|
||||
// { -1, 0, -1},
|
||||
// { -1, 1, 1},
|
||||
// { 0, 1, -1},
|
||||
// { 1, 1, 1}
|
||||
// };
|
||||
// setupMultiRotorMixer(mixer);
|
||||
// m_aircraft->mrStatusLabel->setText("SUCCESS: Mixer Saved OK");
|
||||
//
|
||||
// } else if (m_aircraft->multirotorFrameType->currentText() == "Hexacopter X") {
|
||||
// airframeType = "HexaX";
|
||||
// setupHexa(false);
|
||||
// } else if (m_aircraft->multirotorFrameType->currentText() == "Octocopter V") {
|
||||
// airframeType = "OctoV";
|
||||
// if (m_aircraft->multiMotor1->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor2->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor3->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor4->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor5->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor6->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor7->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor8->currentText() == "None") {
|
||||
// m_aircraft->mrStatusLabel->setText("ERROR: Assign 8 motor channels");
|
||||
// return;
|
||||
// }
|
||||
// motorList << "VTOLMotorN" << "VTOLMotorNE" << "VTOLMotorE" << "VTOLMotorSE"
|
||||
// << "VTOLMotorS" << "VTOLMotorSW" << "VTOLMotorW" << "VTOLMotorNW";
|
||||
// setupMotors(motorList);
|
||||
// // Motor 1 to 8:
|
||||
// // IMPORTANT: Assumes evenly spaced engines
|
||||
// // pitch roll yaw
|
||||
// double mixer [8][3] = {
|
||||
// { 0.33, -1, -1},
|
||||
// { 1 , -1, 1},
|
||||
// { -1 , -1, -1},
|
||||
// { -0.33, -1, 1},
|
||||
// { -0.33, 1, -1},
|
||||
// { -1 , 1, 1},
|
||||
// { 1 , 1, -1},
|
||||
// { 0.33, 1, 1}
|
||||
// };
|
||||
// setupMultiRotorMixer(mixer);
|
||||
// m_aircraft->mrStatusLabel->setText("SUCCESS: Mixer Saved OK");
|
||||
//
|
||||
// } else if (m_aircraft->multirotorFrameType->currentText() == "Octo Coax +") {
|
||||
// airframeType = "OctoCoaxP";
|
||||
// if (m_aircraft->multiMotor1->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor2->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor3->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor4->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor5->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor6->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor7->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor8->currentText() == "None") {
|
||||
// m_aircraft->mrStatusLabel->setText("ERROR: Assign 8 motor channels");
|
||||
// return;
|
||||
// }
|
||||
// motorList << "VTOLMotorN" << "VTOLMotorNE" << "VTOLMotorE" << "VTOLMotorSE"
|
||||
// << "VTOLMotorS" << "VTOLMotorSW" << "VTOLMotorW" << "VTOLMotorNW";
|
||||
// setupMotors(motorList);
|
||||
// // Motor 1 to 8:
|
||||
// // pitch roll yaw
|
||||
// double mixer [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}
|
||||
// };
|
||||
// setupMultiRotorMixer(mixer);
|
||||
// m_aircraft->mrStatusLabel->setText("SUCCESS: Mixer Saved OK");
|
||||
//
|
||||
// } else if (m_aircraft->multirotorFrameType->currentText() == "Octo Coax X") {
|
||||
// airframeType = "OctoCoaxX";
|
||||
// if (m_aircraft->multiMotor1->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor2->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor3->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor4->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor5->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor6->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor7->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor8->currentText() == "None") {
|
||||
// m_aircraft->mrStatusLabel->setText("ERROR: Assign 8 motor channels");
|
||||
// return;
|
||||
// }
|
||||
// motorList << "VTOLMotorNW" << "VTOLMotorN" << "VTOLMotorNE" << "VTOLMotorE"
|
||||
// << "VTOLMotorSE" << "VTOLMotorS" << "VTOLMotorSW" << "VTOLMotorW";
|
||||
// setupMotors(motorList);
|
||||
// // Motor 1 to 8:
|
||||
// // pitch roll yaw
|
||||
// double mixer [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}
|
||||
// };
|
||||
// setupMultiRotorMixer(mixer);
|
||||
// m_aircraft->mrStatusLabel->setText("SUCCESS: Mixer Saved OK");
|
||||
//
|
||||
// } else if (m_aircraft->multirotorFrameType->currentText() == "Hexacopter Y6") {
|
||||
// airframeType = "HexaCoax";
|
||||
// if (m_aircraft->multiMotor1->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor2->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor3->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor4->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor5->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor6->currentText() == "None" ) {
|
||||
// m_aircraft->mrStatusLabel->setText("ERROR: Assign 6 motor channels");
|
||||
// return;
|
||||
// }
|
||||
// motorList << "VTOLMotorNW" << "VTOLMotorW" << "VTOLMotorNE" << "VTOLMotorE"
|
||||
// << "VTOLMotorS" << "VTOLMotorSE";
|
||||
// setupMotors(motorList);
|
||||
//
|
||||
// // Motor 1 to 6, Y6 Layout:
|
||||
// // pitch roll yaw
|
||||
// double mixer [8][3] = {
|
||||
// { 0.5, 1, -1},
|
||||
// { 0.5, 1, 1},
|
||||
// { 0.5, -1, -1},
|
||||
// { 0.5, -1, 1},
|
||||
// { -1, 0, -1},
|
||||
// { -1, 0, 1},
|
||||
// { 0, 0, 0},
|
||||
// { 0, 0, 0}
|
||||
// };
|
||||
// setupMultiRotorMixer(mixer);
|
||||
// m_aircraft->mrStatusLabel->setText("SUCCESS: Mixer Saved OK");
|
||||
//
|
||||
// } else if (m_aircraft->multirotorFrameType->currentText() == "Tricopter Y") {
|
||||
// airframeType = "Tri";
|
||||
// if (m_aircraft->multiMotor1->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor2->currentText() == "None" ||
|
||||
// m_aircraft->multiMotor3->currentText() == "None" ) {
|
||||
// m_aircraft->mrStatusLabel->setText("ERROR: Assign 3 motor channels");
|
||||
// return;
|
||||
// }
|
||||
// if (m_aircraft->triYawChannelBoxBox->currentText() == "None") {
|
||||
// m_aircraft->mrStatusLabel->setText("Error: Assign a Yaw channel");
|
||||
// return;
|
||||
// }
|
||||
// motorList << "VTOLMotorNW" << "VTOLMotorNE" << "VTOLMotorS";
|
||||
// setupMotors(motorList);
|
||||
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorSettings")));
|
||||
// Q_ASSERT(obj);
|
||||
// field = obj->getField("FixedWingYaw1");
|
||||
// field->setValue(m_aircraft->triYawChannelBoxBox->currentText());
|
||||
//
|
||||
// // Motor 1 to 6, Y6 Layout:
|
||||
// // pitch roll yaw
|
||||
// double mixer [8][3] = {
|
||||
// { 0.5, 1, 0},
|
||||
// { 0.5, -1, 0},
|
||||
// { -1, 0, 0},
|
||||
// { 0, 0, 0},
|
||||
// { 0, 0, 0},
|
||||
// { 0, 0, 0},
|
||||
// { 0, 0, 0},
|
||||
// { 0, 0, 0}
|
||||
// };
|
||||
// setupMultiRotorMixer(mixer);
|
||||
//
|
||||
// int tmpVal = m_aircraft->triYawChannelBoxBox->currentIndex()-1;
|
||||
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo");
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// int ti = field->getElementNames().indexOf("Yaw");
|
||||
// field->setValue(127,ti);
|
||||
//
|
||||
// m_aircraft->mrStatusLabel->setText("SUCCESS: Mixer Saved OK");
|
||||
//
|
||||
// }
|
||||
// // Now reflect those settings in the "Custom" panel as well
|
||||
// updateCustomAirframeUI();
|
||||
}
|
||||
|
||||
} else if (m_aircraft->aircraftType->currentText() == "Helicopter") {
|
||||
} else if (m_aircraft->aircraftType->currentText() == "Helicopter") {
|
||||
airframeType = "HeliCP";
|
||||
m_aircraft->widget_3->sendccpmUpdate();
|
||||
} else if (m_aircraft->aircraftType->currentText() == "Ground") {
|
||||
if(1){
|
||||
} else if (m_aircraft->aircraftType->currentText() == "Ground") {
|
||||
airframeType = updateGroundVehicleObjectsFromWidgets();
|
||||
}
|
||||
else{
|
||||
// airframeType = "Ground";
|
||||
// // Save the curve (common to all ground vehicle frames)
|
||||
// UAVDataObject *obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// UAVObjectField* field;
|
||||
//
|
||||
// if (0){ //DON'T REMOVE FEEDFORWARD
|
||||
// // Remove Feed Forward, it is pointless on a plane:
|
||||
// field = obj->getField(QString("FeedForward"));
|
||||
// field->setDouble(0);
|
||||
// }
|
||||
//
|
||||
// field = obj->getField("ThrottleCurve1");
|
||||
// QList<double> curve = m_aircraft->groundVehicleThrottle->getCurve();
|
||||
// for (int i=0;i<curve.length();i++) {
|
||||
// field->setValue(curve.at(i),i);
|
||||
// }
|
||||
//
|
||||
// if (m_aircraft->groundVehicleType->currentText() == "Turnable (car)" ) {
|
||||
// airframeType = "GroundVehicleCar";
|
||||
// setupGroundVehicle();
|
||||
// } else if (m_aircraft->groundVehicleType->currentText() == "Differential (tank)") {
|
||||
// airframeType = "GroundVehicleDifferential";
|
||||
// setupGroundVehicle();
|
||||
// } else { // "Motorcycle"
|
||||
// airframeType = "GroundVehicleMotorcycle";
|
||||
// setupGroundVehicle();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // Now reflect those settings in the "Custom" panel as well
|
||||
// updateCustomAirframeUI();
|
||||
//
|
||||
//// m_aircraft->widget_3->sendccpmUpdate();
|
||||
}
|
||||
} else {
|
||||
airframeType = "Custom";
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
******************************************************************************
|
||||
*
|
||||
* @file configairframetwidget.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup ConfigPlugin Config Plugin
|
||||
|
Loading…
x
Reference in New Issue
Block a user