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

add gui config data bit storage to fixedwing,multirotor,ground vehicles

This commit is contained in:
Mike LaBranche 2012-05-14 10:05:40 -07:00
parent 5e07e742ef
commit ed54716436
10 changed files with 428 additions and 433 deletions

View File

@ -25,7 +25,7 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "configccpmwidget.h" #include "configccpmwidget.h"
#include "mixersettings.h" //#include "mixersettings.h"
#include <QDebug> #include <QDebug>
#include <QStringList> #include <QStringList>
@ -892,7 +892,7 @@ void ConfigccpmWidget::UpdateMixer()
} }
} }
if (GUIConfigData.heli.SwasplateType>0) if (GUIConfigData.heli.SwashplateType>0)
{//not advanced settings {//not advanced settings
//get the channel data from the ui //get the channel data from the ui
MixerChannelData[0] = m_ccpm->ccpmEngineChannel->currentIndex(); MixerChannelData[0] = m_ccpm->ccpmEngineChannel->currentIndex();
@ -999,7 +999,7 @@ void ConfigccpmWidget::UpdateCCPMOptionsFromUI()
if (updatingFromHardware) return; if (updatingFromHardware) return;
//get the user options //get the user options
//swashplate config //swashplate config
GUIConfigData.heli.SwasplateType = m_ccpm->ccpmType->count() - m_ccpm->ccpmType->currentIndex()-1; GUIConfigData.heli.SwashplateType = m_ccpm->ccpmType->count() - m_ccpm->ccpmType->currentIndex()-1;
GUIConfigData.heli.FirstServoIndex = m_ccpm->ccpmSingleServo->currentIndex(); GUIConfigData.heli.FirstServoIndex = m_ccpm->ccpmSingleServo->currentIndex();
//ccpm mixing options //ccpm mixing options
@ -1036,12 +1036,17 @@ void ConfigccpmWidget::UpdateCCPMOptionsFromUI()
GUIConfigData.heli.ServoIndexX = m_ccpm->ccpmServoXChannel->currentIndex(); GUIConfigData.heli.ServoIndexX = m_ccpm->ccpmServoXChannel->currentIndex();
GUIConfigData.heli.ServoIndexY = m_ccpm->ccpmServoYChannel->currentIndex(); GUIConfigData.heli.ServoIndexY = m_ccpm->ccpmServoYChannel->currentIndex();
GUIConfigData.heli.ServoIndexZ = m_ccpm->ccpmServoZChannel->currentIndex(); GUIConfigData.heli.ServoIndexZ = m_ccpm->ccpmServoZChannel->currentIndex();
//throttle
GUIConfigData.heli.Throttle = m_ccpm->ccpmEngineChannel->currentIndex();
//tail
GUIConfigData.heli.Tail = m_ccpm->ccpmTailChannel->currentIndex();
} }
void ConfigccpmWidget::UpdateCCPMUIFromOptions() void ConfigccpmWidget::UpdateCCPMUIFromOptions()
{ {
//swashplate config //swashplate config
m_ccpm->ccpmType->setCurrentIndex(m_ccpm->ccpmType->count() - (GUIConfigData.heli.SwasplateType +1)); m_ccpm->ccpmType->setCurrentIndex(m_ccpm->ccpmType->count() - (GUIConfigData.heli.SwashplateType +1));
m_ccpm->ccpmSingleServo->setCurrentIndex(GUIConfigData.heli.FirstServoIndex); m_ccpm->ccpmSingleServo->setCurrentIndex(GUIConfigData.heli.FirstServoIndex);
//ccpm mixing options //ccpm mixing options
@ -1070,6 +1075,10 @@ void ConfigccpmWidget::UpdateCCPMUIFromOptions()
m_ccpm->ccpmServoYChannel->setCurrentIndex(GUIConfigData.heli.ServoIndexY); m_ccpm->ccpmServoYChannel->setCurrentIndex(GUIConfigData.heli.ServoIndexY);
m_ccpm->ccpmServoZChannel->setCurrentIndex(GUIConfigData.heli.ServoIndexZ); m_ccpm->ccpmServoZChannel->setCurrentIndex(GUIConfigData.heli.ServoIndexZ);
//throttle
m_ccpm->ccpmEngineChannel->setCurrentIndex(GUIConfigData.heli.Throttle);
//tail
m_ccpm->ccpmTailChannel->setCurrentIndex((GUIConfigData.heli.Tail));
} }
@ -1117,15 +1126,17 @@ void ConfigccpmWidget::requestccpmUpdate()
unsigned int i,j; unsigned int i,j;
SystemSettings * systemSettings = SystemSettings::GetInstance(getObjectManager()); // SystemSettings * systemSettings = SystemSettings::GetInstance(getObjectManager());
Q_ASSERT(systemSettings); // Q_ASSERT(systemSettings);
SystemSettings::DataFields systemSettingsData = systemSettings->getData(); // SystemSettings::DataFields systemSettingsData = systemSettings->getData();
Q_ASSERT(SystemSettings::GUICONFIGDATA_NUMELEM == // Q_ASSERT(SystemSettings::GUICONFIGDATA_NUMELEM ==
(sizeof(GUIConfigData.UAVObject) / sizeof(GUIConfigData.UAVObject[0]))); // (sizeof(GUIConfigData.UAVObject) / sizeof(GUIConfigData.UAVObject[0])));
for(i = 0; i < SystemSettings::GUICONFIGDATA_NUMELEM; i++) // for(i = 0; i < SystemSettings::GUICONFIGDATA_NUMELEM; i++)
GUIConfigData.UAVObject[i]=systemSettingsData.GUIConfigData[i]; // GUIConfigData.UAVObject[i]=systemSettingsData.GUIConfigData[i];
GUIConfigData = GUIManager.GetConfigData();
UpdateCCPMUIFromOptions(); UpdateCCPMUIFromOptions();
@ -1178,7 +1189,7 @@ void ConfigccpmWidget::requestccpmUpdate()
(MixerDataFromHeli[i][4]==0))//Yaw (MixerDataFromHeli[i][4]==0))//Yaw
{ {
EngineChannel = i; EngineChannel = i;
m_ccpm->ccpmEngineChannel->setCurrentIndex(i); //m_ccpm->ccpmEngineChannel->setCurrentIndex(i);
} }
//check if this is the tail rotor... REVO and YAW //check if this is the tail rotor... REVO and YAW
@ -1190,7 +1201,7 @@ void ConfigccpmWidget::requestccpmUpdate()
(MixerDataFromHeli[i][4]!=0))//Yaw (MixerDataFromHeli[i][4]!=0))//Yaw
{ {
TailRotorChannel = i; TailRotorChannel = i;
m_ccpm->ccpmTailChannel->setCurrentIndex(i); //m_ccpm->ccpmTailChannel->setCurrentIndex(i);
m_ccpm->ccpmRevoSlider->setValue((MixerDataFromHeli[i][0]*100)/127); m_ccpm->ccpmRevoSlider->setValue((MixerDataFromHeli[i][0]*100)/127);
m_ccpm->ccpmREVOspinBox->setValue((MixerDataFromHeli[i][0]*100)/127); m_ccpm->ccpmREVOspinBox->setValue((MixerDataFromHeli[i][0]*100)/127);
} }
@ -1239,14 +1250,17 @@ void ConfigccpmWidget::sendccpmUpdate()
UpdateCCPMOptionsFromUI(); UpdateCCPMOptionsFromUI();
GUIManager.SetConfigData(GUIConfigData);
// Store the data required to reconstruct // Store the data required to reconstruct
SystemSettings * systemSettings = SystemSettings::GetInstance(getObjectManager()); // SystemSettings * systemSettings = SystemSettings::GetInstance(getObjectManager());
Q_ASSERT(systemSettings); // Q_ASSERT(systemSettings);
SystemSettings::DataFields systemSettingsData = systemSettings->getData(); // SystemSettings::DataFields systemSettingsData = systemSettings->getData();
systemSettingsData.GUIConfigData[0] = GUIConfigData.UAVObject[0]; // for (i=0; i<SystemSettings::GUICONFIGDATA_NUMELEM; i++)
systemSettingsData.GUIConfigData[1] = GUIConfigData.UAVObject[1]; // systemSettingsData.GUIConfigData[i] = GUIConfigData.UAVObject[i];
systemSettings->setData(systemSettingsData);
systemSettings->updated(); // systemSettings->setData(systemSettingsData);
// systemSettings->updated();
MixerSettings * mixerSettings = MixerSettings::GetInstance(getObjectManager()); MixerSettings * mixerSettings = MixerSettings::GetInstance(getObjectManager());
Q_ASSERT(mixerSettings); Q_ASSERT(mixerSettings);

View File

@ -29,6 +29,7 @@
#include "ui_ccpm.h" #include "ui_ccpm.h"
#include "../uavobjectwidgetutils/configtaskwidget.h" #include "../uavobjectwidgetutils/configtaskwidget.h"
#include "guiconfigdata.h"
#include "extensionsystem/pluginmanager.h" #include "extensionsystem/pluginmanager.h"
#include "uavobjectmanager.h" #include "uavobjectmanager.h"
#include "uavobject.h" #include "uavobject.h"
@ -49,29 +50,31 @@ typedef struct {
int Neutral[CCPM_MAX_SWASH_SERVOS]; int Neutral[CCPM_MAX_SWASH_SERVOS];
int Min[CCPM_MAX_SWASH_SERVOS]; int Min[CCPM_MAX_SWASH_SERVOS];
} SwashplateServoSettingsStruct; } SwashplateServoSettingsStruct;
//typedef struct {
// uint SwasplateType:3;
// uint FirstServoIndex:2;
// uint CorrectionAngle:9;
// uint ccpmCollectivePassthroughState:1;
// uint ccpmLinkCyclicState:1;
// uint ccpmLinkRollState:1;
// uint SliderValue0:7;
// uint SliderValue1:7;
// uint SliderValue2:7;//41bits
// uint ServoIndexW:4;
// uint ServoIndexX:4;
// uint ServoIndexY:4;
// uint ServoIndexZ:4;//57bits
// uint Throttle:4;
// uint Tail:4; //65bits
// quint32 padding1:31; //96bits
// quint32 padding2; //128bits
//} __attribute__((packed)) heliGUISettingsStruct;
typedef struct { //typedef union
uint SwasplateType:3; //{
uint FirstServoIndex:2; // uint UAVObject[4];//32bits * 4
uint CorrectionAngle:9; // heliGUISettingsStruct heli;//128bits
uint ccpmCollectivePassthroughState:1; //} GUIConfigDataUnion;
uint ccpmLinkCyclicState:1;
uint ccpmLinkRollState:1;
uint SliderValue0:7;
uint SliderValue1:7;
uint SliderValue2:7;//41bits
uint ServoIndexW:4;
uint ServoIndexX:4;
uint ServoIndexY:4;
uint ServoIndexZ:4;//57bits
uint padding:7;
} __attribute__((packed)) heliGUISettingsStruct;
typedef union
{
uint UAVObject[2];//32bits * 2
heliGUISettingsStruct heli;//64bits
} GUIConfigDataUnion;
class ConfigccpmWidget: public ConfigTaskWidget class ConfigccpmWidget: public ConfigTaskWidget
{ {
@ -109,6 +112,7 @@ private:
SwashplateServoSettingsStruct oldSwashLvlConfiguration; SwashplateServoSettingsStruct oldSwashLvlConfiguration;
SwashplateServoSettingsStruct newSwashLvlConfiguration; SwashplateServoSettingsStruct newSwashLvlConfiguration;
GUIConfigDataManager GUIManager;
GUIConfigDataUnion GUIConfigData; GUIConfigDataUnion GUIConfigData;
int MixerChannelData[6]; int MixerChannelData[6];

View File

@ -136,7 +136,7 @@ QString ConfigVehicleTypeWidget::updateFixedWingObjectsFromWidgets()
//All airframe types must start with "FixedWing" //All airframe types must start with "FixedWing"
if (m_aircraft->fixedWingType->currentText() == "Elevator aileron rudder" ) { if (m_aircraft->fixedWingType->currentText() == "Elevator aileron rudder" ) {
airframeType = "FixedWing"; airframeType = "FixedWing";
setupFrameFixedWing( airframeType ); setupFrameFixedWing( airframeType );
} else if (m_aircraft->fixedWingType->currentText() == "Elevon") { } else if (m_aircraft->fixedWingType->currentText() == "Elevon") {
airframeType = "FixedWingElevon"; airframeType = "FixedWingElevon";
setupFrameElevon( airframeType ); setupFrameElevon( airframeType );
@ -156,42 +156,22 @@ QString ConfigVehicleTypeWidget::updateFixedWingObjectsFromWidgets()
Helper function to refresh the UI widget values Helper function to refresh the UI widget values
*/ */
void ConfigVehicleTypeWidget::refreshFixedWingWidgetsValues(QString frameType) void ConfigVehicleTypeWidget::refreshFixedWingWidgetsValues(QString frameType)
{ {
GUIConfigData = GUIManager.GetConfigData();
UAVDataObject* obj; fixedGUISettingsStruct fixed = GUIConfigData.fixed;
UAVObjectField *field;
// Then retrieve how channels are setup
// Then retrieve how channels are setup setComboCurrentIndex(m_aircraft->fwEngineChannelBox, fixed.FixedWingThrottle);
obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorSettings"))); setComboCurrentIndex(m_aircraft->fwAileron1ChannelBox, fixed.FixedWingRoll1);
Q_ASSERT(obj); setComboCurrentIndex(m_aircraft->fwAileron2ChannelBox, fixed.FixedWingRoll2);
field = obj->getField(QString("FixedWingThrottle")); setComboCurrentIndex(m_aircraft->fwElevator1ChannelBox, fixed.FixedWingPitch1);
Q_ASSERT(field); setComboCurrentIndex(m_aircraft->fwElevator2ChannelBox, fixed.FixedWingPitch2);
m_aircraft->fwEngineChannelBox->setCurrentIndex(m_aircraft->fwEngineChannelBox->findText(field->getValue().toString())); setComboCurrentIndex(m_aircraft->fwRudder1ChannelBox, fixed.FixedWingYaw1);
setComboCurrentIndex(m_aircraft->fwRudder2ChannelBox, fixed.FixedWingYaw2);
UAVDataObject* obj;
UAVObjectField *field;
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 (frameType == "FixedWingElevon") {
// If the airframe is elevon, restore the slider setting // If the airframe is elevon, restore the slider setting
// Find the channel number for Elevon1 (FixedWingRoll1) // Find the channel number for Elevon1 (FixedWingRoll1)
@ -245,40 +225,24 @@ bool ConfigVehicleTypeWidget::setupFrameFixedWing(QString airframeType)
// m_aircraft->fwStatusLabel->setText("ERROR: check channel assignment"); // m_aircraft->fwStatusLabel->setText("ERROR: check channel assignment");
return false; 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 // Now setup the channels:
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(); GUIConfigData = GUIManager.GetConfigData();
GUIManager.ResetActuators(&GUIConfigData);
GUIConfigData.fixed.FixedWingPitch1 = m_aircraft->fwElevator1ChannelBox->currentIndex();
GUIConfigData.fixed.FixedWingPitch2 = m_aircraft->fwElevator2ChannelBox->currentIndex();
GUIConfigData.fixed.FixedWingRoll1 = m_aircraft->fwAileron1ChannelBox->currentIndex();
GUIConfigData.fixed.FixedWingRoll2 = m_aircraft->fwAileron2ChannelBox->currentIndex();
GUIConfigData.fixed.FixedWingYaw1 = m_aircraft->fwRudder1ChannelBox->currentIndex();
GUIConfigData.fixed.FixedWingThrottle = m_aircraft->fwEngineChannelBox->currentIndex();
GUIManager.SetConfigData(GUIConfigData);
UAVDataObject* obj;
UAVObjectField* field;
obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings"))); obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(obj); Q_ASSERT(obj);
// ... and compute the matrix: // ... and compute the matrix:
@ -382,32 +346,20 @@ bool ConfigVehicleTypeWidget::setupFrameElevon(QString airframeType)
return false; return false;
} }
resetActuators(); GUIConfigData = GUIManager.GetConfigData();
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorSettings"))); GUIManager.ResetActuators(&GUIConfigData);
Q_ASSERT(obj);
GUIConfigData.fixed.FixedWingRoll1 = m_aircraft->fwAileron1ChannelBox->currentIndex();
// Elevons GUIConfigData.fixed.FixedWingRoll2 = m_aircraft->fwAileron2ChannelBox->currentIndex();
UAVObjectField *field = obj->getField("FixedWingRoll1"); GUIConfigData.fixed.FixedWingYaw1 = m_aircraft->fwRudder1ChannelBox->currentIndex();
Q_ASSERT(field); GUIConfigData.fixed.FixedWingYaw2 = m_aircraft->fwRudder2ChannelBox->currentIndex();
field->setValue(m_aircraft->fwAileron1ChannelBox->currentText()); GUIConfigData.fixed.FixedWingThrottle = m_aircraft->fwEngineChannelBox->currentIndex();
field = obj->getField("FixedWingRoll2");
Q_ASSERT(field); GUIManager.SetConfigData(GUIConfigData);
field->setValue(m_aircraft->fwAileron2ChannelBox->currentText());
// Rudder 1 (can be None) UAVDataObject* obj;
field = obj->getField("FixedWingYaw1"); UAVObjectField* field;
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: // Save the curve:
obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings"))); obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(obj); Q_ASSERT(obj);
@ -506,31 +458,20 @@ bool ConfigVehicleTypeWidget::setupFrameVtail(QString airframeType)
return false; return false;
} }
resetActuators(); GUIConfigData = GUIManager.GetConfigData();
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorSettings"))); GUIManager.ResetActuators(&GUIConfigData);
Q_ASSERT(obj);
GUIConfigData.fixed.FixedWingPitch1 = m_aircraft->fwElevator1ChannelBox->currentIndex();
// Elevons GUIConfigData.fixed.FixedWingPitch2 = m_aircraft->fwElevator2ChannelBox->currentIndex();
UAVObjectField *field = obj->getField("FixedWingPitch1"); GUIConfigData.fixed.FixedWingRoll1 = m_aircraft->fwAileron1ChannelBox->currentIndex();
Q_ASSERT(field); GUIConfigData.fixed.FixedWingRoll2 = m_aircraft->fwAileron2ChannelBox->currentIndex();
field->setValue(m_aircraft->fwElevator1ChannelBox->currentText()); GUIConfigData.fixed.FixedWingThrottle = m_aircraft->fwEngineChannelBox->currentIndex();
field = obj->getField("FixedWingPitch2");
Q_ASSERT(field); GUIManager.SetConfigData(GUIConfigData);
field->setValue(m_aircraft->fwElevator2ChannelBox->currentText());
field = obj->getField("FixedWingRoll1"); UAVDataObject* obj;
Q_ASSERT(field); UAVObjectField* 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"))); obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(obj); Q_ASSERT(obj);
// ... and compute the matrix: // ... and compute the matrix:

View File

@ -194,38 +194,15 @@ void ConfigVehicleTypeWidget::refreshGroundVehicleWidgetsValues(QString frameTyp
UAVDataObject* obj; UAVDataObject* obj;
UAVObjectField *field; UAVObjectField *field;
GUIConfigData = GUIManager.GetConfigData();
//THIS SECTION STILL NEEDS WORK. FOR THE MOMENT, USE THE FIXED-WING ONBOARD SETTING IN ORDER TO MINIMIZE CHANCES OF BOLLOXING REAL CODE //THIS SECTION STILL NEEDS WORK. FOR THE MOMENT, USE THE FIXED-WING ONBOARD SETTING IN ORDER TO MINIMIZE CHANCES OF BOLLOXING REAL CODE
// Retrieve channel setup values // Retrieve channel setup values
obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorSettings"))); setComboCurrentIndex(m_aircraft->gvMotor1ChannelBox, GUIConfigData.ground.GroundVehicleThrottle1);
Q_ASSERT(obj); setComboCurrentIndex(m_aircraft->gvMotor2ChannelBox, GUIConfigData.ground.GroundVehicleThrottle2);
field = obj->getField(QString("FixedWingThrottle")); setComboCurrentIndex(m_aircraft->gvSteering1ChannelBox, GUIConfigData.ground.GroundVehicleSteering1);
Q_ASSERT(field); setComboCurrentIndex(m_aircraft->gvSteering2ChannelBox, GUIConfigData.ground.GroundVehicleSteering2);
m_aircraft->gvEngineChannelBox->setCurrentIndex(m_aircraft->gvEngineChannelBox->findText(field->getValue().toString()));
field = obj->getField(QString("FixedWingRoll1"));
Q_ASSERT(field);
m_aircraft->gvAileron1ChannelBox->setCurrentIndex(m_aircraft->gvAileron1ChannelBox->findText(field->getValue().toString()));
field = obj->getField(QString("FixedWingRoll2"));
Q_ASSERT(field);
m_aircraft->gvAileron2ChannelBox->setCurrentIndex(m_aircraft->gvAileron2ChannelBox->findText(field->getValue().toString()));
field = obj->getField(QString("GroundVehicleThrottle1"));
Q_ASSERT(field);
m_aircraft->gvMotor1ChannelBox->setCurrentIndex(m_aircraft->gvMotor1ChannelBox->findText(field->getValue().toString()));
field = obj->getField(QString("GroundVehicleThrottle2"));
Q_ASSERT(field);
m_aircraft->gvMotor2ChannelBox->setCurrentIndex(m_aircraft->gvMotor2ChannelBox->findText(field->getValue().toString()));
field = obj->getField(QString("GroundVehicleSteering1"));
Q_ASSERT(field);
m_aircraft->gvSteering1ChannelBox->setCurrentIndex(m_aircraft->gvSteering1ChannelBox->findText(field->getValue().toString()));
field = obj->getField(QString("GroundVehicleSteering2"));
Q_ASSERT(field);
m_aircraft->gvSteering2ChannelBox->setCurrentIndex(m_aircraft->gvSteering2ChannelBox->findText(field->getValue().toString()));
if (frameType == "GroundVehicleDifferential") { if (frameType == "GroundVehicleDifferential") {
//CURRENTLY BROKEN UNTIL WE DECIDE HOW DIFFERENTIAL SHOULD BEHAVE //CURRENTLY BROKEN UNTIL WE DECIDE HOW DIFFERENTIAL SHOULD BEHAVE
// If the vehicle type is "differential", restore the slider setting // If the vehicle type is "differential", restore the slider setting
@ -280,25 +257,19 @@ bool ConfigVehicleTypeWidget::setupGroundVehicleMotorcycle(QString airframeType)
return false; return false;
} }
// Now setup the channels: // Now setup the channels:
resetActuators(); GUIConfigData = GUIManager.GetConfigData();
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorSettings"))); GUIManager.ResetActuators(&GUIConfigData);
Q_ASSERT(obj); GUIConfigData.ground.GroundVehicleThrottle1 = m_aircraft->gvMotor1ChannelBox->currentIndex();
GUIConfigData.ground.GroundVehicleThrottle2 = m_aircraft->gvMotor2ChannelBox->currentIndex();
// Left motor
UAVObjectField *field = obj->getField("GroundVehicleThrottle1"); GUIManager.SetConfigData(GUIConfigData);
Q_ASSERT(field);
field->setValue(m_aircraft->gvMotor1ChannelBox->currentText());
// Right motor
field = obj->getField("GroundVehicleThrottle2");
Q_ASSERT(field);
field->setValue(m_aircraft->gvMotor2ChannelBox->currentText());
obj->updated();
UAVObject* obj;
UAVObjectField* field;
obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings"))); obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(obj); Q_ASSERT(obj);
// ... and compute the matrix: // ... and compute the matrix:
@ -397,25 +368,19 @@ bool ConfigVehicleTypeWidget::setupGroundVehicleDifferential(QString airframeTyp
return false; return false;
} }
// Now setup the channels:
GUIConfigData = GUIManager.GetConfigData();
GUIManager.ResetActuators(&GUIConfigData);
// Now setup the channels: GUIConfigData.ground.GroundVehicleThrottle1 = m_aircraft->gvMotor1ChannelBox->currentIndex();
resetActuators(); GUIConfigData.ground.GroundVehicleThrottle2 = m_aircraft->gvMotor2ChannelBox->currentIndex();
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorSettings"))); GUIManager.SetConfigData((GUIConfigData));
Q_ASSERT(obj);
// Left motor
UAVObjectField *field = obj->getField("GroundVehicleThrottle1");
Q_ASSERT(field);
field->setValue(m_aircraft->gvMotor1ChannelBox->currentText());
// Right motor
field = obj->getField("GroundVehicleThrottle2");
Q_ASSERT(field);
field->setValue(m_aircraft->gvMotor2ChannelBox->currentText());
obj->updated();
UAVObject* obj;
UAVObjectField* field;
obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings"))); obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(obj); Q_ASSERT(obj);
// ... and compute the matrix: // ... and compute the matrix:
@ -524,43 +489,20 @@ bool ConfigVehicleTypeWidget::setupGroundVehicleCar(QString airframeType)
// m_aircraft->gvMotor2Label->setText(htmlText->toPlainText()); // m_aircraft->gvMotor2Label->setText(htmlText->toPlainText());
// } // }
// Now setup the channels: // Now setup the channels:
resetActuators(); GUIConfigData = GUIManager.GetConfigData();
GUIManager.ResetActuators(&GUIConfigData);
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorSettings"))); GUIConfigData.ground.GroundVehicleThrottle1 = m_aircraft->gvMotor1ChannelBox->currentIndex();
Q_ASSERT(obj); GUIConfigData.ground.GroundVehicleThrottle2 = m_aircraft->gvMotor2ChannelBox->currentIndex();
GUIConfigData.ground.GroundVehicleSteering1 = m_aircraft->gvSteering1ChannelBox->currentIndex();
// Front motor GUIConfigData.ground.GroundVehicleSteering2 = m_aircraft->gvSteering2ChannelBox->currentIndex();
UAVObjectField *field = obj->getField("GroundVehicleThrottle1");
Q_ASSERT(field);
field->setValue(m_aircraft->gvMotor1ChannelBox->currentText());
// Rear motor
field = obj->getField("GroundVehicleThrottle2");
Q_ASSERT(field);
field->setValue(m_aircraft->gvMotor2ChannelBox->currentText());
// // Aileron GUIManager.SetConfigData(GUIConfigData);
// 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());
// Front steering
field = obj->getField("GroundVehicleSteering1");
Q_ASSERT(field);
field->setValue(m_aircraft->gvSteering1ChannelBox->currentText());
// Rear steering
field = obj->getField("GroundVehicleSteering2");
Q_ASSERT(field);
field->setValue(m_aircraft->gvSteering2ChannelBox->currentText());
obj->updated();
UAVDataObject* obj;
UAVObjectField* field;
obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings"))); obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(obj); Q_ASSERT(obj);
// ... and compute the matrix: // ... and compute the matrix:

View File

@ -41,6 +41,7 @@
#include "mixersettings.h" #include "mixersettings.h"
#include "systemsettings.h" #include "systemsettings.h"
#include "actuatorcommand.h" #include "actuatorcommand.h"
#include "guiconfigdata.h"
//#define Pi 3.14159265358979323846 //#define Pi 3.14159265358979323846
@ -63,7 +64,7 @@ void ConfigVehicleTypeWidget::setupMultiRotorUI(QString frameType)
//and grey out all unused motor channel boxes //and grey out all unused motor channel boxes
for (int i=4; i <=8; i++) { for (int i=4; i <=8; i++) {
QComboBox *combobox = qFindChild<QComboBox*>(this, "multiMotorChannelBox" + QString::number(i)); QComboBox *combobox = qFindChild<QComboBox*>(this, "multiMotorChannelBox" + QString::number(i));
combobox->setEnabled(false); combobox->setEnabled(false);
} }
m_aircraft->triYawChannelBox->setEnabled(true); m_aircraft->triYawChannelBox->setEnabled(true);
@ -80,7 +81,7 @@ void ConfigVehicleTypeWidget::setupMultiRotorUI(QString frameType)
//and grey out all unused motor channel boxes //and grey out all unused motor channel boxes
for (int i=5; i <=8; i++) { for (int i=5; i <=8; i++) {
QComboBox *combobox = qFindChild<QComboBox*>(this, "multiMotorChannelBox" + QString::number(i)); QComboBox *combobox = qFindChild<QComboBox*>(this, "multiMotorChannelBox" + QString::number(i));
combobox->setEnabled(false); combobox->setEnabled(false);
} }
m_aircraft->triYawChannelBox->setEnabled(false); m_aircraft->triYawChannelBox->setEnabled(false);
@ -100,7 +101,7 @@ void ConfigVehicleTypeWidget::setupMultiRotorUI(QString frameType)
//and grey out all unused motor channel boxes //and grey out all unused motor channel boxes
for (int i=5; i <=8; i++) { for (int i=5; i <=8; i++) {
QComboBox *combobox = qFindChild<QComboBox*>(this, "multiMotorChannelBox" + QString::number(i)); QComboBox *combobox = qFindChild<QComboBox*>(this, "multiMotorChannelBox" + QString::number(i));
combobox->setEnabled(false); combobox->setEnabled(false);
} }
m_aircraft->triYawChannelBox->setEnabled(false); m_aircraft->triYawChannelBox->setEnabled(false);
@ -120,7 +121,7 @@ void ConfigVehicleTypeWidget::setupMultiRotorUI(QString frameType)
//and grey out all unused motor channel boxes //and grey out all unused motor channel boxes
for (int i=7; i <=8; i++) { for (int i=7; i <=8; i++) {
QComboBox *combobox = qFindChild<QComboBox*>(this, "multiMotorChannelBox" + QString::number(i)); QComboBox *combobox = qFindChild<QComboBox*>(this, "multiMotorChannelBox" + QString::number(i));
combobox->setEnabled(false); combobox->setEnabled(false);
} }
m_aircraft->triYawChannelBox->setEnabled(false); m_aircraft->triYawChannelBox->setEnabled(false);
@ -140,7 +141,7 @@ void ConfigVehicleTypeWidget::setupMultiRotorUI(QString frameType)
//and grey out all unused motor channel boxes //and grey out all unused motor channel boxes
for (int i=7; i <=8; i++) { for (int i=7; i <=8; i++) {
QComboBox *combobox = qFindChild<QComboBox*>(this, "multiMotorChannelBox" + QString::number(i)); QComboBox *combobox = qFindChild<QComboBox*>(this, "multiMotorChannelBox" + QString::number(i));
combobox->setEnabled(false); combobox->setEnabled(false);
} }
m_aircraft->triYawChannelBox->setEnabled(false); m_aircraft->triYawChannelBox->setEnabled(false);
@ -161,7 +162,7 @@ void ConfigVehicleTypeWidget::setupMultiRotorUI(QString frameType)
//and grey out all unused motor channel boxes //and grey out all unused motor channel boxes
for (int i=7; i <=8; i++) { for (int i=7; i <=8; i++) {
QComboBox *combobox = qFindChild<QComboBox*>(this, "multiMotorChannelBox" + QString::number(i)); QComboBox *combobox = qFindChild<QComboBox*>(this, "multiMotorChannelBox" + QString::number(i));
combobox->setEnabled(false); combobox->setEnabled(false);
} }
m_aircraft->triYawChannelBox->setEnabled(false); m_aircraft->triYawChannelBox->setEnabled(false);
@ -467,10 +468,11 @@ QString ConfigVehicleTypeWidget::updateMultiRotorObjectsFromWidgets()
} }
motorList << "VTOLMotorNW" << "VTOLMotorNE" << "VTOLMotorS"; motorList << "VTOLMotorNW" << "VTOLMotorNE" << "VTOLMotorS";
setupMotors(motorList); setupMotors(motorList);
obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorSettings")));
Q_ASSERT(obj); GUIConfigData = GUIManager.GetConfigData();
field = obj->getField("FixedWingYaw1"); GUIConfigData.multi.TRIYaw = m_aircraft->triYawChannelBox->currentIndex();
field->setValue(m_aircraft->triYawChannelBox->currentText()); GUIManager.SetConfigData(GUIConfigData);
// Motor 1 to 6, Y6 Layout: // Motor 1 to 6, Y6 Layout:
// pitch roll yaw // pitch roll yaw
@ -514,26 +516,20 @@ void ConfigVehicleTypeWidget::refreshMultiRotorWidgetsValues(QString frameType)
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
// Retrieve settings // Retrieve settings
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorSettings"))); GUIConfigData = GUIManager.GetConfigData();
Q_ASSERT(obj); multiGUISettingsStruct multi = GUIConfigData.multi;
UAVObjectField *field;
UAVDataObject* obj;
UAVObjectField *field;
if (frameType == "QuadP") { if (frameType == "QuadP") {
// Motors 1/2/3/4 are: N / E / S / W // Motors 1/2/3/4 are: N / E / S / W
field = obj->getField(QString("VTOLMotorN")); setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorN);
Q_ASSERT(field); setComboCurrentIndex(m_aircraft->multiMotorChannelBox2,multi.VTOLMotorE);
m_aircraft->multiMotorChannelBox1->setCurrentIndex(m_aircraft->multiMotorChannelBox1->findText(field->getValue().toString())); setComboCurrentIndex(m_aircraft->multiMotorChannelBox3,multi.VTOLMotorS);
field = obj->getField(QString("VTOLMotorE")); setComboCurrentIndex(m_aircraft->multiMotorChannelBox4,multi.VTOLMotorW);
Q_ASSERT(field);
m_aircraft->multiMotorChannelBox2->setCurrentIndex(m_aircraft->multiMotorChannelBox2->findText(field->getValue().toString()));
field = obj->getField(QString("VTOLMotorS"));
Q_ASSERT(field);
m_aircraft->multiMotorChannelBox3->setCurrentIndex(m_aircraft->multiMotorChannelBox3->findText(field->getValue().toString()));
field = obj->getField(QString("VTOLMotorW"));
Q_ASSERT(field);
m_aircraft->multiMotorChannelBox4->setCurrentIndex(m_aircraft->multiMotorChannelBox4->findText(field->getValue().toString()));
// Now, read the 1st mixer R/P/Y levels and initialize the mix sliders. // Now, read the 1st mixer R/P/Y levels and initialize the mix sliders.
// This assumes that all vectors are identical - if not, the user should use the // This assumes that all vectors are identical - if not, the user should use the
// "custom" setting. // "custom" setting.
@ -556,20 +552,12 @@ void ConfigVehicleTypeWidget::refreshMultiRotorWidgetsValues(QString frameType)
m_aircraft->mrRollMixLevel->setValue(val); m_aircraft->mrRollMixLevel->setValue(val);
} }
} else if (frameType == "QuadX") { } else if (frameType == "QuadX") {
// Motors 1/2/3/4 are: NW / NE / SE / SW // Motors 1/2/3/4 are: NW / NE / SE / SW
field = obj->getField(QString("VTOLMotorNW")); setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNW);
Q_ASSERT(field); setComboCurrentIndex(m_aircraft->multiMotorChannelBox2,multi.VTOLMotorNE);
m_aircraft->multiMotorChannelBox1->setCurrentIndex(m_aircraft->multiMotorChannelBox1->findText(field->getValue().toString())); setComboCurrentIndex(m_aircraft->multiMotorChannelBox3,multi.VTOLMotorSE);
field = obj->getField(QString("VTOLMotorNE")); setComboCurrentIndex(m_aircraft->multiMotorChannelBox4,multi.VTOLMotorSW);
Q_ASSERT(field);
m_aircraft->multiMotorChannelBox2->setCurrentIndex(m_aircraft->multiMotorChannelBox2->findText(field->getValue().toString()));
field = obj->getField(QString("VTOLMotorSE"));
Q_ASSERT(field);
m_aircraft->multiMotorChannelBox3->setCurrentIndex(m_aircraft->multiMotorChannelBox3->findText(field->getValue().toString()));
field = obj->getField(QString("VTOLMotorSW"));
Q_ASSERT(field);
m_aircraft->multiMotorChannelBox4->setCurrentIndex(m_aircraft->multiMotorChannelBox4->findText(field->getValue().toString()));
// Now, read the 1st mixer R/P/Y levels and initialize the mix sliders. // Now, read the 1st mixer R/P/Y levels and initialize the mix sliders.
// This assumes that all vectors are identical - if not, the user should use the // This assumes that all vectors are identical - if not, the user should use the
// "custom" setting. // "custom" setting.
@ -591,23 +579,18 @@ void ConfigVehicleTypeWidget::refreshMultiRotorWidgetsValues(QString frameType)
} }
} else if (frameType == "Hexa") { } else if (frameType == "Hexa") {
// Motors 1/2/3 4/5/6 are: N / NE / SE / S / SW / NW // Motors 1/2/3 4/5/6 are: N / NE / SE / S / SW / NW
field = obj->getField(QString("VTOLMotorN"));
m_aircraft->multiMotorChannelBox1->setCurrentIndex(m_aircraft->multiMotorChannelBox1->findText(field->getValue().toString())); setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorN);
field = obj->getField(QString("VTOLMotorNE")); setComboCurrentIndex(m_aircraft->multiMotorChannelBox2,multi.VTOLMotorNE);
m_aircraft->multiMotorChannelBox2->setCurrentIndex(m_aircraft->multiMotorChannelBox2->findText(field->getValue().toString())); setComboCurrentIndex(m_aircraft->multiMotorChannelBox3,multi.VTOLMotorSE);
field = obj->getField(QString("VTOLMotorSE")); setComboCurrentIndex(m_aircraft->multiMotorChannelBox4,multi.VTOLMotorS);
m_aircraft->multiMotorChannelBox3->setCurrentIndex(m_aircraft->multiMotorChannelBox3->findText(field->getValue().toString())); setComboCurrentIndex(m_aircraft->multiMotorChannelBox5,multi.VTOLMotorSW);
field = obj->getField(QString("VTOLMotorS")); setComboCurrentIndex(m_aircraft->multiMotorChannelBox6,multi.VTOLMotorNW);
m_aircraft->multiMotorChannelBox4->setCurrentIndex(m_aircraft->multiMotorChannelBox4->findText(field->getValue().toString()));
field = obj->getField(QString("VTOLMotorSW"));
m_aircraft->multiMotorChannelBox5->setCurrentIndex(m_aircraft->multiMotorChannelBox4->findText(field->getValue().toString()));
field = obj->getField(QString("VTOLMotorNW"));
m_aircraft->multiMotorChannelBox6->setCurrentIndex(m_aircraft->multiMotorChannelBox4->findText(field->getValue().toString()));
// Now, read the 1st mixer R/P/Y levels and initialize the mix sliders. // Now, read the 1st mixer R/P/Y levels and initialize the mix sliders.
// This assumes that all vectors are identical - if not, the user should use the // This assumes that all vectors are identical - if not, the user should use the
// "custom" setting. // "custom" setting.
obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings"))); obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
int tmpVal= m_aircraft->multiMotorChannelBox1->currentIndex()-1; int tmpVal= m_aircraft->multiMotorChannelBox1->currentIndex()-1;
// tmpVal will be -1 if value is set to "None" // tmpVal will be -1 if value is set to "None"
if (tmpVal > -1) { if (tmpVal > -1) {
@ -628,19 +611,15 @@ void ConfigVehicleTypeWidget::refreshMultiRotorWidgetsValues(QString frameType)
} }
} }
} else if (frameType == "HexaX") { } else if (frameType == "HexaX") {
// Motors 1/2/3 4/5/6 are: NE / E / SE / SW / W / NW // Motors 1/2/3 4/5/6 are: NE / E / SE / SW / W / NW
field = obj->getField(QString("VTOLMotorNE"));
m_aircraft->multiMotorChannelBox1->setCurrentIndex(m_aircraft->multiMotorChannelBox1->findText(field->getValue().toString())); setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNE);
field = obj->getField(QString("VTOLMotorE")); setComboCurrentIndex(m_aircraft->multiMotorChannelBox2,multi.VTOLMotorE);
m_aircraft->multiMotorChannelBox2->setCurrentIndex(m_aircraft->multiMotorChannelBox2->findText(field->getValue().toString())); setComboCurrentIndex(m_aircraft->multiMotorChannelBox3,multi.VTOLMotorSE);
field = obj->getField(QString("VTOLMotorSE")); setComboCurrentIndex(m_aircraft->multiMotorChannelBox4,multi.VTOLMotorSW);
m_aircraft->multiMotorChannelBox3->setCurrentIndex(m_aircraft->multiMotorChannelBox3->findText(field->getValue().toString())); setComboCurrentIndex(m_aircraft->multiMotorChannelBox5,multi.VTOLMotorW);
field = obj->getField(QString("VTOLMotorSW")); setComboCurrentIndex(m_aircraft->multiMotorChannelBox6,multi.VTOLMotorNW);
m_aircraft->multiMotorChannelBox4->setCurrentIndex(m_aircraft->multiMotorChannelBox4->findText(field->getValue().toString()));
field = obj->getField(QString("VTOLMotorW"));
m_aircraft->multiMotorChannelBox5->setCurrentIndex(m_aircraft->multiMotorChannelBox4->findText(field->getValue().toString()));
field = obj->getField(QString("VTOLMotorNW"));
m_aircraft->multiMotorChannelBox6->setCurrentIndex(m_aircraft->multiMotorChannelBox4->findText(field->getValue().toString()));
// Now, read the 1st mixer R/P/Y levels and initialize the mix sliders. // Now, read the 1st mixer R/P/Y levels and initialize the mix sliders.
// This assumes that all vectors are identical - if not, the user should use the // This assumes that all vectors are identical - if not, the user should use the
@ -663,20 +642,16 @@ void ConfigVehicleTypeWidget::refreshMultiRotorWidgetsValues(QString frameType)
m_aircraft->mrRollMixLevel->setValue(val); m_aircraft->mrRollMixLevel->setValue(val);
} }
} else if (frameType == "HexaCoax") { } else if (frameType == "HexaCoax") {
// Motors 1/2/3 4/5/6 are: NW/W NE/E S/SE // Motors 1/2/3 4/5/6 are: NW/W NE/E S/SE
field = obj->getField(QString("VTOLMotorNW"));
m_aircraft->multiMotorChannelBox1->setCurrentIndex(m_aircraft->multiMotorChannelBox1->findText(field->getValue().toString())); setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNW);
field = obj->getField(QString("VTOLMotorW")); setComboCurrentIndex(m_aircraft->multiMotorChannelBox2,multi.VTOLMotorW);
m_aircraft->multiMotorChannelBox2->setCurrentIndex(m_aircraft->multiMotorChannelBox2->findText(field->getValue().toString())); setComboCurrentIndex(m_aircraft->multiMotorChannelBox3,multi.VTOLMotorNE);
field = obj->getField(QString("VTOLMotorNE")); setComboCurrentIndex(m_aircraft->multiMotorChannelBox4,multi.VTOLMotorE);
m_aircraft->multiMotorChannelBox3->setCurrentIndex(m_aircraft->multiMotorChannelBox3->findText(field->getValue().toString())); setComboCurrentIndex(m_aircraft->multiMotorChannelBox5,multi.VTOLMotorS);
field = obj->getField(QString("VTOLMotorE")); setComboCurrentIndex(m_aircraft->multiMotorChannelBox6,multi.VTOLMotorSE);
m_aircraft->multiMotorChannelBox4->setCurrentIndex(m_aircraft->multiMotorChannelBox4->findText(field->getValue().toString()));
field = obj->getField(QString("VTOLMotorS"));
m_aircraft->multiMotorChannelBox5->setCurrentIndex(m_aircraft->multiMotorChannelBox4->findText(field->getValue().toString()));
field = obj->getField(QString("VTOLMotorSE"));
m_aircraft->multiMotorChannelBox6->setCurrentIndex(m_aircraft->multiMotorChannelBox4->findText(field->getValue().toString()));
// Now, read the 1st mixer R/P/Y levels and initialize the mix sliders. // Now, read the 1st mixer R/P/Y levels and initialize the mix sliders.
// This assumes that all vectors are identical - if not, the user should use the // This assumes that all vectors are identical - if not, the user should use the
// "custom" setting. // "custom" setting.
@ -697,32 +672,18 @@ void ConfigVehicleTypeWidget::refreshMultiRotorWidgetsValues(QString frameType)
} }
} else if (frameType == "Octo" || frameType == "OctoV" || } else if (frameType == "Octo" || frameType == "OctoV" ||
frameType == "OctoCoaxP") { frameType == "OctoCoaxP") {
// Motors 1 to 8 are N / NE / E / etc // Motors 1 to 8 are N / NE / E / etc
field = obj->getField(QString("VTOLMotorN"));
Q_ASSERT(field); setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorN);
m_aircraft->multiMotorChannelBox1->setCurrentIndex(m_aircraft->multiMotorChannelBox1->findText(field->getValue().toString())); setComboCurrentIndex(m_aircraft->multiMotorChannelBox2,multi.VTOLMotorNE);
field = obj->getField(QString("VTOLMotorNE")); setComboCurrentIndex(m_aircraft->multiMotorChannelBox3,multi.VTOLMotorE);
Q_ASSERT(field); setComboCurrentIndex(m_aircraft->multiMotorChannelBox4,multi.VTOLMotorSE);
m_aircraft->multiMotorChannelBox2->setCurrentIndex(m_aircraft->multiMotorChannelBox2->findText(field->getValue().toString())); setComboCurrentIndex(m_aircraft->multiMotorChannelBox5,multi.VTOLMotorS);
field = obj->getField(QString("VTOLMotorE")); setComboCurrentIndex(m_aircraft->multiMotorChannelBox6,multi.VTOLMotorSW);
Q_ASSERT(field); setComboCurrentIndex(m_aircraft->multiMotorChannelBox7,multi.VTOLMotorW);
m_aircraft->multiMotorChannelBox3->setCurrentIndex(m_aircraft->multiMotorChannelBox3->findText(field->getValue().toString())); setComboCurrentIndex(m_aircraft->multiMotorChannelBox8,multi.VTOLMotorNW);
field = obj->getField(QString("VTOLMotorSE"));
Q_ASSERT(field);
m_aircraft->multiMotorChannelBox4->setCurrentIndex(m_aircraft->multiMotorChannelBox4->findText(field->getValue().toString()));
field = obj->getField(QString("VTOLMotorS"));
Q_ASSERT(field);
m_aircraft->multiMotorChannelBox5->setCurrentIndex(m_aircraft->multiMotorChannelBox4->findText(field->getValue().toString()));
field = obj->getField(QString("VTOLMotorSW"));
Q_ASSERT(field);
m_aircraft->multiMotorChannelBox6->setCurrentIndex(m_aircraft->multiMotorChannelBox4->findText(field->getValue().toString()));
field = obj->getField(QString("VTOLMotorW"));
Q_ASSERT(field);
m_aircraft->multiMotorChannelBox7->setCurrentIndex(m_aircraft->multiMotorChannelBox4->findText(field->getValue().toString()));
field = obj->getField(QString("VTOLMotorNW"));
Q_ASSERT(field);
m_aircraft->multiMotorChannelBox8->setCurrentIndex(m_aircraft->multiMotorChannelBox4->findText(field->getValue().toString()));
// Now, read the 1st mixer R/P/Y levels and initialize the mix sliders. // Now, read the 1st mixer R/P/Y levels and initialize the mix sliders.
// This assumes that all vectors are identical - if not, the user should use the // This assumes that all vectors are identical - if not, the user should use the
// "custom" setting. // "custom" setting.
@ -774,32 +735,18 @@ void ConfigVehicleTypeWidget::refreshMultiRotorWidgetsValues(QString frameType)
} }
} }
} else if (frameType == "OctoCoaxX") { } else if (frameType == "OctoCoaxX") {
// Motors 1 to 8 are N / NE / E / etc // Motors 1 to 8 are N / NE / E / etc
field = obj->getField(QString("VTOLMotorNW"));
Q_ASSERT(field); setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNW);
m_aircraft->multiMotorChannelBox1->setCurrentIndex(m_aircraft->multiMotorChannelBox1->findText(field->getValue().toString())); setComboCurrentIndex(m_aircraft->multiMotorChannelBox2,multi.VTOLMotorN);
field = obj->getField(QString("VTOLMotorN")); setComboCurrentIndex(m_aircraft->multiMotorChannelBox3,multi.VTOLMotorNE);
Q_ASSERT(field); setComboCurrentIndex(m_aircraft->multiMotorChannelBox4,multi.VTOLMotorE);
m_aircraft->multiMotorChannelBox2->setCurrentIndex(m_aircraft->multiMotorChannelBox2->findText(field->getValue().toString())); setComboCurrentIndex(m_aircraft->multiMotorChannelBox5,multi.VTOLMotorSE);
field = obj->getField(QString("VTOLMotorNE")); setComboCurrentIndex(m_aircraft->multiMotorChannelBox6,multi.VTOLMotorS);
Q_ASSERT(field); setComboCurrentIndex(m_aircraft->multiMotorChannelBox7,multi.VTOLMotorSW);
m_aircraft->multiMotorChannelBox3->setCurrentIndex(m_aircraft->multiMotorChannelBox3->findText(field->getValue().toString())); setComboCurrentIndex(m_aircraft->multiMotorChannelBox8,multi.VTOLMotorW);
field = obj->getField(QString("VTOLMotorE"));
Q_ASSERT(field);
m_aircraft->multiMotorChannelBox4->setCurrentIndex(m_aircraft->multiMotorChannelBox4->findText(field->getValue().toString()));
field = obj->getField(QString("VTOLMotorSE"));
Q_ASSERT(field);
m_aircraft->multiMotorChannelBox5->setCurrentIndex(m_aircraft->multiMotorChannelBox4->findText(field->getValue().toString()));
field = obj->getField(QString("VTOLMotorS"));
Q_ASSERT(field);
m_aircraft->multiMotorChannelBox6->setCurrentIndex(m_aircraft->multiMotorChannelBox4->findText(field->getValue().toString()));
field = obj->getField(QString("VTOLMotorSW"));
Q_ASSERT(field);
m_aircraft->multiMotorChannelBox7->setCurrentIndex(m_aircraft->multiMotorChannelBox4->findText(field->getValue().toString()));
field = obj->getField(QString("VTOLMotorW"));
Q_ASSERT(field);
m_aircraft->multiMotorChannelBox8->setCurrentIndex(m_aircraft->multiMotorChannelBox4->findText(field->getValue().toString()));
// Now, read the 1st mixer R/P/Y levels and initialize the mix sliders. // Now, read the 1st mixer R/P/Y levels and initialize the mix sliders.
// This assumes that all vectors are identical - if not, the user should use the // This assumes that all vectors are identical - if not, the user should use the
// "custom" setting. // "custom" setting.
@ -819,20 +766,14 @@ void ConfigVehicleTypeWidget::refreshMultiRotorWidgetsValues(QString frameType)
m_aircraft->mrRollMixLevel->setValue(val); m_aircraft->mrRollMixLevel->setValue(val);
} }
} else if (frameType == "Tri") { } else if (frameType == "Tri") {
// Motors 1 to 8 are N / NE / E / etc // Motors 1 to 8 are N / NE / E / etc
field = obj->getField(QString("VTOLMotorNW"));
Q_ASSERT(field); setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNW);
m_aircraft->multiMotorChannelBox1->setCurrentIndex(m_aircraft->multiMotorChannelBox1->findText(field->getValue().toString())); setComboCurrentIndex(m_aircraft->multiMotorChannelBox2,multi.VTOLMotorNE);
field = obj->getField(QString("VTOLMotorNE")); setComboCurrentIndex(m_aircraft->multiMotorChannelBox3,multi.VTOLMotorS);
Q_ASSERT(field); setComboCurrentIndex(m_aircraft->multiMotorChannelBox4,multi.VTOLMotorS);
m_aircraft->multiMotorChannelBox2->setCurrentIndex(m_aircraft->multiMotorChannelBox2->findText(field->getValue().toString())); setComboCurrentIndex(m_aircraft->triYawChannelBox,multi.TRIYaw);
field = obj->getField(QString("VTOLMotorS"));
Q_ASSERT(field);
m_aircraft->multiMotorChannelBox3->setCurrentIndex(m_aircraft->multiMotorChannelBox3->findText(field->getValue().toString()));
field = obj->getField(QString("FixedWingYaw1"));
Q_ASSERT(field);
m_aircraft->triYawChannelBox->setCurrentIndex(m_aircraft->multiMotorChannelBox3->findText(field->getValue().toString()));
obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings"))); obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
int tmpVal= m_aircraft->multiMotorChannelBox1->currentIndex()-1; int tmpVal= m_aircraft->multiMotorChannelBox1->currentIndex()-1;
// tmpVal will be -1 if value is set to "None" // tmpVal will be -1 if value is set to "None"
@ -883,19 +824,40 @@ void ConfigVehicleTypeWidget::setupQuadMotor(int channel, double pitch, double r
*/ */
void ConfigVehicleTypeWidget::setupMotors(QList<QString> motorList) void ConfigVehicleTypeWidget::setupMotors(QList<QString> motorList)
{ {
resetActuators();
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorSettings")));
Q_ASSERT(obj);
UAVObjectField *field;
QList<QComboBox*> mmList; QList<QComboBox*> mmList;
mmList << m_aircraft->multiMotorChannelBox1 << m_aircraft->multiMotorChannelBox2 << m_aircraft->multiMotorChannelBox3 mmList << m_aircraft->multiMotorChannelBox1 << m_aircraft->multiMotorChannelBox2 << m_aircraft->multiMotorChannelBox3
<< m_aircraft->multiMotorChannelBox4 << m_aircraft->multiMotorChannelBox5 << m_aircraft->multiMotorChannelBox6 << m_aircraft->multiMotorChannelBox4 << m_aircraft->multiMotorChannelBox5 << m_aircraft->multiMotorChannelBox6
<< m_aircraft->multiMotorChannelBox7 << m_aircraft->multiMotorChannelBox8; << m_aircraft->multiMotorChannelBox7 << m_aircraft->multiMotorChannelBox8;
GUIConfigData = GUIManager.GetConfigData();
GUIManager.ResetActuators(&GUIConfigData);
int index;
foreach (QString motor, motorList) { foreach (QString motor, motorList) {
field = obj->getField(motor);
field->setValue(mmList.takeFirst()->currentText()); index = mmList.takeFirst()->currentIndex();
//qDebug()<<QString("Setup motor: %0 = %1").arg(motor).arg(index);
if (motor == QString("VTOLMotorN"))
GUIConfigData.multi.VTOLMotorN = index;
else if (motor == QString("VTOLMotorNE"))
GUIConfigData.multi.VTOLMotorNE = index;
else if (motor == QString("VTOLMotorE"))
GUIConfigData.multi.VTOLMotorE = index;
else if (motor == QString("VTOLMotorSE"))
GUIConfigData.multi.VTOLMotorSE = index;
else if (motor == QString( "VTOLMotorS"))
GUIConfigData.multi.VTOLMotorS = index;
else if (motor == QString( "VTOLMotorSW"))
GUIConfigData.multi.VTOLMotorSW = index;
else if (motor == QString( "VTOLMotorW"))
GUIConfigData.multi.VTOLMotorW = index;
else if (motor == QString( "VTOLMotorNW"))
GUIConfigData.multi.VTOLMotorNW = index;
} }
//obj->updated(); // Save... GUIManager.SetConfigData(GUIConfigData);
} }
@ -1143,4 +1105,4 @@ void ConfigVehicleTypeWidget::throwMultiRotorChannelConfigError(int numMotors)
if (error){ if (error){
m_aircraft->mrStatusLabel->setText(QString("<font color='red'>ERROR: Assign all %1 motor channels</font>").arg(numMotors)); m_aircraft->mrStatusLabel->setText(QString("<font color='red'>ERROR: Assign all %1 motor channels</font>").arg(numMotors));
} }
} }

View File

@ -85,6 +85,95 @@ void GUIConfigDataManager::SetConfigData(GUIConfigDataUnion configData) {
systemSettings->updated(); systemSettings->updated();
} }
void GUIConfigDataManager::ResetActuators()
{
// get the gui config data
GUIConfigDataUnion configData = GetConfigData();
// reset the actuators by airframe type
ResetActuators(&configData);
// set the gui config data
SetConfigData(configData);
}
void GUIConfigDataManager::ResetActuators(GUIConfigDataUnion* configData)
{
// get systemsettings for airframe type
SystemSettings * systemSettings = SystemSettings::GetInstance(getObjectManager());
Q_ASSERT(systemSettings);
SystemSettings::DataFields systemSettingsData = systemSettings->getData();
switch (systemSettingsData.AirframeType)
{
// fixed wing
case SystemSettings::AIRFRAMETYPE_FIXEDWING:
case SystemSettings::AIRFRAMETYPE_FIXEDWINGELEVON:
case SystemSettings::AIRFRAMETYPE_FIXEDWINGVTAIL:
{
configData->fixed.FixedWingPitch1 = 0;
configData->fixed.FixedWingPitch2 = 0;
configData->fixed.FixedWingRoll1 = 0;
configData->fixed.FixedWingRoll2 = 0;
configData->fixed.FixedWingYaw1 = 0;
configData->fixed.FixedWingYaw2 = 0;
configData->fixed.FixedWingThrottle = 0;
}
break;
// helicp
case SystemSettings::AIRFRAMETYPE_HELICP:
{
configData->heli.Throttle = 0;
configData->heli.Tail = 0;
configData->heli.ServoIndexW = 0;
configData->heli.ServoIndexX = 0;
configData->heli.ServoIndexY = 0;
configData->heli.ServoIndexZ = 0;
}
break;
//multirotor
case SystemSettings::AIRFRAMETYPE_VTOL:
case SystemSettings::AIRFRAMETYPE_TRI:
case SystemSettings::AIRFRAMETYPE_QUADX:
case SystemSettings::AIRFRAMETYPE_QUADP:
case SystemSettings::AIRFRAMETYPE_OCTOV:
case SystemSettings::AIRFRAMETYPE_OCTOCOAXX:
case SystemSettings::AIRFRAMETYPE_OCTOCOAXP:
case SystemSettings::AIRFRAMETYPE_OCTO:
case SystemSettings::AIRFRAMETYPE_HEXAX:
case SystemSettings::AIRFRAMETYPE_HEXACOAX:
case SystemSettings::AIRFRAMETYPE_HEXA:
{
configData->multi.VTOLMotorN = 0;
configData->multi.VTOLMotorNE = 0;
configData->multi.VTOLMotorE = 0;
configData->multi.VTOLMotorSE = 0;
configData->multi.VTOLMotorS = 0;
configData->multi.VTOLMotorSW = 0;
configData->multi.VTOLMotorW = 0;
configData->multi.VTOLMotorNW = 0;
configData->multi.TRIYaw = 0;
}
break;
// ground
case SystemSettings::AIRFRAMETYPE_GROUNDVEHICLECAR:
case SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEDIFFERENTIAL:
case SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEMOTORCYCLE:
{
configData->ground.GroundVehicleSteering1 = 0;
configData->ground.GroundVehicleSteering2 = 0;
configData->ground.GroundVehicleThrottle1 = 0;
configData->ground.GroundVehicleThrottle2 = 0;
}
break;
}
}
QStringList GUIConfigDataManager::getChannelDescriptions() QStringList GUIConfigDataManager::getChannelDescriptions()
{ {
int i; int i;
@ -183,20 +272,46 @@ QStringList GUIConfigDataManager::getChannelDescriptions()
case SystemSettings::AIRFRAMETYPE_HEXACOAX: case SystemSettings::AIRFRAMETYPE_HEXACOAX:
case SystemSettings::AIRFRAMETYPE_HEXA: case SystemSettings::AIRFRAMETYPE_HEXA:
{ {
channelDesc[configData.multi.VTOLMotorN] = QString("VTOLMotorN"); multiGUISettingsStruct multi = configData.multi;
channelDesc[configData.multi.VTOLMotorNE] = QString("VTOLMotorNE");
channelDesc[configData.multi.VTOLMotorNW] = QString("VTOLMotorNW"); if (multi.VTOLMotorN > 0 && multi.VTOLMotorN < GUIConfigDataManager::CHANNEL_NUMELEM)
channelDesc[configData.multi.VTOLMotorS] = QString("VTOLMotorS"); channelDesc[multi.VTOLMotorN-1] = QString("VTOLMotorN");
channelDesc[configData.multi.VTOLMotorSE] = QString("VTOLMotorSE"); if (multi.VTOLMotorNE > 0 && multi.VTOLMotorNE < GUIConfigDataManager::CHANNEL_NUMELEM)
channelDesc[configData.multi.VTOLMotorSW] = QString("VTOLMotorSW"); channelDesc[multi.VTOLMotorNE-1] = QString("VTOLMotorNE");
channelDesc[configData.multi.VTOLMotorW] = QString("VTOLMotorW"); if (multi.VTOLMotorNW > 0 && multi.VTOLMotorNW < GUIConfigDataManager::CHANNEL_NUMELEM)
channelDesc[configData.multi.VTOLMotorE] = QString("VTOLMotorE"); channelDesc[multi.VTOLMotorNW-1] = QString("VTOLMotorNW");
if (multi.VTOLMotorS > 0 && multi.VTOLMotorS < GUIConfigDataManager::CHANNEL_NUMELEM)
channelDesc[multi.VTOLMotorS-1] = QString("VTOLMotorS");
if (multi.VTOLMotorSE > 0 && multi.VTOLMotorSE < GUIConfigDataManager::CHANNEL_NUMELEM)
channelDesc[multi.VTOLMotorSE-1] = QString("VTOLMotorSE");
if (multi.VTOLMotorSW > 0 && multi.VTOLMotorSW < GUIConfigDataManager::CHANNEL_NUMELEM)
channelDesc[multi.VTOLMotorSW-1] = QString("VTOLMotorSW");
if (multi.VTOLMotorW > 0 && multi.VTOLMotorW < GUIConfigDataManager::CHANNEL_NUMELEM)
channelDesc[multi.VTOLMotorW-1] = QString("VTOLMotorW");
if (multi.VTOLMotorE > 0 && multi.VTOLMotorE < GUIConfigDataManager::CHANNEL_NUMELEM)
channelDesc[multi.VTOLMotorE-1] = QString("VTOLMotorE");
return channelDesc; return channelDesc;
} }
break; break;
// ground // ground
case SystemSettings::AIRFRAMETYPE_GROUNDVEHICLECAR:
case SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEDIFFERENTIAL:
case SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEMOTORCYCLE:
{
if (configData.ground.GroundVehicleSteering1 > 0)
channelDesc[configData.ground.GroundVehicleSteering1-1] = QString("GroundSteering1");
if (configData.ground.GroundVehicleSteering2 > 0)
channelDesc[configData.ground.GroundVehicleSteering2-1] = QString("GroundSteering2");
if (configData.ground.GroundVehicleThrottle1 > 0)
channelDesc[configData.ground.GroundVehicleThrottle1-1] = QString("GroundThrottle1");
if (configData.ground.GroundVehicleThrottle2 > 0)
channelDesc[configData.ground.GroundVehicleThrottle2-1] = QString("GroundThrottle2");
return channelDesc;
}
break;
} }
return channelDesc; return channelDesc;

View File

@ -48,7 +48,7 @@ typedef struct {
} __attribute__((packed)) multiGUISettingsStruct; } __attribute__((packed)) multiGUISettingsStruct;
typedef struct { typedef struct {
uint SwasplateType:3; uint SwashplateType:3;
uint FirstServoIndex:2; uint FirstServoIndex:2;
uint CorrectionAngle:9; uint CorrectionAngle:9;
uint ccpmCollectivePassthroughState:1; uint ccpmCollectivePassthroughState:1;
@ -109,20 +109,23 @@ class GUIConfigDataManager: public QObject
GUIConfigDataManager(); GUIConfigDataManager();
~GUIConfigDataManager(); ~GUIConfigDataManager();
GUIConfigDataUnion GetConfigData();
void SetConfigData(GUIConfigDataUnion configData);
QStringList getChannelDescriptions();
void ResetActuators();
void ResetActuators(GUIConfigDataUnion* configData);
static const quint32 CHANNEL_NUMELEM = 10; static const quint32 CHANNEL_NUMELEM = 10;
friend class ConfigTaskWidget; friend class ConfigTaskWidget;
private: private:
private slots:
UAVObjectManager* getObjectManager(); UAVObjectManager* getObjectManager();
private slots:
public slots: public slots:
GUIConfigDataUnion GetConfigData();
void SetConfigData(GUIConfigDataUnion configData);
QStringList getChannelDescriptions();
protected: protected:

View File

@ -250,7 +250,7 @@ ConfigVehicleTypeWidget::~ConfigVehicleTypeWidget()
rather than a signal in the UI, because we want to force a fitInView of the quad shapes. rather than a signal in the UI, because we want to force a fitInView of the quad shapes.
This is because this method (fitinview) only works when the widget is shown. This is because this method (fitinview) only works when the widget is shown.
*/ */
void ConfigVehicleTypeWidget::switchAirframeType(int index){ void ConfigVehicleTypeWidget::switchAirframeType(int index){
m_aircraft->airframesWidget->setCurrentIndex(index); m_aircraft->airframesWidget->setCurrentIndex(index);
m_aircraft->quadShape->setSceneRect(quad->boundingRect()); m_aircraft->quadShape->setSceneRect(quad->boundingRect());
m_aircraft->quadShape->fitInView(quad, Qt::KeepAspectRatio); m_aircraft->quadShape->fitInView(quad, Qt::KeepAspectRatio);
@ -844,6 +844,16 @@ void ConfigVehicleTypeWidget::openHelp()
QDesktopServices::openUrl( QUrl("http://wiki.openpilot.org/display/Doc/Airframe+configuration", QUrl::StrictMode) ); QDesktopServices::openUrl( QUrl("http://wiki.openpilot.org/display/Doc/Airframe+configuration", QUrl::StrictMode) );
} }
/**
Helper function:
Sets the current index on supplied combobox to index
if it is within bounds 0 <= index < combobox.count()
*/
void ConfigVehicleTypeWidget::setComboCurrentIndex(QComboBox* box, int index)
{
if (index >= 0 && index < box->count())
box->setCurrentIndex(index);
}
/** /**
WHAT DOES THIS DO??? WHAT DOES THIS DO???

View File

@ -33,6 +33,7 @@
#include "uavobjectmanager.h" #include "uavobjectmanager.h"
#include "uavobject.h" #include "uavobject.h"
#include "uavtalk/telemetrymanager.h" #include "uavtalk/telemetrymanager.h"
#include "cfg_vehicletypes/guiconfigdata.h"
#include <QtGui/QWidget> #include <QtGui/QWidget>
#include <QList> #include <QList>
#include <QItemDelegate> #include <QItemDelegate>
@ -67,7 +68,7 @@ private:
void resetActuators(); void resetActuators();
//void setMixerChannel(int channelNumber, bool channelIsMotor, QList<double> vector); //void setMixerChannel(int channelNumber, bool channelIsMotor, QList<double> vector);
void setupQuadMotor(int channel, double roll, double pitch, double yaw); void setupQuadMotor(int channel, double roll, double pitch, double yaw);
void setComboCurrentIndex(QComboBox* box, int index);
QStringList mixerTypes; QStringList mixerTypes;
QStringList mixerVectors; QStringList mixerVectors;
QGraphicsSvgItem *quad; QGraphicsSvgItem *quad;
@ -75,6 +76,9 @@ private:
bool ffTuningPhase; bool ffTuningPhase;
UAVObject::Metadata accInitialData; UAVObject::Metadata accInitialData;
GUIConfigDataManager GUIManager;
GUIConfigDataUnion GUIConfigData;
private slots: private slots:
virtual void refreshWidgetsValues(); virtual void refreshWidgetsValues();
void refreshFixedWingWidgetsValues(QString frameType); void refreshFixedWingWidgetsValues(QString frameType);

View File

@ -2,7 +2,7 @@
<object name="SystemSettings" singleinstance="true" settings="true"> <object name="SystemSettings" singleinstance="true" settings="true">
<description>Select airframe type. Currently used by @ref ActuatorModule to choose mixing from @ref ActuatorDesired to @ref ActuatorCommand</description> <description>Select airframe type. Currently used by @ref ActuatorModule to choose mixing from @ref ActuatorDesired to @ref ActuatorCommand</description>
<field name="AirframeType" units="" type="enum" elements="1" options="FixedWing,FixedWingElevon,FixedWingVtail,VTOL,HeliCP,QuadX,QuadP,Hexa,Octo,Custom,HexaX,OctoV,OctoCoaxP,OctoCoaxX,HexaCoax,Tri,GroundVehicleCar,GroundVehicleDifferential,GroundVehicleMotorcycle" defaultvalue="FixedWing"/> <field name="AirframeType" units="" type="enum" elements="1" options="FixedWing,FixedWingElevon,FixedWingVtail,VTOL,HeliCP,QuadX,QuadP,Hexa,Octo,Custom,HexaX,OctoV,OctoCoaxP,OctoCoaxX,HexaCoax,Tri,GroundVehicleCar,GroundVehicleDifferential,GroundVehicleMotorcycle" defaultvalue="FixedWing"/>
<field name="GUIConfigData" units="bits" type="uint32" elements="2" defaultvalue="0"/> <field name="GUIConfigData" units="bits" type="uint32" elements="4" defaultvalue="0"/>
<access gcs="readwrite" flight="readwrite"/> <access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="true" updatemode="onchange" period="0"/> <telemetrygcs acked="true" updatemode="onchange" period="0"/>
<telemetryflight acked="true" updatemode="onchange" period="0"/> <telemetryflight acked="true" updatemode="onchange" period="0"/>