1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-15 07:29:15 +01:00

Start basics of single Aileron type support, here be dragons and some SVG

known issues
This commit is contained in:
Fredrik Larson 2014-08-23 01:01:01 +10:00
parent 9dbd2044c8
commit 18c3f8147a
7 changed files with 104 additions and 33 deletions

View File

@ -122,15 +122,15 @@ void ConnectionDiagram::setupGraphicsScene()
break;
case VehicleConfigurationSource::VEHICLE_FIXEDWING:
switch (m_configSource->getVehicleSubType()) {
case VehicleConfigurationSource::FIXED_WING_AILERON:
case VehicleConfigurationSource::FIXED_WING_DUAL_AILERON:
elementsToShow << "aileron";
break;
case VehicleConfigurationSource::FIXED_WING_AILERON:
elementsToShow << "ail2";
break;
case VehicleConfigurationSource::FIXED_WING_ELEVON:
elementsToShow << "elevon";
break;
case VehicleConfigurationSource::FIXED_WING_VTAIL:
elementsToShow << "vtail";
break;
default:
break;
}

View File

@ -82,8 +82,11 @@ void FixedWingPage::resizeEvent(QResizeEvent *event)
void FixedWingPage::setupFixedWingTypesCombo()
{
ui->typeCombo->addItem(tr("Aileron, Elevator, Rudder"), SetupWizard::FIXED_WING_AILERON);
m_descriptions << tr("This setup currently expects a traditional 4 channel setup including two ailerons (not connected by Y adapter), an elevator and a rudder. ");
ui->typeCombo->addItem(tr("Dual Aileron Servos"), SetupWizard::FIXED_WING_DUAL_AILERON);
m_descriptions << tr("This setup expects a traditional airframe setup using two independent aileron servos on their own channel (not connected by Y adapter), an elevator and a rudder. ");
ui->typeCombo->addItem(tr("Single Aileron Servo"), SetupWizard::FIXED_WING_AILERON);
m_descriptions << tr("This setup expects a traditional airframe setup using a single alieron servo or two connected by Y a adapter, an elevator and a rudder. ");
ui->typeCombo->addItem(tr("Elevon"), SetupWizard::FIXED_WING_ELEVON);
m_descriptions << tr("This setup currently expects a flying-wing setup, an elevon plus rudder setup is not yet supported. Setup should include only two elevons, and should explicitly not include a rudder.");
@ -102,15 +105,15 @@ void FixedWingPage::updateImageAndDescription()
QString description = m_descriptions.at(ui->typeCombo->currentIndex());
switch (type) {
case SetupWizard::FIXED_WING_AILERON:
case SetupWizard::FIXED_WING_DUAL_AILERON:
elementId = "aileron";
break;
case SetupWizard::FIXED_WING_AILERON:
elementId = "ail2";
break;
case SetupWizard::FIXED_WING_ELEVON:
elementId = "elevon";
break;
// case SetupWizard::FIXED_WING_VTAIL:
// elementId = "vtail";
// break;
default:
elementId = "";
break;

View File

@ -172,7 +172,7 @@ void OutputCalibrationPage::setupVehicle()
setupActuatorMinMaxAndNeutral(0, 5, 6);
break;
// Fixed Wing
case SetupWizard::FIXED_WING_AILERON:
case SetupWizard::FIXED_WING_DUAL_AILERON:
loadSVGFile(FIXEDWING_SVG_FILE);
m_wizardIndexes << 0 << 1 << 2 << 3 << 4 << 2 << 3 << 4 << 2 << 3 << 4 << 2 << 3 << 4;
m_vehicleElementIds << "aileron" << "aileron-frame" << "aileron-motor" << "aileron-ail-left" << "aileron-ail-right" << "aileron-rudder" << "aileron-elevator";
@ -181,6 +181,17 @@ void OutputCalibrationPage::setupVehicle()
setupActuatorMinMaxAndNeutral(3, 3, 5);
getWizard()->setActuatorSettings(m_actuatorSettings);
break;
case SetupWizard::FIXED_WING_AILERON:
loadSVGFile(FIXEDWING_SVG_FILE);
m_wizardIndexes << 0 << 1 << 2 << 3 << 4 << 2 << 3 << 4 << 2 << 3 << 4 << 2 << 3 << 4;
m_vehicleElementIds << "ail2" << "ail2-frame" << "ail2-motor" << "ail2-ail-left" << "ail2-ail-right" << "ail2-rudder" << "ail2-elevator";
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 2 << 2 << 3 << 3 << 3 << 4 << 4 << 4 << 5 << 5 << 5;
m_channelIndex << 0 << 2 << 0 << 0 << 0 << 1 << 1 << 1 << 3 << 3 << 3 << 4 << 4 << 4;
setupActuatorMinMaxAndNeutral(3, 3, 5);
getWizard()->setActuatorSettings(m_actuatorSettings);
break;
case SetupWizard::FIXED_WING_ELEVON:

View File

@ -260,15 +260,15 @@ QString SetupWizard::getSummaryText()
summary.append("<br>");
summary.append("<b>").append(tr("Vehicle sub type: ")).append("</b>");
switch (getVehicleSubType()) {
case SetupWizard::FIXED_WING_DUAL_AILERON:
summary.append(tr("Dual Aileron"));
break;
case SetupWizard::FIXED_WING_AILERON:
summary.append(tr("Aileron"));
break;
case SetupWizard::FIXED_WING_ELEVON:
summary.append(tr("Elevon"));
break;
// case SetupWizard::FIXED_WING_VTAIL:
// summary.append(tr("Vtail"));
// break;
default:
summary.append(tr("Unknown"));
break;

View File

@ -224,15 +224,15 @@ void VehicleConfigurationHelper::applyVehicleConfiguration()
case VehicleConfigurationSource::VEHICLE_FIXEDWING:
{
switch (m_configSource->getVehicleSubType()) {
case VehicleConfigurationSource::FIXED_WING_DUAL_AILERON:
setupDualAileron();
break;
case VehicleConfigurationSource::FIXED_WING_AILERON:
setupAileron();
break;
case VehicleConfigurationSource::FIXED_WING_ELEVON:
setupElevon();
break;
case VehicleConfigurationSource::FIXED_WING_VTAIL:
// TODO: Implement settings for VTail fixed wings
break;
default:
break;
}
@ -1582,6 +1582,66 @@ void VehicleConfigurationHelper::setupElevon()
applyMultiGUISettings(SystemSettings::AIRFRAMETYPE_FIXEDWINGELEVON, guiSettings);
}
void VehicleConfigurationHelper::setupDualAileron()
{
// Typical vehicle setup
// 1. Setup mixer data
// 2. Setup GUI data
// 3. Apply changes
mixerChannelSettings channels[10];
GUIConfigDataUnion guiSettings = getGUIConfigData();
// Motor (Chan 3)
channels[2].type = MIXER_TYPE_MOTOR;
channels[2].throttle1 = 100;
channels[2].throttle2 = 0;
channels[2].roll = 0;
channels[2].pitch = 0;
channels[2].yaw = 0;
// Aileron Servo 1 (Chan 1)
channels[0].type = MIXER_TYPE_SERVO;
channels[0].throttle1 = 0;
channels[0].throttle2 = 0;
channels[0].roll = -100;
channels[0].pitch = 0;
channels[0].yaw = 0;
// Aileron Servo 2 (Chan 6)
channels[5].type = MIXER_TYPE_SERVO;
channels[5].throttle1 = 0;
channels[5].throttle2 = 0;
channels[5].roll = 100;
channels[5].pitch = 0;
channels[5].yaw = 0;
// Elevator Servo (Chan 2)
channels[1].type = MIXER_TYPE_SERVO;
channels[1].throttle1 = 0;
channels[1].throttle2 = 0;
channels[1].roll = 0;
channels[1].pitch = 100;
channels[1].yaw = 0;
// Rudder Servo (Chan 4)
channels[3].type = MIXER_TYPE_SERVO;
channels[3].throttle1 = 0;
channels[3].throttle2 = 0;
channels[3].roll = 0;
channels[3].pitch = 0;
channels[3].yaw = 100;
guiSettings.fixedwing.FixedWingThrottle = 3;
guiSettings.fixedwing.FixedWingRoll1 = 1;
guiSettings.fixedwing.FixedWingRoll2 = 6;
guiSettings.fixedwing.FixedWingPitch1 = 2;
guiSettings.fixedwing.FixedWingYaw1 = 4;
applyMixerConfiguration(channels);
applyMultiGUISettings(SystemSettings::AIRFRAMETYPE_FIXEDWING, guiSettings);
}
void VehicleConfigurationHelper::setupAileron()
{
// Typical vehicle setup
@ -1592,6 +1652,7 @@ void VehicleConfigurationHelper::setupAileron()
mixerChannelSettings channels[10];
GUIConfigDataUnion guiSettings = getGUIConfigData();
// Motor (Chan 3)
channels[2].type = MIXER_TYPE_MOTOR;
channels[2].throttle1 = 100;
channels[2].throttle2 = 0;
@ -1599,39 +1660,34 @@ void VehicleConfigurationHelper::setupAileron()
channels[2].pitch = 0;
channels[2].yaw = 0;
// Aileron Servo (Chan 1)
channels[0].type = MIXER_TYPE_SERVO;
channels[0].throttle1 = 0;
channels[0].throttle2 = 0;
channels[0].roll = -100;
channels[0].roll = 100;
channels[0].pitch = 0;
channels[0].yaw = 0;
// Elevator Servo (Chan 2)
channels[1].type = MIXER_TYPE_SERVO;
channels[1].throttle1 = 0;
channels[1].throttle2 = 0;
channels[1].roll = 100;
channels[1].pitch = 0;
channels[1].roll = 0;
channels[1].pitch = 100;
channels[1].yaw = 0;
// Rudder Servo (Chan 4)
channels[3].type = MIXER_TYPE_SERVO;
channels[3].throttle1 = 0;
channels[3].throttle2 = 0;
channels[3].roll = 0;
channels[3].pitch = 100;
channels[3].yaw = 0;
channels[4].type = MIXER_TYPE_SERVO;
channels[4].throttle1 = 0;
channels[4].throttle2 = 0;
channels[4].roll = 0;
channels[4].pitch = 0;
channels[4].yaw = 100;
channels[3].pitch = 0;
channels[3].yaw = 100;
guiSettings.fixedwing.FixedWingThrottle = 3;
guiSettings.fixedwing.FixedWingRoll1 = 1;
guiSettings.fixedwing.FixedWingRoll2 = 2;
guiSettings.fixedwing.FixedWingPitch1 = 4;
guiSettings.fixedwing.FixedWingYaw1 = 5;
guiSettings.fixedwing.FixedWingPitch1 = 2;
guiSettings.fixedwing.FixedWingYaw1 = 4;
applyMixerConfiguration(channels);
applyMultiGUISettings(SystemSettings::AIRFRAMETYPE_FIXEDWING, guiSettings);

View File

@ -108,6 +108,7 @@ private:
void setupOctoCopter();
void setupVtail();
void setupElevon();
void setupDualAileron();
void setupAileron();
private slots:

View File

@ -60,7 +60,7 @@ public:
enum VEHICLE_SUB_TYPE { MULTI_ROTOR_UNKNOWN, MULTI_ROTOR_TRI_Y, MULTI_ROTOR_QUAD_X, MULTI_ROTOR_QUAD_PLUS,
MULTI_ROTOR_HEXA, MULTI_ROTOR_HEXA_H, MULTI_ROTOR_HEXA_X, MULTI_ROTOR_HEXA_COAX_Y, MULTI_ROTOR_OCTO,
MULTI_ROTOR_OCTO_X, MULTI_ROTOR_OCTO_V, MULTI_ROTOR_OCTO_COAX_X, MULTI_ROTOR_OCTO_COAX_PLUS,
FIXED_WING_AILERON, FIXED_WING_VTAIL, FIXED_WING_ELEVON, HELI_CCPM };
FIXED_WING_DUAL_AILERON, FIXED_WING_AILERON, FIXED_WING_ELEVON, HELI_CCPM };
enum ESC_TYPE { ESC_RAPID, ESC_LEGACY, ESC_UNKNOWN };
enum SERVO_TYPE { SERVO_ANALOG, SERVO_DIGITAL, SERVO_UNKNOWN };
enum INPUT_TYPE { INPUT_PWM, INPUT_PPM, INPUT_SBUS, INPUT_DSMX10, INPUT_DSMX11, INPUT_DSM2, INPUT_UNKNOWN };