• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ UAVObjectField类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中UAVObjectField的典型用法代码示例。如果您正苦于以下问题:C++ UAVObjectField类的具体用法?C++ UAVObjectField怎么用?C++ UAVObjectField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了UAVObjectField类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Q_ASSERT

void ConfigStabilizationWidget::resetThrottleCurveToDefault()
{
    UAVDataObject *defaultStabBank = (UAVDataObject *)getObjectManager()->getObject(QString(m_stabTabBars.at(0)->tabData(m_currentStabSettingsBank).toString()));

    Q_ASSERT(defaultStabBank);
    defaultStabBank = defaultStabBank->dirtyClone();

    UAVObjectField *field = defaultStabBank->getField("ThrustPIDScaleCurve");
    Q_ASSERT(field);

    QList<double> curve;
    for (quint32 i = 0; i < field->getNumElements(); i++) {
        curve.append(field->getValue(i).toDouble());
    }

    ui->thrustPIDScalingCurve->setCurve(&curve);

    field = defaultStabBank->getField("EnableThrustPIDScaling");
    Q_ASSERT(field);

    bool enabled = field->getValue() == "TRUE";
    ui->enableThrustPIDScalingCheckBox->setChecked(enabled);
    ui->thrustPIDScalingCurve->setEnabled(enabled);

    delete defaultStabBank;
}
开发者ID:CaptainFalco,项目名称:OpenPilot,代码行数:26,代码来源:configstabilizationwidget.cpp


示例2: assignOutputChannel

/**
  * Set the dropdown option for a channel output assignement
  */
void ConfigServoWidget::assignOutputChannel(UAVDataObject *obj, QString str)
{
    UAVObjectField* field = obj->getField(str);
    QStringList options = field->getOptions();
    switch (options.indexOf(field->getValue().toString())) {
    case 0:
        m_config->ch0Output->setCurrentIndex(m_config->ch0Output->findText(str));
        break;
    case 1:
        m_config->ch1Output->setCurrentIndex(m_config->ch1Output->findText(str));
        break;
    case 2:
        m_config->ch2Output->setCurrentIndex(m_config->ch2Output->findText(str));
        break;
    case 3:
        m_config->ch3Output->setCurrentIndex(m_config->ch3Output->findText(str));
        break;
    case 4:
        m_config->ch4Output->setCurrentIndex(m_config->ch4Output->findText(str));
        break;
    case 5:
        m_config->ch5Output->setCurrentIndex(m_config->ch5Output->findText(str));
        break;
    case 6:
        m_config->ch6Output->setCurrentIndex(m_config->ch6Output->findText(str));
        break;
    case 7:
        m_config->ch7Output->setCurrentIndex(m_config->ch7Output->findText(str));
        break;
    }
}
开发者ID:zhao0079,项目名称:software,代码行数:34,代码来源:configservowidget.cpp


示例3: enableButtons

void EscCalibrationPage::startButtonClicked()
{
    if (!m_isCalibrating) {
        m_isCalibrating = true;
        ui->startButton->setEnabled(false);
        enableButtons(false);
        ui->outputHigh->setEnabled(true);
        ui->outputLow->setEnabled(false);
        ui->nonconnectedLabel->setEnabled(false);
        ui->connectedLabel->setEnabled(true);
        ui->outputLevel->setText(QString(tr("%1 µs")).arg(HIGH_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS));
        ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
        UAVObjectManager *uavoManager = pm->getObject<UAVObjectManager>();
        Q_ASSERT(uavoManager);
        MixerSettings *mSettings = MixerSettings::GetInstance(uavoManager);
        Q_ASSERT(mSettings);
        QString mixerTypePattern = "Mixer%1Type";

        OutputCalibrationUtil::startOutputCalibration();
        for (quint32 i = 0; i < ActuatorSettings::CHANNELADDR_NUMELEM; i++) {
            UAVObjectField *field = mSettings->getField(mixerTypePattern.arg(i + 1));
            Q_ASSERT(field);
            if (field->getValue().toString() == field->getOptions().at(VehicleConfigurationHelper::MIXER_TYPE_MOTOR)) {
                m_outputChannels << i;
            }
        }
        m_outputUtil.startChannelOutput(m_outputChannels, OFF_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS);
        QThread::msleep(100);
        m_outputUtil.setChannelOutputValue(HIGH_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS);

        ui->stopButton->setEnabled(true);
    }
}
开发者ID:FabianFrancoRoldan,项目名称:OpenPilot,代码行数:33,代码来源:esccalibrationpage.cpp


示例4: Q_UNUSED

/**
   Refreshes the current value of the SystemSettings which holds the aircraft type
   Note: The default behavior of ConfigTaskWidget is bypassed.
   Therefore no automatic synchronization of UAV Objects to UI is done.
 */
void ConfigVehicleTypeWidget::refreshWidgetsValues(UAVObject *o)
{
    Q_UNUSED(o);

    if (!allObjectsUpdated()) {
        return;
    }

    bool dirty = isDirty();

    // Get the Airframe type from the system settings:
    UAVDataObject *system = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("SystemSettings")));
    Q_ASSERT(system);

    UAVObjectField *field = system->getField(QString("AirframeType"));
    Q_ASSERT(field);

    // At this stage, we will need to have some hardcoded settings in this code
    QString frameType = field->getValue().toString();

    // Always update custom tab from others airframe settings : debug/learn hardcoded mixers
    int category = frameCategory("Custom");
    m_aircraft->aircraftType->setCurrentIndex(category);

    VehicleConfig *vehicleConfig = getVehicleConfigWidget(category);

    if (vehicleConfig) {
        vehicleConfig->refreshWidgetsValues("Custom");
    }

    // Switch to Airframe currently used
    category = frameCategory(frameType);

    if (frameType != "Custom") {
        m_aircraft->aircraftType->setCurrentIndex(category);

        VehicleConfig *vehicleConfig = getVehicleConfigWidget(category);

        if (vehicleConfig) {
            vehicleConfig->refreshWidgetsValues(frameType);
        }
    }

    field = system->getField(QString("VehicleName"));
    Q_ASSERT(field);
    QString name;
    for (uint i = 0; i < field->getNumElements(); ++i) {
        QChar chr = field->getValue(i).toChar();
        if (chr != 0) {
            name.append(chr);
        } else {
            break;
        }
    }
    m_aircraft->nameEdit->setText(name);

    updateFeedForwardUI();

    setDirty(dirty);
}
开发者ID:FabianFrancoRoldan,项目名称:OpenPilot,代码行数:65,代码来源:configvehicletypewidget.cpp


示例5: isDirty

void ConfigStabilizationWidget::updateThrottleCurveFromObject()
{
    bool dirty = isDirty();
    UAVObject *stabBank = getObjectManager()->getObject(QString(m_stabTabBars.at(0)->tabData(m_currentStabSettingsBank).toString()));

    Q_ASSERT(stabBank);

    UAVObjectField *field = stabBank->getField("ThrustPIDScaleCurve");
    Q_ASSERT(field);

    QList<double> curve;
    for (quint32 i = 0; i < field->getNumElements(); i++) {
        curve.append(field->getValue(i).toDouble());
    }

    ui->thrustPIDScalingCurve->setCurve(&curve);

    field = stabBank->getField("EnableThrustPIDScaling");
    Q_ASSERT(field);

    bool enabled = field->getValue() == "TRUE";
    ui->enableThrustPIDScalingCheckBox->setChecked(enabled);
    ui->thrustPIDScalingCurve->setEnabled(enabled);
    setDirty(dirty);
}
开发者ID:CaptainFalco,项目名称:OpenPilot,代码行数:25,代码来源:configstabilizationwidget.cpp


示例6: selectFlightMode

/*!
  \brief Called when the flight mode drop down is changed and sets the ManualControlCommand->FlightMode accordingly
  */
void GCSControlGadgetWidget::selectFlightMode(int state)
{
    ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
    UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
    UAVDataObject* obj = dynamic_cast<UAVDataObject*>( objManager->getObject(QString("FlightStatus")) );
    UAVObjectField * field = obj->getField("FlightMode");
    field->setValue(field->getOptions()[state]);
    obj->updated();
}
开发者ID:rghunter,项目名称:gcscontrol,代码行数:12,代码来源:gcscontrolgadgetwidget.cpp


示例7: calibration

/**
  Saves the AHRS sensors calibration (to RAM and SD)
  */
void ConfigAHRSWidget::saveAHRSCalibration()
{
    UAVObject *obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("AHRSCalibration")));
    UAVObjectField *field = obj->getField(QString("measure_var"));
    field->setValue("SET");
    obj->updated();
    updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj);

}
开发者ID:mcu786,项目名称:my_OpenPilot_mods,代码行数:12,代码来源:configahrswidget.cpp


示例8: getUAVFieldValue

QString UsageTrackerPlugin::getUAVFieldValue(UAVObjectManager *objManager, QString objectName, QString fieldName, int index) const
{
    UAVObject *object = objManager->getObject(objectName);

    if (object != NULL) {
        UAVObjectField *field = object->getField(fieldName);
        if (field != NULL) {
            return field->getValue(index).toString();
        }
    }
    return tr("Unknown");
}
开发者ID:MAVProxyUser,项目名称:NinjaPilot-15.02.ninja,代码行数:12,代码来源:usagetrackerplugin.cpp


示例9: getPositionDesired

/**
  * Slot called by visualization when a new @ref PositionDesired is requested
  */
void MagicWaypointGadgetWidget::positionSelected(double north, double east) {
    double scale = m_magicwaypoint->horizontalSliderScale->value();

    PositionDesired * posDesired = getPositionDesired();
    if(posDesired) {
        UAVObjectField * field = posDesired->getField("North");
        if(field)
            field->setDouble(north * scale);

        field = posDesired->getField("East");
        if(field)
            field->setDouble(east * scale);

        posDesired->updated();
    }
}
开发者ID:rigo3t,项目名称:OpenPilot,代码行数:19,代码来源:magicwaypointgadgetwidget.cpp


示例10: launchAHRSCalibration

/**
  Launches the AHRS sensors calibration
  */
void ConfigAHRSWidget::launchAHRSCalibration()
{
    m_ahrs->calibInstructions->setText("Estimating sensor variance...");
    m_ahrs->ahrsCalibStart->setEnabled(false);

    UAVObject *obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("AHRSCalibration")));
    UAVObjectField *field = obj->getField(QString("measure_var"));
    field->setValue("MEASURE");
    obj->updated();

    QTimer::singleShot(calibrationDelay*1000, this, SLOT(calibPhase2()));
    m_ahrs->calibProgress->setRange(0,calibrationDelay);
    phaseCounter = 0;
    progressBarIndex = 0;
    connect(&progressBarTimer, SIGNAL(timeout()), this, SLOT(incrementProgress()));
    progressBarTimer.start(1000);
}
开发者ID:mcu786,项目名称:my_OpenPilot_mods,代码行数:20,代码来源:configahrswidget.cpp


示例11: Q_ASSERT

void VehicleConfigurationHelper::applyMixerConfiguration(mixerChannelSettings channels[])
{
    // Set all mixer data
    MixerSettings *mSettings = MixerSettings::GetInstance(m_uavoManager);

    Q_ASSERT(mSettings);

    // Set Mixer types and values
    QString mixerTypePattern   = "Mixer%1Type";
    QString mixerVectorPattern = "Mixer%1Vector";
    for (int i = 0; i < 10; i++) {
        UAVObjectField *field = mSettings->getField(mixerTypePattern.arg(i + 1));
        Q_ASSERT(field);
        field->setValue(field->getOptions().at(channels[i].type));

        field = mSettings->getField(mixerVectorPattern.arg(i + 1));
        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);
    }

    // Apply updates
    mSettings->setData(mSettings->getData());
    addModifiedObject(mSettings, tr("Writing mixer settings"));
}
开发者ID:1heinz,项目名称:TauLabs,代码行数:28,代码来源:vehicleconfigurationhelper.cpp


示例12: getObjectManager

void ConfigStabilizationWidget::updateObjectFromThrottleCurve()
{
    UAVObject *stabBank = getObjectManager()->getObject(QString(m_stabTabBars.at(0)->tabData(m_currentStabSettingsBank).toString()));

    Q_ASSERT(stabBank);

    UAVObjectField *field = stabBank->getField("ThrustPIDScaleCurve");
    Q_ASSERT(field);

    QList<double> curve   = ui->thrustPIDScalingCurve->getCurve();
    for (quint32 i = 0; i < field->getNumElements(); i++) {
        field->setValue(curve.at(i), i);
    }

    field = stabBank->getField("EnableThrustPIDScaling");
    Q_ASSERT(field);
    field->setValue(ui->enableThrustPIDScalingCheckBox->isChecked() ? "TRUE" : "FALSE");
}
开发者ID:CaptainFalco,项目名称:OpenPilot,代码行数:18,代码来源:configstabilizationwidget.cpp


示例13: sendChannelTest

/**
  Sends the channel value to the UAV to move the servo.
  Returns immediately if we are not in testing mode
  */
void ConfigOutputWidget::sendChannelTest(int value)
{
	int in_value = value;

	QSlider *ob = (QSlider *)QObject::sender();
	if (!ob) return;
    int index = outSliders.indexOf(ob);
	if (index < 0) return;

	if (reversals[index]->isChecked())
		value = outMin[index]->value() - value + outMax[index]->value();	// the chsnnel is reversed

	// update the label
	outLabels[index]->setText(QString::number(value));

	if (links[index]->checkState())
	{	// the channel is linked to other channels
		// set the linked channels to the same value
		for (int i = 0; i < outSliders.count(); i++)
		{
			if (i == index) continue;
			if (!links[i]->checkState()) continue;

			int val = in_value;
			if (val < outSliders[i]->minimum()) val = outSliders[i]->minimum();
			if (val > outSliders[i]->maximum()) val = outSliders[i]->maximum();

			if (outSliders[i]->value() == val) continue;

			outSliders[i]->setValue(val);
			outLabels[i]->setText(QString::number(val));
		}
	}

	if (!m_config->channelOutTest->isChecked())
		return;

	UAVDataObject *obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorCommand")));
	if (!obj) return;
	UAVObjectField *channel = obj->getField("Channel");
	if (!channel) return;
	channel->setValue(value, index);
    obj->updated();
}
开发者ID:mcu786,项目名称:OpenPilot-1,代码行数:48,代码来源:configoutputwidget.cpp


示例14: Q_ASSERT

/**
  Request the current config from the board
  */
void ConfigInputWidget::refreshValues()
{
    UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ManualControlSettings")));
    Q_ASSERT(obj);
    //obj->requestUpdate();
    UAVObjectField *field;

    // Now update all the slider values:

    UAVObjectField *field_max = obj->getField(QString("ChannelMax"));
    UAVObjectField *field_min = obj->getField(QString("ChannelMin"));
    UAVObjectField *field_neu = obj->getField(QString("ChannelNeutral"));
    Q_ASSERT(field_max);
    Q_ASSERT(field_min);
    Q_ASSERT(field_neu);
    for (int i = 0; i < 8; i++) {
        QVariant max = field_max->getValue(i);
        QVariant min = field_min->getValue(i);
        QVariant neutral = field_neu->getValue(i);
        inMaxLabels[i]->setText(max.toString());
        inMinLabels[i]->setText(min.toString());
        if (max.toInt()> min.toInt()) {
            inRevCheckboxes[i]->setChecked(false);
            inSliders[i]->setMaximum(max.toInt());
            inSliders[i]->setMinimum(min.toInt());
        } else {
            inRevCheckboxes[i]->setChecked(true);
            inSliders[i]->setMaximum(min.toInt());
            inSliders[i]->setMinimum(max.toInt());
        }
        inSliders[i]->setValue(neutral.toInt());
    }

    // Update receiver type
    field = obj->getField(QString("InputMode"));
    m_config->receiverType->setText(field->getValue().toString());

    // Reset all channel assignement dropdowns:
    foreach (QComboBox *combo, inChannelAssign) {
        combo->setCurrentIndex(0);
    }
开发者ID:PhilippePetit,项目名称:openpilot,代码行数:44,代码来源:configinputwidget.cpp


示例15: sendChannelTest

/**
  Sends the channel value to the UAV to move the servo.
  Returns immediately if we are not in testing mode
  */
void ConfigServoWidget::sendChannelTest(int value)
{
    // First of all, update the label:
    QSlider *ob = (QSlider*)QObject::sender();
    int index = outSliders.indexOf(ob);
    if (reversals[index]->isChecked())
        value = outMin[index]->value()-value+outMax[index]->value();
    else
        outLabels[index]->setText(QString::number(value));

    outLabels[index]->setText(QString::number(value));
    if (!m_config->channelOutTest->isChecked())
        return;

    UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorCommand")));

    UAVObjectField * channel = obj->getField("Channel");
    channel->setValue(value,index);
    obj->updated();

}
开发者ID:zhao0079,项目名称:software,代码行数:25,代码来源:configservowidget.cpp


示例16: VehicleConfig

ConfigCustomWidget::ConfigCustomWidget(QWidget *parent) :
    VehicleConfig(parent), m_aircraft(new Ui_CustomConfigWidget())
{
    m_aircraft->setupUi(this);

    // Put combo boxes in line one of the custom mixer table:
    UAVDataObject *mixer  = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
    Q_ASSERT(mixer);

    UAVObjectField *field = mixer->getField(QString("Mixer1Type"));
    QStringList list = field->getOptions();
    for (int i = 0; i < (int)VehicleConfig::CHANNEL_NUMELEM; i++) {
        QComboBox *qb = new QComboBox(m_aircraft->customMixerTable);
        qb->addItems(list);
        m_aircraft->customMixerTable->setCellWidget(0, i, qb);
    }

    SpinBoxDelegate *sbd = new SpinBoxDelegate();
    for (int i = 1; i < (int)VehicleConfig::CHANNEL_NUMELEM; i++) {
        m_aircraft->customMixerTable->setItemDelegateForRow(i, sbd);
    }
}
开发者ID:nongxiaoming,项目名称:QGroundStation,代码行数:22,代码来源:configcustomwidget.cpp


示例17: Q_UNUSED

/**
   Refreshes the current value of the SystemSettings which holds the aircraft type
   Note: The default behavior of ConfigTaskWidget is bypassed.
   Therefore no automatic synchronization of UAV Objects to UI is done.
 */
void ConfigVehicleTypeWidget::refreshWidgetsValues(UAVObject *o)
{
    Q_UNUSED(o);

    if (!allObjectsUpdated()) {
        return;
    }

    bool dirty = isDirty();

    // Get the Airframe type from the system settings:
    UAVDataObject *system = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("SystemSettings")));
    Q_ASSERT(system);

    UAVObjectField *field = system->getField(QString("AirframeType"));
    Q_ASSERT(field);

    // At this stage, we will need to have some hardcoded settings in this code, this
    // is not ideal, but there you go.
    QString frameType = field->getValue().toString();
    qDebug() << "ConfigVehicleTypeWidget::refreshWidgetsValues - frame type:" << frameType;

    QString category  = frameCategory(frameType);
    setComboCurrentIndex(m_aircraft->aircraftType, m_aircraft->aircraftType->findText(category));

    VehicleConfig *vehicleConfig = getVehicleConfigWidget(category);
    if (vehicleConfig) {
        vehicleConfig->refreshWidgetsValues(frameType);
    }

    updateFeedForwardUI();

    setDirty(dirty);

    qDebug() << "ConfigVehicleTypeWidget::refreshWidgetsValues - end";
}
开发者ID:MorS25,项目名称:OpenPilot,代码行数:41,代码来源:configvehicletypewidget.cpp


示例18: ConfigTaskWidget

ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent)
{
    m_config = new Ui_InputWidget();
    m_config->setupUi(this);

    ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
    UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();

	// First of all, put all the channel widgets into lists, so that we can
    // manipulate those:


	inMaxLabels << m_config->ch0Max
			<< m_config->ch1Max
			<< m_config->ch2Max
			<< m_config->ch3Max
			<< m_config->ch4Max
			<< m_config->ch5Max
			<< m_config->ch6Max
			<< m_config->ch7Max;

	inMinLabels << m_config->ch0Min
			<< m_config->ch1Min
			<< m_config->ch2Min
			<< m_config->ch3Min
			<< m_config->ch4Min
			<< m_config->ch5Min
			<< m_config->ch6Min
			<< m_config->ch7Min;

	inSliders << m_config->inSlider0
			  << m_config->inSlider1
			  << m_config->inSlider2
			  << m_config->inSlider3
			  << m_config->inSlider4
			  << m_config->inSlider5
			  << m_config->inSlider6
			  << m_config->inSlider7;

        inRevCheckboxes << m_config->ch0Rev
                        << m_config->ch1Rev
                        << m_config->ch2Rev
                        << m_config->ch3Rev
                        << m_config->ch4Rev
                        << m_config->ch5Rev
                        << m_config->ch6Rev
                        << m_config->ch7Rev;

        inChannelAssign << m_config->ch0Assign
                        << m_config->ch1Assign
                        << m_config->ch2Assign
                        << m_config->ch3Assign
                        << m_config->ch4Assign
                        << m_config->ch5Assign
                        << m_config->ch6Assign
                        << m_config->ch7Assign;

    // Now connect the widget to the ManualControlCommand / Channel UAVObject
    UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ManualControlCommand")));
    connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateChannels(UAVObject*)));

    // Register for ManualControlSettings changes:
    obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ManualControlSettings")));
    connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(refreshValues()));


    // Get the receiver types supported by OpenPilot and fill the corresponding
    // dropdown menu:
    obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ManualControlSettings")));
    UAVObjectField * field;
    // Fill in the dropdown menus for the channel RC Input assignement.
    QStringList channelsList;
        channelsList << "None";
    QList<UAVObjectField*> fieldList = obj->getFields();
    foreach (UAVObjectField* field, fieldList) {
        if (field->getUnits().contains("channel")) {
            channelsList.append(field->getName());
        }
    }

    m_config->ch0Assign->addItems(channelsList);
    m_config->ch1Assign->addItems(channelsList);
    m_config->ch2Assign->addItems(channelsList);
    m_config->ch3Assign->addItems(channelsList);
    m_config->ch4Assign->addItems(channelsList);
    m_config->ch5Assign->addItems(channelsList);
    m_config->ch6Assign->addItems(channelsList);
    m_config->ch7Assign->addItems(channelsList);

    // And the flight mode settings:
    field = obj->getField(QString("FlightModePosition"));
    m_config->fmsModePos1->addItems(field->getOptions());
    m_config->fmsModePos2->addItems(field->getOptions());
    m_config->fmsModePos3->addItems(field->getOptions());
    field = obj->getField(QString("Stabilization1Settings"));
    channelsList.clear();
    channelsList.append(field->getOptions());
    m_config->fmsSsPos1Roll->addItems(channelsList);
    m_config->fmsSsPos1Pitch->addItems(channelsList);
    m_config->fmsSsPos1Yaw->addItems(channelsList);
//.........这里部分代码省略.........
开发者ID:PhilippePetit,项目名称:openpilot,代码行数:101,代码来源:configinputwidget.cpp


示例19: ConfigTaskWidget


//.........这里部分代码省略.........
			<< m_config->ch3Min
			<< m_config->ch4Min
			<< m_config->ch5Min
			<< m_config->ch6Min
			<< m_config->ch7Min;

	inNeuLabels << m_config->ch0Cur
			<< m_config->ch1Cur
			<< m_config->ch2Cur
			<< m_config->ch3Cur
			<< m_config->ch4Cur
			<< m_config->ch5Cur
			<< m_config->ch6Cur
			<< m_config->ch7Cur;

	inSliders << m_config->inSlider0
			  << m_config->inSlider1
			  << m_config->inSlider2
			  << m_config->inSlider3
			  << m_config->inSlider4
			  << m_config->inSlider5
			  << m_config->inSlider6
			  << m_config->inSlider7;

    // Now connect the widget to the ManualControlCommand / Channel UAVObject

    UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ManualControlCommand")));
    connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateChannels(UAVObject*)));

    // Get the receiver types supported by OpenPilot and fill the corresponding
    // dropdown menu:
    obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ManualControlSettings")));
    QString fieldName = QString("InputMode");
    UAVObjectField *field = obj->getField(fieldName);
    m_config->receiverType->addItems(field->getOptions());
    m_config->receiverType->setDisabled(true); // This option does not work for now, it is a compile-time option.

    // Fill in the dropdown menus for the channel RC Input assignement.
    QStringList channelsList;
        channelsList << "None";
    QList<UAVObjectField*> fieldList = obj->getFields();
    foreach (UAVObjectField* field, fieldList) {
        if (field->getUnits().contains("channel")) {
            channelsList.append(field->getName());
        }
    }

    m_config->ch0Assign->addItems(channelsList);
    m_config->ch1Assign->addItems(channelsList);
    m_config->ch2Assign->addItems(channelsList);
    m_config->ch3Assign->addItems(channelsList);
    m_config->ch4Assign->addItems(channelsList);
    m_config->ch5Assign->addItems(channelsList);
    m_config->ch6Assign->addItems(channelsList);
    m_config->ch7Assign->addItems(channelsList);

    // And for the channel output assignement options
    m_config->ch0Output->addItem("None");
    m_config->ch1Output->addItem("None");
    m_config->ch2Output->addItem("None");
    m_config->ch3Output->addItem("None");
    m_config->ch4Output->addItem("None");
    m_config->ch5Output->addItem("None");
    m_config->ch6Output->addItem("None");
    m_config->ch7Output->addItem("None");
开发者ID:zhao0079,项目名称:software,代码行数:66,代码来源:configservowidget.cpp


示例20: board

/**
  Request the current config from the board (RC Output)
  */
void ConfigServoWidget::requestRCOutputUpdate()
{
    ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
    UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();

    // Get the Airframe type from the system settings:
    UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("SystemSettings")));
    Q_ASSERT(obj);
    obj->requestUpdate();
    UAVObjectField *field = obj->getField(QString("AirframeType"));
    m_config->aircraftType->setText(QString("Aircraft type: ") + field->getValue().toString());

    // Reset all channel assignements:
    m_config->ch0Output->setCurrentIndex(0);
    m_config->ch1Output->setCurrentIndex(0);
    m_config->ch2Output->setCurrentIndex(0);
    m_config->ch3Output->setCurrentIndex(0);
    m_config->ch4Output->setCurrentIndex(0);
    m_config->ch5Output->setCurrentIndex(0);
    m_config->ch6Output->setCurrentIndex(0);
    m_config->ch7Output->setCurrentIndex(0);

    // Get the channel assignements:
    obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ActuatorSettings")));
    Q_ASSERT(obj);
    obj->requestUpdate();
    QList<UAVObjectField*> fieldList = obj->getFields();
    foreach (UAVObjectField* field, fieldList) {
        if (field->getUnits().contains("channel")) {
            assignOutputChannel(obj,field->getName());
        }
    }

    // Get Output rates for both banks
    field = obj->getField(QString("ChannelUpdateFreq"));
    m_config->outputRate1->setValue(field->getValue(0).toInt());
    m_config->outputRate2->setValue(field->getValue(1).toInt());

    // Get Channel ranges:
    for (int i=0;i<8;i++) {
        field = obj->getField(QString("ChannelMin"));
        int minValue = field->getValue(i).toInt();
        outMin[i]->setValue(minValue);
        field = obj->getField(QString("ChannelMax"));
        int maxValue = field->getValue(i).toInt();
        outMax[i]->setValue(maxValue);
        if (maxValue>minValue) {
            outSliders[i]->setMinimum(minValue);
            outSliders[i]->setMaximum(maxValue);
            reversals[i]->setChecked(false);
        } else {
            outSliders[i]->setMinimum(maxValue);
            outSliders[i]->setMaximum(minValue);
            reversals[i]->setChecked(true);
        }
    }

    field = obj->getField(QString("ChannelNeutral"));
    for (int i=0; i<8; i++) {
        int value = field->getValue(i).toInt();
        outSliders[i]->setValue(value);
        outLabels[i]->setText(QString::number(value));
    }


}
开发者ID:zhao0079,项目名称:software,代码行数:69,代码来源:configservowidget.cpp



注:本文中的UAVObjectField类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ UAVObjectManager类代码示例发布时间:2022-05-31
下一篇:
C++ UAVObject类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap