mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-15 07:29:15 +01:00
Merge remote-tracking branch 'origin/laurent/OP-1422_Tricopter_mixers_settings' into next
This commit is contained in:
commit
8d691f0f48
@ -168,7 +168,7 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
|
||||
|
||||
m_aircraft->mrRollMixLevel->setValue(100);
|
||||
m_aircraft->mrPitchMixLevel->setValue(100);
|
||||
setYawMixLevel(50);
|
||||
setYawMixLevel(100);
|
||||
} else if (frameType == "QuadX" || frameType == "Quad X") {
|
||||
setComboCurrentIndex(m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Quad X"));
|
||||
|
||||
@ -366,43 +366,12 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox2, multi.VTOLMotorE);
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox3, multi.VTOLMotorS);
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox4, 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.
|
||||
|
||||
int channel = m_aircraft->multiMotorChannelBox1->currentIndex() - 1;
|
||||
if (channel > -1) {
|
||||
double value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH);
|
||||
m_aircraft->mrPitchMixLevel->setValue(qRound(value / 1.27));
|
||||
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
|
||||
setYawMixLevel(-qRound(value / 1.27));
|
||||
|
||||
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
|
||||
m_aircraft->mrRollMixLevel->setValue(-qRound(value / 1.27));
|
||||
}
|
||||
} else if (frameType == "QuadX") {
|
||||
// Motors 1/2/3/4 are: NW / NE / SE / SW
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1, multi.VTOLMotorNW);
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox2, multi.VTOLMotorNE);
|
||||
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.
|
||||
int channel = m_aircraft->multiMotorChannelBox1->currentIndex() - 1;
|
||||
if (channel > -1) {
|
||||
double value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH);
|
||||
m_aircraft->mrPitchMixLevel->setValue(qRound(value / 1.27));
|
||||
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
|
||||
setYawMixLevel(-qRound(value / 1.27));
|
||||
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
|
||||
m_aircraft->mrRollMixLevel->setValue(qRound(value / 1.27));
|
||||
}
|
||||
} else if (frameType == "Hexa") {
|
||||
// Motors 1/2/3 4/5/6 are: N / NE / SE / S / SW / NW
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1, multi.VTOLMotorN);
|
||||
@ -411,27 +380,6 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox4, multi.VTOLMotorS);
|
||||
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.
|
||||
|
||||
int channel = m_aircraft->multiMotorChannelBox1->currentIndex() - 1;
|
||||
if (channel > -1) {
|
||||
// get motor 1 value for Pitch
|
||||
double value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH);
|
||||
m_aircraft->mrPitchMixLevel->setValue(qRound(value / 1.27));
|
||||
|
||||
// get motor 2 value for Yaw and Roll
|
||||
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
|
||||
setYawMixLevel(qRound(value / 1.27));
|
||||
|
||||
// change channels
|
||||
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
|
||||
m_aircraft->mrRollMixLevel->setValue(-qRound(value / 1.27));
|
||||
}
|
||||
} else if (frameType == "HexaX") {
|
||||
// Motors 1/2/3 4/5/6 are: NE / E / SE / SW / W / NW
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1, multi.VTOLMotorNE);
|
||||
@ -440,26 +388,6 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox4, multi.VTOLMotorSW);
|
||||
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.
|
||||
|
||||
int channel = m_aircraft->multiMotorChannelBox1->currentIndex() - 1;
|
||||
if (channel > -1) {
|
||||
// get motor 1 value for Pitch
|
||||
double value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH);
|
||||
m_aircraft->mrPitchMixLevel->setValue(qRound(value / 1.27));
|
||||
|
||||
// get motor 2 value for Yaw and Roll
|
||||
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
|
||||
setYawMixLevel(qRound(value / 1.27));
|
||||
|
||||
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
|
||||
m_aircraft->mrRollMixLevel->setValue(-qRound(value / 1.27));
|
||||
}
|
||||
} else if (frameType == "HexaH") {
|
||||
// Motors 1/2/3 4/5/6 are: NE / E / SE / SW / W / NW
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1, multi.VTOLMotorNE);
|
||||
@ -468,26 +396,6 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox4, multi.VTOLMotorSW);
|
||||
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.
|
||||
|
||||
int channel = m_aircraft->multiMotorChannelBox1->currentIndex() - 1;
|
||||
if (channel > -1) {
|
||||
// get motor 1 value for Pitch
|
||||
double value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH);
|
||||
m_aircraft->mrPitchMixLevel->setValue(qRound(value / 1.27));
|
||||
|
||||
// get motor 2 value for Yaw and Roll
|
||||
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
|
||||
setYawMixLevel(qRound(value / 1.27));
|
||||
|
||||
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
|
||||
m_aircraft->mrRollMixLevel->setValue(-qRound(value / 1.27));
|
||||
}
|
||||
} else if (frameType == "HexaCoax") {
|
||||
// Motors 1/2/3 4/5/6 are: NW/W NE/E S/SE
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1, multi.VTOLMotorNW);
|
||||
@ -496,22 +404,6 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox4, multi.VTOLMotorE);
|
||||
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.
|
||||
int channel = m_aircraft->multiMotorChannelBox1->currentIndex() - 1;
|
||||
if (channel > -1) {
|
||||
double value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH);
|
||||
m_aircraft->mrPitchMixLevel->setValue(qRound(2 * value / 1.27));
|
||||
|
||||
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
|
||||
setYawMixLevel(qRound(value / 1.27));
|
||||
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
|
||||
m_aircraft->mrRollMixLevel->setValue(qRound(value / 1.27));
|
||||
}
|
||||
} else if (frameType == "Octo" || frameType == "OctoV" || frameType == "OctoCoaxP") {
|
||||
// Motors 1 to 8 are N / NE / E / etc
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1, multi.VTOLMotorN);
|
||||
@ -522,47 +414,6 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox6, multi.VTOLMotorSW);
|
||||
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.
|
||||
int channel = m_aircraft->multiMotorChannelBox1->currentIndex() - 1;
|
||||
if (channel > -1) {
|
||||
if (frameType == "Octo") {
|
||||
double value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH);
|
||||
m_aircraft->mrPitchMixLevel->setValue(qRound(value / 1.27));
|
||||
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
|
||||
setYawMixLevel(-qRound(value / 1.27));
|
||||
|
||||
// Get M3 Roll value
|
||||
channel = m_aircraft->multiMotorChannelBox3->currentIndex() - 1;
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
|
||||
m_aircraft->mrRollMixLevel->setValue(-qRound(value / 1.27));
|
||||
} else if (frameType == "OctoV") {
|
||||
double value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH);
|
||||
m_aircraft->mrPitchMixLevel->setValue(qRound(value / 1.27));
|
||||
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
|
||||
setYawMixLevel(-qRound(value / 1.27));
|
||||
|
||||
// change channels
|
||||
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
|
||||
m_aircraft->mrRollMixLevel->setValue(-qRound(value / 1.27));
|
||||
} else if (frameType == "OctoCoaxP") {
|
||||
double value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH);
|
||||
m_aircraft->mrPitchMixLevel->setValue(qRound(value / 1.27));
|
||||
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
|
||||
setYawMixLevel(-qRound(value / 1.27));
|
||||
|
||||
// change channels
|
||||
channel = m_aircraft->multiMotorChannelBox3->currentIndex() - 1;
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
|
||||
m_aircraft->mrRollMixLevel->setValue(-qRound(value / 1.27));
|
||||
}
|
||||
}
|
||||
} else if (frameType == "OctoX") {
|
||||
// Motors 1 to 8 are NNE / ENE / ESE / etc
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1, multi.VTOLMotorNNE);
|
||||
@ -573,24 +424,6 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox6, multi.VTOLMotorWSW);
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox7, multi.VTOLMotorWNW);
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox8, multi.VTOLMotorNNW);
|
||||
|
||||
|
||||
// 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.
|
||||
int channel = m_aircraft->multiMotorChannelBox1->currentIndex() - 1;
|
||||
if (channel > -1) {
|
||||
double value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH);
|
||||
m_aircraft->mrPitchMixLevel->setValue(qRound(value / 1.27));
|
||||
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
|
||||
setYawMixLevel(-qRound(value / 1.27));
|
||||
|
||||
// Get M2 Roll value
|
||||
channel = m_aircraft->multiMotorChannelBox2->currentIndex() - 1;
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
|
||||
m_aircraft->mrRollMixLevel->setValue(-qRound(value / 1.27));
|
||||
}
|
||||
} else if (frameType == "OctoCoaxX") {
|
||||
// Motors 1 to 8 are N / NE / E / etc
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1, multi.VTOLMotorNW);
|
||||
@ -601,39 +434,19 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox6, multi.VTOLMotorS);
|
||||
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.
|
||||
int channel = m_aircraft->multiMotorChannelBox1->currentIndex() - 1;
|
||||
if (channel > -1) {
|
||||
double value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH);
|
||||
m_aircraft->mrPitchMixLevel->setValue(qRound(value / 1.27));
|
||||
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW);
|
||||
setYawMixLevel(-qRound(value / 1.27));
|
||||
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
|
||||
m_aircraft->mrRollMixLevel->setValue(qRound(value / 1.27));
|
||||
}
|
||||
} else if (frameType == "Tri") {
|
||||
// Motors 1 to 8 are N / NE / E / etc
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1, multi.VTOLMotorNW);
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox2, multi.VTOLMotorNE);
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox3, multi.VTOLMotorS);
|
||||
setComboCurrentIndex(m_aircraft->multiMotorChannelBox4, multi.VTOLMotorS);
|
||||
setComboCurrentIndex(m_aircraft->triYawChannelBox, multi.TRIYaw);
|
||||
|
||||
int channel = m_aircraft->multiMotorChannelBox1->currentIndex() - 1;
|
||||
if (channel > -1) {
|
||||
double value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH);
|
||||
m_aircraft->mrPitchMixLevel->setValue(qRound(2 * value / 1.27));
|
||||
|
||||
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
|
||||
m_aircraft->mrRollMixLevel->setValue(qRound(value / 1.27));
|
||||
}
|
||||
}
|
||||
|
||||
// Now, read mixing values stored on board and applies values on sliders.
|
||||
m_aircraft->mrPitchMixLevel->setValue(getMixerValue(mixer, "MixerValuePitch"));
|
||||
m_aircraft->mrRollMixLevel->setValue(getMixerValue(mixer, "MixerValueRoll"));
|
||||
m_aircraft->mrYawMixLevel->setValue(getMixerValue(mixer, "MixerValueYaw"));
|
||||
|
||||
updateAirframe(frameType);
|
||||
}
|
||||
|
||||
@ -890,7 +703,9 @@ QString ConfigMultiRotorWidget::updateConfigObjectsFromWidgets()
|
||||
int channel = m_aircraft->triYawChannelBox->currentIndex() - 1;
|
||||
if (channel > -1) {
|
||||
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO);
|
||||
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, 127);
|
||||
|
||||
// Tricopter : Yaw mix slider value applies to servo (was fixed)
|
||||
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, getMixerValue(mixer, "MixerValueYaw") * 1.27);
|
||||
}
|
||||
|
||||
m_aircraft->mrStatusLabel->setText(tr("Configuration OK"));
|
||||
@ -969,13 +784,18 @@ void ConfigMultiRotorWidget::setupQuadMotor(int channel, double pitch, double ro
|
||||
|
||||
Q_ASSERT(mixer);
|
||||
|
||||
// Normalize mixer values, allow a well balanced mixer saved
|
||||
pitch = (pitch < 0) ? qFloor(pitch * 127) : qCeil(pitch * 127);
|
||||
roll = (roll < 0) ? qFloor(roll * 127) : qCeil(roll * 127);
|
||||
yaw = (yaw < 0) ? qFloor(yaw * 127) : qCeil(yaw * 127);
|
||||
|
||||
setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_MOTOR);
|
||||
|
||||
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE1, 127);
|
||||
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_THROTTLECURVE2, 0);
|
||||
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, roll * 127);
|
||||
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH, pitch * 127);
|
||||
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, yaw * 127);
|
||||
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL, roll);
|
||||
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH, pitch);
|
||||
setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, yaw);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1184,6 +1004,10 @@ bool ConfigMultiRotorWidget::setupMultiRotorMixer(double mixerFactors[8][3])
|
||||
invertMotors = m_aircraft->MultirotorRevMixerCheckBox->isChecked();
|
||||
double yFactor = (invertMotors ? -1.0 : 1.0) * (double)m_aircraft->mrYawMixLevel->value() / 100.0;
|
||||
|
||||
setMixerValue(mixer, "MixerValueRoll", m_aircraft->mrRollMixLevel->value());
|
||||
setMixerValue(mixer, "MixerValuePitch", m_aircraft->mrPitchMixLevel->value());
|
||||
setMixerValue(mixer, "MixerValueYaw", m_aircraft->mrYawMixLevel->value());
|
||||
|
||||
QList<QComboBox *> mmList;
|
||||
mmList << m_aircraft->multiMotorChannelBox1 << m_aircraft->multiMotorChannelBox2
|
||||
<< m_aircraft->multiMotorChannelBox3 << m_aircraft->multiMotorChannelBox4
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "stabilizationsettings.h"
|
||||
#include "revocalibration.h"
|
||||
#include "accelgyrosettings.h"
|
||||
#include <QtCore/qmath.h>
|
||||
|
||||
const qint16 VehicleConfigurationHelper::LEGACY_ESC_FREQUENCE = 50;
|
||||
const qint16 VehicleConfigurationHelper::RAPID_ESC_FREQUENCE = 400;
|
||||
@ -440,9 +441,79 @@ void VehicleConfigurationHelper::applyMixerConfiguration(mixerChannelSettings ch
|
||||
Q_ASSERT(field);
|
||||
field->setValue((channels[i].throttle1 * 127) / 100, 0);
|
||||
field->setValue((channels[i].throttle2 * 127) / 100, 1);
|
||||
field->setValue((channels[i].roll * 127) / 100, 2);
|
||||
field->setValue((channels[i].pitch * 127) / 100, 3);
|
||||
field->setValue((channels[i].yaw * 127) / 100, 4);
|
||||
|
||||
// Normalize mixer values, allow a well balanced mixer saved
|
||||
if (channels[i].roll < 0) {
|
||||
field->setValue(qFloor((double)(channels[i].roll * 127) / 100), 2);
|
||||
} else {
|
||||
field->setValue(qCeil((double)(channels[i].roll * 127) / 100), 2);
|
||||
}
|
||||
|
||||
if (channels[i].pitch < 0) {
|
||||
field->setValue(qFloor((double)(channels[i].pitch * 127) / 100), 3);
|
||||
} else {
|
||||
field->setValue(qCeil((double)(channels[i].pitch * 127) / 100), 3);
|
||||
}
|
||||
|
||||
if (channels[i].yaw < 0) {
|
||||
field->setValue(qFloor((double)(channels[i].yaw * 127) / 100), 4);
|
||||
} else {
|
||||
field->setValue(qCeil((double)(channels[i].yaw * 127) / 100), 4);
|
||||
}
|
||||
}
|
||||
|
||||
MixerSettings *mixSettings = MixerSettings::GetInstance(m_uavoManager);
|
||||
|
||||
// Save mixer values for sliders
|
||||
switch (m_configSource->getVehicleType()) {
|
||||
case VehicleConfigurationSource::VEHICLE_MULTI:
|
||||
{
|
||||
switch (m_configSource->getVehicleSubType()) {
|
||||
case VehicleConfigurationSource::MULTI_ROTOR_TRI_Y:
|
||||
case VehicleConfigurationSource::MULTI_ROTOR_HEXA:
|
||||
case VehicleConfigurationSource::MULTI_ROTOR_HEXA_H:
|
||||
case VehicleConfigurationSource::MULTI_ROTOR_HEXA_X:
|
||||
mixSettings->setMixerValueRoll(100);
|
||||
mixSettings->setMixerValuePitch(100);
|
||||
mixSettings->setMixerValueYaw(100);
|
||||
break;
|
||||
case VehicleConfigurationSource::MULTI_ROTOR_QUAD_X:
|
||||
mixSettings->setMixerValueRoll(50);
|
||||
mixSettings->setMixerValuePitch(50);
|
||||
mixSettings->setMixerValueYaw(50);
|
||||
break;
|
||||
case VehicleConfigurationSource::MULTI_ROTOR_QUAD_PLUS:
|
||||
mixSettings->setMixerValueRoll(100);
|
||||
mixSettings->setMixerValuePitch(100);
|
||||
mixSettings->setMixerValueYaw(50);
|
||||
break;
|
||||
case VehicleConfigurationSource::MULTI_ROTOR_HEXA_COAX_Y:
|
||||
mixSettings->setMixerValueRoll(100);
|
||||
mixSettings->setMixerValuePitch(50);
|
||||
mixSettings->setMixerValueYaw(66);
|
||||
break;
|
||||
case VehicleConfigurationSource::MULTI_ROTOR_OCTO:
|
||||
case VehicleConfigurationSource::MULTI_ROTOR_OCTO_X:
|
||||
mixSettings->setMixerValueRoll(100);
|
||||
mixSettings->setMixerValuePitch(100);
|
||||
mixSettings->setMixerValueYaw(100);
|
||||
break;
|
||||
case VehicleConfigurationSource::MULTI_ROTOR_OCTO_COAX_X:
|
||||
case VehicleConfigurationSource::MULTI_ROTOR_OCTO_COAX_PLUS:
|
||||
case VehicleConfigurationSource::MULTI_ROTOR_OCTO_V:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VehicleConfigurationSource::VEHICLE_FIXEDWING:
|
||||
case VehicleConfigurationSource::VEHICLE_HELI:
|
||||
case VehicleConfigurationSource::VEHICLE_SURFACE:
|
||||
// TODO: Implement mixer / sliders settings for other vehicle types?
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Apply updates
|
||||
@ -1014,7 +1085,7 @@ void VehicleConfigurationHelper::setupHexaCopter()
|
||||
}
|
||||
case VehicleConfigurationSource::MULTI_ROTOR_HEXA_X:
|
||||
{
|
||||
frame = SystemSettings::AIRFRAMETYPE_HEXAH;
|
||||
frame = SystemSettings::AIRFRAMETYPE_HEXAX;
|
||||
// HexaX according to new mixer table and pitch-roll-yaw mixing at 100%
|
||||
// Pitch Roll Yaw
|
||||
// M1 { 1, -0.5, -1 },
|
||||
|
@ -66,7 +66,8 @@ signals:
|
||||
private:
|
||||
static const int MIXER_TYPE_DISABLED = 0;
|
||||
static const int MIXER_TYPE_MOTOR = 1;
|
||||
static const int MIXER_TYPE_SERVO = 2;
|
||||
static const int MIXER_TYPE_REVERSABLEMOTOR = 2;
|
||||
static const int MIXER_TYPE_SERVO = 3;
|
||||
static const float DEFAULT_ENABLED_ACCEL_TAU = 0.1;
|
||||
|
||||
VehicleConfigurationSource *m_configSource;
|
||||
|
@ -2,6 +2,9 @@
|
||||
<object name="MixerSettings" singleinstance="true" settings="true" category="Control">
|
||||
<description>Settings for the @ref ActuatorModule that controls the channel assignments for the mixer based on AircraftType</description>
|
||||
<field name="MaxAccel" units="units/sec" type="float" elements="1" defaultvalue="1000"/>
|
||||
<field name="MixerValueRoll" units="percent" type="int8" elements="1" defaultvalue="100"/>
|
||||
<field name="MixerValuePitch" units="percent" type="int8" elements="1" defaultvalue="100"/>
|
||||
<field name="MixerValueYaw" units="percent" type="int8" elements="1" defaultvalue="50"/>
|
||||
<field name="FeedForward" units="" type="float" elements="1" defaultvalue="0"/>
|
||||
<field name="AccelTime" units="ms" type="float" elements="1" defaultvalue="0"/>
|
||||
<field name="DecelTime" units="ms" type="float" elements="1" defaultvalue="0"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user