mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-17 02:52:12 +01:00
Delete commented code using direct vector object referencing
This commit is contained in:
parent
e9e6aece21
commit
b5ac4306d3
@ -303,6 +303,12 @@ bool ConfigFixedWingWidget::setupFrameFixedWing(QString airframeType)
|
||||
UAVDataObject* mixer = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
Q_ASSERT(mixer);
|
||||
|
||||
// ... and compute the matrix:
|
||||
// In order to make code a bit nicer, we assume:
|
||||
// - Channel dropdowns start with 'None', then 0 to 7
|
||||
|
||||
// 1. Assign the servo/motor/none for each channel
|
||||
|
||||
int channel;
|
||||
//disable all
|
||||
for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++)
|
||||
@ -340,83 +346,6 @@ bool ConfigFixedWingWidget::setupFrameFixedWing(QString airframeType)
|
||||
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH, 127);
|
||||
}
|
||||
|
||||
// ... and compute the matrix:
|
||||
// In order to make code a bit nicer, we assume:
|
||||
// - Channel 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;
|
||||
@ -456,6 +385,13 @@ bool ConfigFixedWingWidget::setupFrameElevon(QString airframeType)
|
||||
UAVDataObject* mixer = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
Q_ASSERT(mixer);
|
||||
|
||||
// Save the curve:
|
||||
// ... and compute the matrix:
|
||||
// In order to make code a bit nicer, we assume:
|
||||
// - Channel dropdowns start with 'None', then 0 to 7
|
||||
|
||||
// 1. Assign the servo/motor/none for each channel
|
||||
|
||||
int channel;
|
||||
double value;
|
||||
//disable all
|
||||
@ -493,81 +429,6 @@ bool ConfigFixedWingWidget::setupFrameElevon(QString airframeType)
|
||||
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, -value);
|
||||
}
|
||||
|
||||
|
||||
// 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:
|
||||
// - Channel 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;
|
||||
}
|
||||
@ -606,6 +467,13 @@ bool ConfigFixedWingWidget::setupFrameVtail(QString airframeType)
|
||||
UAVDataObject* mixer = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
Q_ASSERT(mixer);
|
||||
|
||||
// Save the curve:
|
||||
// ... and compute the matrix:
|
||||
// In order to make code a bit nicer, we assume:
|
||||
// - Channel dropdowns start with 'None', then 0 to 7
|
||||
|
||||
// 1. Assign the servo/motor/none for each channel
|
||||
|
||||
int channel;
|
||||
double value;
|
||||
//disable all
|
||||
@ -654,70 +522,6 @@ bool ConfigFixedWingWidget::setupFrameVtail(QString airframeType)
|
||||
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, -value);
|
||||
}
|
||||
|
||||
// ... and compute the matrix:
|
||||
// In order to make code a bit nicer, we assume:
|
||||
// - Channel 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;
|
||||
}
|
||||
|
@ -258,14 +258,9 @@ void ConfigGroundVehicleWidget::refreshWidgetsValues(QString frameType)
|
||||
obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
Q_ASSERT(obj);
|
||||
int channel = m_aircraft->gvMotor1ChannelBox->currentIndex()-1;
|
||||
if (channel >= 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);
|
||||
if (channel > -1) { // If for some reason the actuators were incoherent, we might fail here, hence the check.
|
||||
|
||||
m_aircraft->differentialSteeringSlider1->setValue(getMixerVectorValue(obj,channel,VehicleConfig::MIXERVECTOR_ROLL)*100);
|
||||
|
||||
// ti = field->getElementNames().indexOf("Pitch");
|
||||
m_aircraft->differentialSteeringSlider2->setValue(getMixerVectorValue(obj,channel,VehicleConfig::MIXERVECTOR_PITCH)*100);
|
||||
}
|
||||
}
|
||||
@ -297,7 +292,7 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleMotorcycle(QString airframeTyp
|
||||
throwConfigError(airframeType);
|
||||
|
||||
// - Motor, steering, and balance
|
||||
if (m_aircraft->gvMotor1ChannelBox->currentText() == "None" ||
|
||||
if (m_aircraft->gvMotor2ChannelBox->currentText() == "None" ||
|
||||
(m_aircraft->gvSteering1ChannelBox->currentText() == "None" ||
|
||||
m_aircraft->gvSteering2ChannelBox->currentText() == "None") )
|
||||
{
|
||||
@ -342,83 +337,6 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleMotorcycle(QString airframeTyp
|
||||
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, 127);
|
||||
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, 127);
|
||||
|
||||
// UAVObject* obj;
|
||||
// UAVObjectField* field;
|
||||
|
||||
// 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:
|
||||
// // - Channel dropdowns start with 'None', then 0 to 7
|
||||
|
||||
// // 1. Assign the servo/motor/none for each channel
|
||||
|
||||
// int tmpVal, ti;
|
||||
|
||||
// // Disable all output channels
|
||||
// foreach(QString mixer, mixerTypes) {
|
||||
// field = obj->getField(mixer);
|
||||
// Q_ASSERT(field);
|
||||
|
||||
// //Disable output channel
|
||||
// field->setValue("Disabled");
|
||||
|
||||
// }
|
||||
|
||||
// // Set all mixer values to zero
|
||||
// foreach(QString mixer, mixerVectors) {
|
||||
// field = obj->getField(mixer);
|
||||
// resetField(field);
|
||||
|
||||
// ti = field->getElementNames().indexOf("ThrottleCurve1");
|
||||
// field->setValue(0, ti);
|
||||
// ti = field->getElementNames().indexOf("ThrottleCurve2");
|
||||
// field->setValue(0, ti);
|
||||
// ti = field->getElementNames().indexOf("Yaw");
|
||||
// field->setValue(0, ti);
|
||||
// ti = field->getElementNames().indexOf("Pitch");
|
||||
// field->setValue(0, ti);
|
||||
// ti = field->getElementNames().indexOf("Roll");
|
||||
// field->setValue(0, ti);
|
||||
// }
|
||||
|
||||
// Motor
|
||||
// Setup motor
|
||||
// tmpVal = m_aircraft->gvMotor2ChannelBox->currentIndex()-1;
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo"); //Set motor mixer type to Servo
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("ThrottleCurve1"); //Set motor to full forward
|
||||
// field->setValue(127, ti);
|
||||
|
||||
// //Steering
|
||||
// // Setup steering
|
||||
// tmpVal = m_aircraft->gvSteering1ChannelBox->currentIndex()-1;
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo"); //Set motor mixer type to Servo
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("Yaw"); //Set steering response to roll
|
||||
// field->setValue(-127, ti);
|
||||
// ti = field->getElementNames().indexOf("Roll"); //Set steering response to roll
|
||||
// field->setValue(-127, ti);
|
||||
|
||||
// //Balancing
|
||||
// // Setup balancing servo
|
||||
// tmpVal = m_aircraft->gvSteering2ChannelBox->currentIndex()-1;
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo"); //Set motor mixer type to Servo
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("Yaw"); //Set balance response to yaw
|
||||
// field->setValue(127, ti);
|
||||
// ti = field->getElementNames().indexOf("Roll"); //Set balance response to roll
|
||||
// field->setValue(127, ti);
|
||||
|
||||
// obj->updated();
|
||||
|
||||
//Output success message
|
||||
m_aircraft->gvStatusLabel->setText("Mixer generated");
|
||||
|
||||
return true;
|
||||
@ -475,40 +393,6 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleDifferential(QString airframeT
|
||||
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127);
|
||||
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, -127);
|
||||
|
||||
// ... and compute the matrix:
|
||||
// In order to make code a bit nicer, we assume:
|
||||
// - Channel dropdowns start with 'None', then 0 to 7
|
||||
|
||||
// 1. Assign the servo/motor/none for each channel
|
||||
|
||||
// int tmpVal, ti;
|
||||
|
||||
|
||||
// Motor
|
||||
// Setup left motor
|
||||
// tmpVal = m_aircraft->gvMotor1ChannelBox->currentIndex()-1;
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo"); //Set motor mixer type to Servo
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("ThrottleCurve1"); //Set motor to full forward
|
||||
// field->setValue(127, ti);
|
||||
// ti = field->getElementNames().indexOf("Yaw"); //Set motor to turn right with increasing throttle
|
||||
// field->setValue(127, ti);
|
||||
|
||||
// // Setup right motor
|
||||
// tmpVal = m_aircraft->gvMotor2ChannelBox->currentIndex()-1;
|
||||
// field = obj->getField(mixerTypes.at(tmpVal));
|
||||
// field->setValue("Servo"); //Set motor mixer type to Servo
|
||||
// field = obj->getField(mixerVectors.at(tmpVal));
|
||||
// resetField(field);
|
||||
// ti = field->getElementNames().indexOf("ThrottleCurve2"); //Set motor to full forward
|
||||
// field->setValue(127, ti);
|
||||
// ti = field->getElementNames().indexOf("Yaw"); //Set motor to turn left with increasing throttle
|
||||
// field->setValue(-127, ti);
|
||||
|
||||
// obj->updated();
|
||||
|
||||
//Output success message
|
||||
m_aircraft->gvStatusLabel->setText("Mixer generated");
|
||||
|
||||
@ -537,24 +421,7 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleCar(QString airframeType)
|
||||
{
|
||||
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());
|
||||
// }
|
||||
|
||||
|
||||
// Now setup the channels:
|
||||
GUIConfigDataUnion config = GetConfigData();
|
||||
ResetActuators(&config);
|
||||
@ -592,62 +459,6 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleCar(QString airframeType)
|
||||
setMixerType(mixer,channel, VehicleConfig::MIXERTYPE_SERVO);
|
||||
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 127);
|
||||
|
||||
// ... and compute the matrix:
|
||||
// In order to make code a bit nicer, we assume:
|
||||
// - Channel dropdowns start with 'None', then 0 to 7
|
||||
|
||||
// 1. Assign the servo/motor/none for each channel
|
||||
|
||||
// Steering
|
||||
// Only set front steering if it is defined
|
||||
// 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 front steering. We're fine with it as long as we have rear steering
|
||||
|
||||
// // Only set rear steering if it is defined
|
||||
// tmpVal = m_aircraft->gvSteering2ChannelBox->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 rear steering. We're fine with it as long as we have front steering
|
||||
|
||||
// // Motor
|
||||
// // Only set front motor if it is defined
|
||||
// tmpVal = m_aircraft->gvMotor1ChannelBox->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("ThrottleCurve1");
|
||||
// field->setValue(127, ti);
|
||||
// }
|
||||
|
||||
// // Only set rear motor 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();
|
||||
|
||||
//Output success message
|
||||
m_aircraft->gvStatusLabel->setText("Mixer generated");
|
||||
|
||||
|
@ -536,15 +536,6 @@ QString ConfigMultiRotorWidget::updateConfigObjectsFromWidgets()
|
||||
setMixerType(mixerObj, channel, VehicleConfig::MIXERTYPE_SERVO);
|
||||
setMixerVectorValue(mixerObj, channel, VehicleConfig::MIXERVECTOR_YAW, 127);
|
||||
}
|
||||
|
||||
// int tmpVal = m_aircraft->triYawChannelBox->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");
|
||||
|
||||
@ -594,26 +585,6 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
m_aircraft->mrRollMixLevel->setValue( -value/1.27);
|
||||
|
||||
}
|
||||
// int tmpVal= m_aircraft->multiMotorChannelBox1->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->multiMotorChannelBox2->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
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNW);
|
||||
@ -621,6 +592,9 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox3,multi.VTOLMotorSE);
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox4,multi.VTOLMotorSW);
|
||||
|
||||
// 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.
|
||||
channel = m_aircraft->multiMotorChannelBox1->currentIndex() - 1;
|
||||
if (channel > -1)
|
||||
{
|
||||
@ -634,25 +608,7 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
m_aircraft->mrRollMixLevel->setValue( value/1.27);
|
||||
|
||||
}
|
||||
// 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->multiMotorChannelBox1->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
|
||||
|
||||
@ -663,6 +619,10 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox5,multi.VTOLMotorSW);
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox6,multi.VTOLMotorNW);
|
||||
|
||||
// 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.
|
||||
|
||||
channel = m_aircraft->multiMotorChannelBox1->currentIndex() - 1;
|
||||
if (channel > -1)
|
||||
{
|
||||
@ -672,35 +632,14 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
|
||||
m_aircraft->mrYawMixLevel->setValue( floor(-value/1.27) );
|
||||
|
||||
//change channels
|
||||
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
|
||||
m_aircraft->mrRollMixLevel->setValue( floor(1-value/1.27) );
|
||||
|
||||
}
|
||||
|
||||
// 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->multiMotorChannelBox1->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->multiMotorChannelBox2->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
|
||||
|
||||
@ -711,7 +650,10 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox5,multi.VTOLMotorW);
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox6,multi.VTOLMotorNW);
|
||||
|
||||
|
||||
// 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.
|
||||
|
||||
channel = m_aircraft->multiMotorChannelBox1->currentIndex() - 1;
|
||||
if (channel > -1)
|
||||
{
|
||||
@ -724,29 +666,7 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
|
||||
m_aircraft->mrRollMixLevel->setValue( floor(1-value/1.27) );
|
||||
|
||||
}
|
||||
|
||||
// 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->multiMotorChannelBox1->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->multiMotorChannelBox2->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
|
||||
|
||||
@ -757,7 +677,9 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox5,multi.VTOLMotorS);
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox6,multi.VTOLMotorSE);
|
||||
|
||||
|
||||
// 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.
|
||||
channel = m_aircraft->multiMotorChannelBox1->currentIndex() - 1;
|
||||
if (channel > -1)
|
||||
{
|
||||
@ -770,27 +692,7 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
|
||||
m_aircraft->mrRollMixLevel->setValue( value/1.27);
|
||||
|
||||
}
|
||||
|
||||
// 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->multiMotorChannelBox1->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
|
||||
@ -804,7 +706,9 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox7,multi.VTOLMotorW);
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox8,multi.VTOLMotorNW);
|
||||
|
||||
|
||||
// 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.
|
||||
channel = m_aircraft->multiMotorChannelBox1->currentIndex() - 1;
|
||||
if (channel > -1)
|
||||
{
|
||||
@ -815,7 +719,7 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
|
||||
m_aircraft->mrYawMixLevel->setValue( floor(-value/1.27) );
|
||||
|
||||
//change channelboxes
|
||||
//change channels
|
||||
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
|
||||
m_aircraft->mrRollMixLevel->setValue( floor(-value/1.27) );
|
||||
@ -827,6 +731,7 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
|
||||
m_aircraft->mrYawMixLevel->setValue( floor(-value/1.27) );
|
||||
|
||||
//change channels
|
||||
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
|
||||
m_aircraft->mrRollMixLevel->setValue( floor(-value/1.27) );
|
||||
@ -838,69 +743,13 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
|
||||
m_aircraft->mrYawMixLevel->setValue( floor(-value/1.27) );
|
||||
|
||||
//change channels
|
||||
channel = m_aircraft->multiMotorChannelBox3->currentIndex() - 1;
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
|
||||
m_aircraft->mrRollMixLevel->setValue( floor(-value/1.27) );
|
||||
}
|
||||
|
||||
}
|
||||
// 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->multiMotorChannelBox1->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->multiMotorChannelBox2->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->multiMotorChannelBox2->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->multiMotorChannelBox3->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
|
||||
|
||||
@ -913,6 +762,9 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox7,multi.VTOLMotorSW);
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox8,multi.VTOLMotorW);
|
||||
|
||||
// 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.
|
||||
channel = m_aircraft->multiMotorChannelBox1->currentIndex() - 1;
|
||||
if (channel > -1)
|
||||
{
|
||||
@ -925,26 +777,6 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
|
||||
m_aircraft->mrRollMixLevel->setValue( floor(value/1.27) );
|
||||
}
|
||||
|
||||
|
||||
// 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->multiMotorChannelBox1->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
|
||||
|
||||
@ -964,19 +796,6 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
m_aircraft->mrRollMixLevel->setValue( floor(value/1.27) );
|
||||
|
||||
}
|
||||
|
||||
// obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
// int tmpVal= m_aircraft->multiMotorChannelBox1->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);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@ -999,23 +818,6 @@ void ConfigMultiRotorWidget::setupQuadMotor(int channel, double pitch, double ro
|
||||
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, roll*127);
|
||||
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH, pitch*127);
|
||||
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, yaw*127);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user