Пример #1
0
bool GpsPage::validatePage(SelectionItem *selectedItem)
{
    getWizard()->setGpsType((SetupWizard::GPS_TYPE)selectedItem->id());
    if (getWizard()->getGpsType() == SetupWizard::GPS_DISABLED) {
        getWizard()->setAirspeedType(VehicleConfigurationSource::AIRSPEED_DISABLED);
    }
    return true;
}
Пример #2
0
void OutputCalibrationPage::enableButtons(bool enable)
{
    getWizard()->button(QWizard::NextButton)->setEnabled(enable);
    getWizard()->button(QWizard::CustomButton1)->setEnabled(enable);
    getWizard()->button(QWizard::CancelButton)->setEnabled(enable);
    getWizard()->button(QWizard::BackButton)->setEnabled(enable);
    QApplication::processEvents();
}
Пример #3
0
void SavePage::enableButtons(bool enable)
{
    ui->saveButton->setEnabled(enable);
    getWizard()->button(QWizard::NextButton)->setEnabled(enable);
    getWizard()->button(QWizard::CancelButton)->setEnabled(enable);
    getWizard()->button(QWizard::BackButton)->setEnabled(enable);
    QApplication::processEvents();
}
Пример #4
0
void AutoUpdatePage::enableButtons(bool enable)
{
    ui->startUpdate->setEnabled(enable);
    getWizard()->button(QWizard::NextButton)->setEnabled(enable);
    getWizard()->button(QWizard::CancelButton)->setEnabled(enable);
    getWizard()->button(QWizard::BackButton)->setEnabled(enable);
    getWizard()->button(QWizard::CustomButton1)->setEnabled(enable);
    QApplication::processEvents();
}
Пример #5
0
bool OutputPage::validatePage()
{
    if (ui->rapidESCButton->isChecked()) {
        getWizard()->setESCType(SetupWizard::ESC_RAPID);
    } else {
        getWizard()->setESCType(SetupWizard::ESC_LEGACY);
    }

    return true;
}
void EscCalibrationPage::enableButtons(bool enable)
{
    getWizard()->button(QWizard::NextButton)->setEnabled(enable);
    getWizard()->button(QWizard::CancelButton)->setEnabled(enable);
    getWizard()->button(QWizard::BackButton)->setEnabled(enable);
    getWizard()->button(QWizard::CustomButton1)->setEnabled(enable);
    ui->securityCheckBox1->setEnabled(enable);
    ui->securityCheckBox2->setEnabled(enable);
    ui->securityCheckBox3->setEnabled(enable);
    QApplication::processEvents();
}
Пример #7
0
bool VehiclePage::validatePage()
{
    if (ui->multirotorButton->isChecked()) {
        getWizard()->setVehicleType(SetupWizard::VEHICLE_MULTI);
    } else if (ui->fixedwingButton->isChecked()) {
        getWizard()->setVehicleType(SetupWizard::VEHICLE_FIXEDWING);
    } else if (ui->heliButton->isChecked()) {
        getWizard()->setVehicleType(SetupWizard::VEHICLE_HELI);
    } else if (ui->surfaceButton->isChecked()) {
        getWizard()->setVehicleType(SetupWizard::VEHICLE_SURFACE);
    } else {
        getWizard()->setVehicleType(SetupWizard::VEHICLE_UNKNOWN);
    }
    return true;
}
Пример #8
0
bool MultiPage::validatePage()
{
    SetupWizard::VEHICLE_SUB_TYPE type = (SetupWizard::VEHICLE_SUB_TYPE)ui->typeCombo->itemData(ui->typeCombo->currentIndex()).toInt();

    getWizard()->setVehicleSubType(type);
    return true;
}
Пример #9
0
int EscCalibrationPage::getHighOutputRate()
{
    if (getWizard()->getEscType() == SetupWizard::ESC_ONESHOT) {
        return HIGH_ONESHOT125_OUTPUT_PULSE_LENGTH_MICROSECONDS;
    } else {
        return HIGH_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS;
    }
}
Пример #10
0
//! Store the configuration data in the wizard
bool ConfigurePage::validatePage()
{
    quint32 bps = ui->cbBaudRate->currentText().toInt();
    quint32 maxRfPower = ui->cbRfPower->currentText().toFloat();
    quint8 minChannel = ui->sbMinChannel->value();
    quint8 maxChannel = ui->sbMaxChannel->value();
    enum Core::IBoardType::LinkMode linkMode;
    linkMode = (enum Core::IBoardType::LinkMode) ui->cbLinkMode->currentData().value<int>();

    getWizard()->setMaxBps(bps);
    getWizard()->setMaxRfPower(maxRfPower);
    getWizard()->setMinChannel(minChannel);
    getWizard()->setMaxChannel(maxChannel);
    getWizard()->setLinkMode(linkMode);

    return true;
}
int OutputCalibrationPage::getHighOutputRate()
{
    if (getWizard()->getEscType() == SetupWizard::ESC_ONESHOT) {
        return HIGH_OUTPUT_RATE_MILLISECONDS_ONESHOT125;
    } else {
        return HIGH_OUTPUT_RATE_MILLISECONDS_PWM;
    }
}
Пример #12
0
bool InputPage::restartNeeded(VehicleConfigurationSource::INPUT_TYPE selectedType)
{
    ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
    UAVObjectManager *uavoManager = pm->getObject<UAVObjectManager>();

    Q_ASSERT(uavoManager);
    HwSettings *hwSettings = HwSettings::GetInstance(uavoManager);
    HwSettings::DataFields data = hwSettings->getData();
    switch (getWizard()->getControllerType()) {
    case SetupWizard::CONTROLLER_CC:
    case SetupWizard::CONTROLLER_CC3D:
    {
        switch (selectedType) {
        case VehicleConfigurationSource::INPUT_PWM:
            return data.CC_RcvrPort != HwSettings::CC_RCVRPORT_PWMNOONESHOT;

        case VehicleConfigurationSource::INPUT_PPM:
            return data.CC_RcvrPort != HwSettings::CC_RCVRPORT_PPMNOONESHOT;

        case VehicleConfigurationSource::INPUT_SBUS:
            return data.CC_MainPort != HwSettings::CC_MAINPORT_SBUS;

        case VehicleConfigurationSource::INPUT_DSM:
            // TODO: Handle all of the DSM types ?? Which is most common?
            return data.CC_MainPort != HwSettings::CC_MAINPORT_DSM;

        default: return true;
        }
        break;
    }
    case SetupWizard::CONTROLLER_REVO:
    case SetupWizard::CONTROLLER_DISCOVERYF4:
    case SetupWizard::CONTROLLER_NANO:
    {
        switch (selectedType) {
        case VehicleConfigurationSource::INPUT_PWM:
            return data.RM_RcvrPort != HwSettings::RM_RCVRPORT_PWM;

        case VehicleConfigurationSource::INPUT_PPM:
            return data.RM_RcvrPort != HwSettings::RM_RCVRPORT_PPM;

        case VehicleConfigurationSource::INPUT_SBUS:
            return data.RM_MainPort != HwSettings::RM_MAINPORT_SBUS;

        case VehicleConfigurationSource::INPUT_SRXL:
            return data.RM_FlexiPort != HwSettings::RM_FLEXIPORT_SRXL;

        case VehicleConfigurationSource::INPUT_DSM:
            // TODO: Handle all of the DSM types ?? Which is most common?
            return data.RM_MainPort != HwSettings::RM_MAINPORT_DSM;

        default: return true;
        }
        break;
    }
    default: return true;
    }
}
Пример #13
0
void OutputCalibrationPage::customBackClicked()
{
    if (m_currentWizardIndex > 0) {
        m_currentWizardIndex--;
        setWizardPage();
    } else {
        getWizard()->back();
    }
}
void OutputCalibrationPage::enableAllMotorsCheckBox(bool enable)
{
    if (getWizard()->getVehicleType() == SetupWizard::VEHICLE_MULTI) {
        ui->calibrateAllMotors->setVisible(true);
        ui->calibrateAllMotors->setEnabled(enable);
    } else {
        ui->calibrateAllMotors->setChecked(false);
        ui->calibrateAllMotors->setVisible(false);
    }
}
Пример #15
0
bool OutputCalibrationPage::validatePage()
{
    if (isFinished()) {
        getWizard()->setActuatorSettings(m_actuatorSettings);
        return true;
    } else {
        m_currentWizardIndex++;
        setWizardPage();
        return false;
    }
}
Пример #16
0
void OutputCalibrationPage::startWizard()
{
    ui->calibrationStack->setCurrentIndex(m_wizardIndexes[0]);
    setupVehicleHighlightedPart();

    if (getWizard()->getESCType() == SetupWizard::ESC_ONESHOT) {
        ui->motorNeutralSlider->setMinimum(125);
        ui->motorNeutralSlider->setMaximum(140);
        ui->motorNeutralSlider->setPageStep(1);
        ui->motorNeutralSlider->setSingleStep(1);
    }
}
Пример #17
0
bool OutputCalibrationPage::checkAlarms()
{
    ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
    UAVObjectManager *uavObjectManager = pm->getObject<UAVObjectManager>();

    Q_ASSERT(uavObjectManager);
    SystemAlarms *systemAlarms    = SystemAlarms::GetInstance(uavObjectManager);
    Q_ASSERT(systemAlarms);
    SystemAlarms::DataFields data = systemAlarms->getData();

    if (data.Alarm[SystemAlarms::ALARM_ACTUATOR] != SystemAlarms::ALARM_OK) {
        QMessageBox mbox(this);
        mbox.setText(QString(tr("The actuator module is in an error state.\n\n"
                                "Please make sure the correct firmware version is used then "
                                "restart the wizard and try again. If the problem persists please "
                                "consult the openpilot.org support forum.")));
        mbox.setStandardButtons(QMessageBox::Ok);
        mbox.setIcon(QMessageBox::Critical);

        getWizard()->setWindowFlags(getWizard()->windowFlags() & ~Qt::WindowStaysOnTopHint);

        mbox.exec();

        getWizard()->setWindowFlags(getWizard()->windowFlags() | Qt::WindowStaysOnTopHint);
        getWizard()->setWindowIcon(qApp->windowIcon());
        getWizard()->show();
        return false;
    }
    return true;
}
void OutputCalibrationPage::setupActuatorMinMaxAndNeutral(int motorChannelStart, int motorChannelEnd, int totalUsedChannels)
{
    // Default values for the actuator settings, extra important for
    // servos since a value out of range can actually destroy the
    // vehicle if unlucky.
    // Motors are not that important. REMOVE propellers always!!
    OutputCalibrationUtil::startOutputCalibration();

    for (int servoid = 0; servoid < 12; servoid++) {
        if (servoid >= motorChannelStart && servoid <= motorChannelEnd) {
            // Set to motor safe values
            m_actuatorSettings[servoid].channelMin        = LOW_OUTPUT_RATE_MILLISECONDS;
            m_actuatorSettings[servoid].channelNeutral    = LOW_OUTPUT_RATE_MILLISECONDS;
            m_actuatorSettings[servoid].channelMax        = getHighOutputRate();
            m_actuatorSettings[servoid].isReversableMotor = false;
            // Car and Tank should use reversable Esc/motors
            if ((getWizard()->getVehicleSubType() == SetupWizard::GROUNDVEHICLE_CAR)
                || (getWizard()->getVehicleSubType() == SetupWizard::GROUNDVEHICLE_DIFFERENTIAL)) {
                m_actuatorSettings[servoid].channelNeutral    = NEUTRAL_OUTPUT_RATE_MILLISECONDS;
                m_actuatorSettings[servoid].isReversableMotor = true;
                // Set initial output value
                m_calibrationUtil->startChannelOutput(servoid, NEUTRAL_OUTPUT_RATE_MILLISECONDS);
                m_calibrationUtil->stopChannelOutput();
            }
        } else if (servoid < totalUsedChannels) {
            // Set to servo safe values
            m_actuatorSettings[servoid].channelMin     = NEUTRAL_OUTPUT_RATE_MILLISECONDS;
            m_actuatorSettings[servoid].channelNeutral = NEUTRAL_OUTPUT_RATE_MILLISECONDS;
            m_actuatorSettings[servoid].channelMax     = NEUTRAL_OUTPUT_RATE_MILLISECONDS;
            // Set initial servo output value
            m_calibrationUtil->startChannelOutput(servoid, NEUTRAL_OUTPUT_RATE_MILLISECONDS);
            m_calibrationUtil->stopChannelOutput();
        } else {
            // "Disable" these channels
            m_actuatorSettings[servoid].channelMin     = LOW_OUTPUT_RATE_MILLISECONDS;
            m_actuatorSettings[servoid].channelNeutral = LOW_OUTPUT_RATE_MILLISECONDS;
            m_actuatorSettings[servoid].channelMax     = LOW_OUTPUT_RATE_MILLISECONDS;
        }
    }
}
Пример #19
0
bool InputPage::validatePage()
{
    if (ui->pwmButton->isChecked()) {
        getWizard()->setInputType(SetupWizard::INPUT_PWM);
    } else if (ui->ppmButton->isChecked()) {
        getWizard()->setInputType(SetupWizard::INPUT_PPM);
    } else if (ui->sbusButton->isChecked()) {
        getWizard()->setInputType(SetupWizard::INPUT_SBUS);
    } else if (ui->spectrumButton->isChecked()) {
        getWizard()->setInputType(SetupWizard::INPUT_DSM);
    } else if (ui->multiplexButton->isChecked()) {
        getWizard()->setInputType(SetupWizard::INPUT_SRXL);
    } else {
        getWizard()->setInputType(SetupWizard::INPUT_PWM);
    }
    getWizard()->setRestartNeeded(getWizard()->isRestartNeeded() || restartNeeded(getWizard()->getInputType()));

    return true;
}
Пример #20
0
void SavePage::writeToController()
{
    if(!getWizard()->getConnectionManager()->isConnected()) {
        QMessageBox msgBox;
        msgBox.setText(tr("An OpenPilot controller must be connected to your computer to save the "
                          "configuration.\nPlease connect your OpenPilot controller to your computer and try again."));
        msgBox.setStandardButtons(QMessageBox::Ok);
        msgBox.setDefaultButton(QMessageBox::Ok);
        msgBox.exec();
        return;
    }

    enableButtons(false);
    VehicleConfigurationHelper helper(getWizard());
    connect(&helper, SIGNAL(saveProgress(int, int, QString)),this, SLOT(saveProgress(int, int, QString)));

    m_successfulWrite = helper.setupVehicle();

    disconnect(&helper, SIGNAL(saveProgress(int, int, QString)),this, SLOT(saveProgress(int, int, QString)));
    ui->saveProgressLabel->setText(QString("<font color='%1'>%2</font>").arg(m_successfulWrite ? "green" : "red", ui->saveProgressLabel->text()));
    enableButtons(true);

    emit completeChanged();
}
Пример #21
0
void EndPage::openInputWizard()
{
    ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
    ConfigGadgetFactory* configGadgetFactory = pm->getObject<ConfigGadgetFactory>();

    if(configGadgetFactory) {
        //Core::ModeManager::instance()->activateModeByWorkspaceName("Configuration");
        getWizard()->close();
        configGadgetFactory->startInputWizard();
    }
    else {
        QMessageBox msgBox;
        msgBox.setText(tr("Unable to open Input Wizard since the Config Plugin is not\nloaded in the current workspace."));
        msgBox.setStandardButtons(QMessageBox::Ok);
        msgBox.setDefaultButton(QMessageBox::Ok);
        msgBox.exec();
    }
}
void OutputCalibrationPage::customBackClicked()
{
    if (m_currentWizardIndex >= 0) {
        m_currentWizardIndex--;
        if (ui->calibrateAllMotors->isChecked()) {
            while (m_currentWizardIndex > 0 &&
                   m_wizardIndexes[m_currentWizardIndex] == 1 &&
                   m_wizardIndexes[m_currentWizardIndex - 1] == 1) {
                m_currentWizardIndex--;
            }
        }
    }

    if (m_currentWizardIndex >= 0) {
        setWizardPage();
    } else {
        getWizard()->back();
    }
}
bool OutputCalibrationPage::validatePage()
{
    if (!isFinished()) {
        m_currentWizardIndex++;
        if (ui->calibrateAllMotors->isChecked() &&
            m_currentWizardIndex > 0 &&
            m_wizardIndexes[m_currentWizardIndex - 1] == 1) {
            while (!isFinished() && m_wizardIndexes[m_currentWizardIndex] == 1) {
                m_currentWizardIndex++;
            }
        }
    }

    if (isFinished()) {
        getWizard()->setActuatorSettings(m_actuatorSettings);
        return true;
    } else {
        setWizardPage();
        return false;
    }
}
ControllerPage::ControllerPage(SetupWizard *wizard, QWidget *parent) :
    AbstractWizardPage(wizard, parent),
    ui(new Ui::ControllerPage)
{
    ui->setupUi(this);

    m_connectionManager = getWizard()->getConnectionManager();
    Q_ASSERT(m_connectionManager);
    connect(m_connectionManager, SIGNAL(availableDevicesChanged(QLinkedList<Core::DevListItem>)), this, SLOT(devicesChanged(QLinkedList<Core::DevListItem>)));

    ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance();
    Q_ASSERT(pluginManager);
    m_telemtryManager = pluginManager->getObject<TelemetryManager>();
    Q_ASSERT(m_telemtryManager);
    connect(m_telemtryManager, SIGNAL(connected()), this, SLOT(connectionStatusChanged()));
    connect(m_telemtryManager, SIGNAL(disconnected()), this, SLOT(connectionStatusChanged()));

    connect(ui->connectButton, SIGNAL(clicked()), this, SLOT(connectDisconnect()));

    setupBoardTypes();
    setupDeviceList();
}
void OutputCalibrationPage::setupVehicle()
{
    m_actuatorSettings = getWizard()->getActuatorSettings();
    m_wizardIndexes.clear();
    m_vehicleElementIds.clear();
    m_vehicleElementTypes.clear();
    m_vehicleHighlightElementIndexes.clear();
    m_channelIndex.clear();
    m_currentWizardIndex = 0;
    m_vehicleScene->clear();

    resetOutputCalibrationUtil();

    switch (getWizard()->getVehicleSubType()) {
    case SetupWizard::MULTI_ROTOR_TRI_Y:
        // Loads the SVG file resourse and sets the scene
        loadSVGFile(MULTI_SVG_FILE);

        // The m_wizardIndexes array contains the index of the QStackedWidget
        // in the page to use for each step.
        m_wizardIndexes << 0 << 1 << 1 << 1 << 2;

        // All element ids to load from the svg file and manage.
        m_vehicleElementIds << "tri" << "tri-frame" << "tri-m1" << "tri-m2" << "tri-m3" << "tri-s1";

        // The type of each element.
        m_vehicleElementTypes << FULL << FRAME << MOTOR << MOTOR << MOTOR << SERVO;

        // The index of the elementId to highlight ( not dim ) for each step
        // this is the index in the m_vehicleElementIds - 1.
        m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4;

        // The channel number to configure for each step.
        m_channelIndex << 0 << 0 << 1 << 2 << 3;

        setupActuatorMinMaxAndNeutral(0, 2, 4);

        getWizard()->setActuatorSettings(m_actuatorSettings);
        break;
    case SetupWizard::MULTI_ROTOR_QUAD_X:
        loadSVGFile(MULTI_SVG_FILE);
        m_wizardIndexes << 0 << 1 << 1 << 1 << 1;
        m_vehicleElementIds << "quad-x" << "quad-x-frame" << "quad-x-m1" << "quad-x-m2" << "quad-x-m3" << "quad-x-m4";
        m_vehicleElementTypes << FULL << FRAME << MOTOR << MOTOR << MOTOR << MOTOR;
        m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4;
        m_channelIndex << 0 << 0 << 1 << 2 << 3;
        setupActuatorMinMaxAndNeutral(0, 3, 4);
        break;
    case SetupWizard::MULTI_ROTOR_QUAD_PLUS:
        loadSVGFile(MULTI_SVG_FILE);
        m_wizardIndexes << 0 << 1 << 1 << 1 << 1;
        m_vehicleElementIds << "quad-p" << "quad-p-frame" << "quad-p-m1" << "quad-p-m2" << "quad-p-m3" << "quad-p-m4";
        m_vehicleElementTypes << FULL << FRAME << MOTOR << MOTOR << MOTOR << MOTOR;
        m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4;
        m_channelIndex << 0 << 0 << 1 << 2 << 3;
        setupActuatorMinMaxAndNeutral(0, 3, 4);
        break;
    case SetupWizard::MULTI_ROTOR_HEXA:
        loadSVGFile(MULTI_SVG_FILE);
        m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1;
        m_vehicleElementIds << "hexa" << "hexa-frame" << "hexa-m1" << "hexa-m2" << "hexa-m3" << "hexa-m4" << "hexa-m5" << "hexa-m6";
        m_vehicleElementTypes << FULL << FRAME << MOTOR << MOTOR << MOTOR << MOTOR << MOTOR << MOTOR;
        m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 5 << 6;
        m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4 << 5;
        setupActuatorMinMaxAndNeutral(0, 5, 6);
        break;
    case SetupWizard::MULTI_ROTOR_HEXA_COAX_Y:
        loadSVGFile(MULTI_SVG_FILE);
        m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1;
        m_vehicleElementIds << "hexa-y6" << "hexa-y6-frame" << "hexa-y6-m2" << "hexa-y6-m1" << "hexa-y6-m4" << "hexa-y6-m3" << "hexa-y6-m6" << "hexa-y6-m5";
        m_vehicleElementTypes << FULL << FRAME << MOTOR << MOTOR << MOTOR << MOTOR << MOTOR << MOTOR;
        m_vehicleHighlightElementIndexes << 0 << 2 << 1 << 4 << 3 << 6 << 5;
        m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4 << 5;
        setupActuatorMinMaxAndNeutral(0, 5, 6);
        break;
    case SetupWizard::MULTI_ROTOR_HEXA_H:
        loadSVGFile(MULTI_SVG_FILE);
        m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1;
        m_vehicleElementIds << "hexa-h" << "hexa-h-frame" << "hexa-h-m1" << "hexa-h-m2" << "hexa-h-m3" << "hexa-h-m4" << "hexa-h-m5" << "hexa-h-m6";
        m_vehicleElementTypes << FULL << FRAME << MOTOR << MOTOR << MOTOR << MOTOR << MOTOR << MOTOR;
        m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 5 << 6;
        m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4 << 5;
        setupActuatorMinMaxAndNeutral(0, 5, 6);
        break;
    case SetupWizard::MULTI_ROTOR_HEXA_X:
        loadSVGFile(MULTI_SVG_FILE);
        m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1;
        m_vehicleElementIds << "hexa-x" << "hexa-x-frame" << "hexa-x-m1" << "hexa-x-m2" << "hexa-x-m3" << "hexa-x-m4" << "hexa-x-m5" << "hexa-x-m6";
        m_vehicleElementTypes << FULL << FRAME << MOTOR << MOTOR << MOTOR << MOTOR << MOTOR << MOTOR;
        m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 5 << 6;
        m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4 << 5;
        setupActuatorMinMaxAndNeutral(0, 5, 6);
        break;
    // Fixed Wing
    case SetupWizard::FIXED_WING_DUAL_AILERON:
        loadSVGFile(FIXEDWING_SVG_FILE);
        m_wizardIndexes << 0 << 1 << 2 << 2 << 2 << 2;
        m_vehicleElementIds << "aileron" << "aileron-frame" << "aileron-motor" << "aileron-ail-left" << "aileron-ail-right" << "aileron-elevator" << "aileron-rudder";
        m_vehicleElementTypes << FULL << FRAME << MOTOR << SERVO << SERVO << SERVO << SERVO;
        m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 5;
        m_channelIndex << 0 << 2 << 0 << 5 << 1 << 3;

        setupActuatorMinMaxAndNeutral(2, 2, 6); // should be 5 instead 6 but output 5 is not used

        getWizard()->setActuatorSettings(m_actuatorSettings);
        break;
    case SetupWizard::FIXED_WING_AILERON:
        loadSVGFile(FIXEDWING_SVG_FILE);
        m_wizardIndexes << 0 << 1 << 2 << 2 << 2;
        m_vehicleElementIds << "singleaileron" << "singleaileron-frame" << "singleaileron-motor" << "singleaileron-aileron" << "singleaileron-elevator" << "singleaileron-rudder";
        m_vehicleElementTypes << FULL << FRAME << MOTOR << SERVO << SERVO << SERVO;
        m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4;
        m_channelIndex << 0 << 2 << 0 << 1 << 3;

        setupActuatorMinMaxAndNeutral(2, 2, 4);

        getWizard()->setActuatorSettings(m_actuatorSettings);
        break;
    case SetupWizard::FIXED_WING_ELEVON:
        loadSVGFile(FIXEDWING_SVG_FILE);
        m_wizardIndexes << 0 << 1 << 2 << 2;
        m_vehicleElementIds << "elevon" << "elevon-frame" << "elevon-motor" << "elevon-left" << "elevon-right";
        m_vehicleElementTypes << FULL << FRAME << MOTOR << SERVO << SERVO;
        m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3;
        m_channelIndex << 0 << 2 << 0 << 1;

        setupActuatorMinMaxAndNeutral(2, 2, 3);

        getWizard()->setActuatorSettings(m_actuatorSettings);
        break;
    case SetupWizard::FIXED_WING_VTAIL:
        loadSVGFile(FIXEDWING_SVG_FILE);
        m_wizardIndexes << 0 << 1 << 2 << 2 << 2 << 2;
        m_vehicleElementIds << "vtail" << "vtail-frame" << "vtail-motor" << "vtail-ail-left" << "vtail-ail-right" << "vtail-rudder-left" << "vtail-rudder-right";
        m_vehicleElementTypes << FULL << FRAME << MOTOR << SERVO << SERVO << SERVO << SERVO;
        m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 5;
        m_channelIndex << 0 << 2 << 0 << 5 << 3 << 1;

        setupActuatorMinMaxAndNeutral(2, 2, 6); // should be 5 instead 6 but output 5 is not used

        getWizard()->setActuatorSettings(m_actuatorSettings);
        break;

    // Ground vehicles
    case SetupWizard::GROUNDVEHICLE_CAR:
        loadSVGFile(GROUND_SVG_FILE);
        m_wizardIndexes << 0 << 1 << 2;
        m_vehicleElementIds << "car" << "car-frame" << "car-motor" << "car-steering";
        m_vehicleElementTypes << FULL << FRAME << MOTOR << SERVO;
        m_vehicleHighlightElementIndexes << 0 << 1 << 2;
        m_channelIndex << 0 << 1 << 0;

        setupActuatorMinMaxAndNeutral(1, 1, 2);

        getWizard()->setActuatorSettings(m_actuatorSettings);
        break;
    case SetupWizard::GROUNDVEHICLE_DIFFERENTIAL:
        loadSVGFile(GROUND_SVG_FILE);
        m_wizardIndexes << 0 << 1 << 1;
        m_vehicleElementIds << "tank" << "tank-frame" << "tank-left-motor" << "tank-right-motor";
        m_vehicleElementTypes << FULL << FRAME << MOTOR << MOTOR;
        m_vehicleHighlightElementIndexes << 0 << 1 << 2;
        m_channelIndex << 0 << 0 << 1;

        setupActuatorMinMaxAndNeutral(0, 1, 2);

        getWizard()->setActuatorSettings(m_actuatorSettings);
        break;
    case SetupWizard::GROUNDVEHICLE_MOTORCYCLE:
        loadSVGFile(GROUND_SVG_FILE);
        m_wizardIndexes << 0 << 1 << 2;
        m_vehicleElementIds << "motorbike" << "motorbike-frame" << "motorbike-motor" << "motorbike-steering";
        m_vehicleElementTypes << FULL << FRAME << MOTOR << SERVO;
        m_vehicleHighlightElementIndexes << 0 << 1 << 2;
        m_channelIndex << 0 << 1 << 0;

        setupActuatorMinMaxAndNeutral(1, 1, 2);

        getWizard()->setActuatorSettings(m_actuatorSettings);
        break;

    default:
        break;
    }

    setupVehicleItems();
}
Пример #26
0
void OutputCalibrationPage::setupVehicle()
{
    m_actuatorSettings = getWizard()->getActuatorSettings();
    m_wizardIndexes.clear();
    m_vehicleElementIds.clear();
    m_vehicleHighlightElementIndexes.clear();
    m_channelIndex.clear();
    m_currentWizardIndex = 0;
    m_vehicleScene->clear();
    switch (getWizard()->getVehicleSubType()) {
    case SetupWizard::MULTI_ROTOR_TRI_Y:
        m_wizardIndexes << 0 << 1 << 1 << 1 << 2 << 3 << 4;
        m_vehicleElementIds << "tri" << "tri-frame" << "tri-m1" << "tri-m2" << "tri-m3" << "tri-s1";
        m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 4 << 4;
        m_channelIndex << 0 << 0 << 1 << 2 << 3 << 3 << 3;
        m_actuatorSettings[3].channelMin     = 1500;
        m_actuatorSettings[3].channelNeutral = 1500;
        m_actuatorSettings[3].channelMax     = 1500;
        getWizard()->setActuatorSettings(m_actuatorSettings);
        break;
    case SetupWizard::MULTI_ROTOR_QUAD_X:
        m_wizardIndexes << 0 << 1 << 1 << 1 << 1;
        m_vehicleElementIds << "quad-x" << "quad-x-frame" << "quad-x-m1" << "quad-x-m2" << "quad-x-m3" << "quad-x-m4";
        m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4;
        m_channelIndex << 0 << 0 << 1 << 2 << 3;
        break;
    case SetupWizard::MULTI_ROTOR_QUAD_PLUS:
        m_wizardIndexes << 0 << 1 << 1 << 1 << 1;
        m_vehicleElementIds << "quad-p" << "quad-p-frame" << "quad-p-m1" << "quad-p-m2" << "quad-p-m3" << "quad-p-m4";
        m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4;
        m_channelIndex << 0 << 0 << 1 << 2 << 3;
        break;
    case SetupWizard::MULTI_ROTOR_HEXA:
        m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1;
        m_vehicleElementIds << "hexa" << "hexa-frame" << "hexa-m1" << "hexa-m2" << "hexa-m3" << "hexa-m4" << "hexa-m5" << "hexa-m6";
        m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 5 << 6;
        m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4 << 5;
        break;
    case SetupWizard::MULTI_ROTOR_HEXA_COAX_Y:
        m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1;
        m_vehicleElementIds << "hexa-y6" << "hexa-y6-frame" << "hexa-y6-m2" << "hexa-y6-m1" << "hexa-y6-m4" << "hexa-y6-m3" << "hexa-y6-m6" << "hexa-y6-m5";
        m_vehicleHighlightElementIndexes << 0 << 2 << 1 << 4 << 3 << 6 << 5;
        m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4 << 5;
        break;
    case SetupWizard::MULTI_ROTOR_HEXA_H:
        m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1;
        m_vehicleElementIds << "hexa-h" << "hexa-h-frame" << "hexa-h-m1" << "hexa-h-m2" << "hexa-h-m3" << "hexa-h-m4" << "hexa-h-m5" << "hexa-h-m6";
        m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 5 << 6;
        m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4 << 5;
        break;
    default:
        break;
    }

    VehicleConfigurationHelper helper(getWizard());
    helper.setupVehicle(false);

    if (m_calibrationUtil) {
        delete m_calibrationUtil;
        m_calibrationUtil = 0;
    }
    m_calibrationUtil = new OutputCalibrationUtil();

    setupVehicleItems();
}
bool ControllerPage::validatePage()
{
    getWizard()->setControllerType((SetupWizard::CONTROLLER_TYPE)ui->boardTypeCombo->itemData(ui->boardTypeCombo->currentIndex()).toInt());
    return true;
}
Пример #28
0
void SummaryPage::showDiagram()
{
    ConnectionDiagram diagram(this, getWizard());
    diagram.exec();
}
Пример #29
0
bool FixedWingPage::validatePage(SelectionItem *selectedItem)
{
    getWizard()->setVehicleSubType((SetupWizard::VEHICLE_SUB_TYPE)selectedItem->id());
    return true;
}
Пример #30
0
void AutoUpdatePage::updateStatus(uploader::AutoUpdateStep status, QVariant value)
{
    switch (status) {
    case uploader::WAITING_DISCONNECT:
        getWizard()->setWindowFlags(getWizard()->windowFlags() & ~Qt::WindowStaysOnTopHint);
        disableButtons();
        ui->statusLabel->setText(tr("Waiting for all boards to be disconnected"));
        break;
    case uploader::WAITING_CONNECT:
        getWizard()->setWindowFlags(getWizard()->windowFlags() | Qt::WindowStaysOnTopHint);
        getWizard()->setWindowIcon(qApp->windowIcon());
        disableButtons();
        getWizard()->show();
        ui->statusLabel->setText(tr("Please connect the board to the USB port (don't use external supply)"));
        ui->levellinProgressBar->setValue(value.toInt());
        break;
    case uploader::JUMP_TO_BL:
        ui->levellinProgressBar->setValue(0);
        ui->statusLabel->setText(tr("Board going into bootloader mode"));
        break;
    case uploader::LOADING_FW:
        ui->statusLabel->setText(tr("Loading firmware"));
        break;
    case uploader::UPLOADING_FW:
        ui->statusLabel->setText(tr("Uploading firmware"));
        ui->levellinProgressBar->setValue(value.toInt());
        break;
    case uploader::UPLOADING_DESC:
        ui->statusLabel->setText(tr("Uploading description"));
        break;
    case uploader::BOOTING:
        ui->statusLabel->setText(tr("Booting the board"));
        break;
    case uploader::SUCCESS:
        enableButtons(true);
        ui->statusLabel->setText(tr("Board Updated, please press the 'next' button below"));
        break;
    case uploader::FAILURE_FILENOTFOUND:
        getWizard()->setWindowFlags(getWizard()->windowFlags() | Qt::WindowStaysOnTopHint);
        getWizard()->setWindowIcon(qApp->windowIcon());
        enableButtons(true);
        getWizard()->show();
        ui->statusLabel->setText(tr("File for this controller board not packaged in GCS"));
    case uploader::FAILURE:
        getWizard()->setWindowFlags(getWizard()->windowFlags() | Qt::WindowStaysOnTopHint);
        getWizard()->setWindowIcon(qApp->windowIcon());
        enableButtons(true);
        getWizard()->show();
        ui->statusLabel->setText(tr("Something went wrong, you will have to manually upgrade the board using the uploader plugin"));
        break;
    default:
        Q_ASSERT(0);
    }
}