当前位置: 首页>>代码示例>>C++>>正文


C++ UAVDataObject类代码示例

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


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

示例1: foreach

void VehicleTemplateExportDialog::importTemplate()
{
    QJsonObject *tmpl = ui->selectionWidget->selectedTemplate();

    if (tmpl != NULL) {
        QList<UAVObject *> updatedObjects;
        m_uavoManager->fromJson(*tmpl, &updatedObjects);
        UAVObjectUpdaterHelper helper;
        foreach(UAVObject * object, updatedObjects) {
            UAVDataObject *dataObj = dynamic_cast<UAVDataObject *>(object);

            if (dataObj != NULL && dataObj->isKnown()) {
                helper.doObjectAndWait(dataObj);

                ObjectPersistence *objper = ObjectPersistence::GetInstance(m_uavoManager);
                ObjectPersistence::DataFields data;
                data.Operation  = ObjectPersistence::OPERATION_SAVE;
                data.Selection  = ObjectPersistence::SELECTION_SINGLEOBJECT;
                data.ObjectID   = dataObj->getObjID();
                data.InstanceID = dataObj->getInstID();
                objper->setData(data);

                helper.doObjectAndWait(objper);
            }
        }
开发者ID:wangfeilong321,项目名称:OpenPilot-1,代码行数:25,代码来源:vehicletemplateexportdialog.cpp

示例2: resetThrottleCurveToDefault

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

示例3: board

/**
   Sends the config to the board (airframe type)

   We do all the tasks common to all airframes, or family of airframes, and
   we call additional methods for specific frames, so that we do not have a code
   that is too heavy.

   Note: The default behavior of ConfigTaskWidget is bypassed.
   Therefore no automatic synchronization of UI to UAV Objects is done.
 */
void ConfigVehicleTypeWidget::updateObjectsFromWidgets()
{
    // Airframe type defaults to Custom
    QString airframeType = "Custom";

    VehicleConfig *vehicleConfig = (VehicleConfig *)m_aircraft->airframesWidget->currentWidget();

    if (vehicleConfig) {
        airframeType = vehicleConfig->updateConfigObjectsFromWidgets();
    }

    // set the airframe type
    UAVDataObject *system = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("SystemSettings")));
    Q_ASSERT(system);

    QPointer<UAVObjectField> field = system->getField(QString("AirframeType"));
    if (field) {
        field->setValue(airframeType);
    }

    // Update feed forward settings
    UAVDataObject *mixer = dynamic_cast<UAVDataObject *>(getObjectManager()->getObject(QString("MixerSettings")));
    Q_ASSERT(mixer);

    QPointer<VehicleConfig> vconfig = new VehicleConfig();

    vconfig->setMixerValue(mixer, "FeedForward", m_aircraft->feedForwardSlider->value() / 100.0);
    vconfig->setMixerValue(mixer, "AccelTime", m_aircraft->accelTime->value());
    vconfig->setMixerValue(mixer, "DecelTime", m_aircraft->decelTime->value());
    vconfig->setMixerValue(mixer, "MaxAccel", m_aircraft->maxAccelSlider->value());

    // TODO call refreshWidgetsValues() to reflect actual saved values ?
    updateFeedForwardUI();
}
开发者ID:MorS25,项目名称:OpenPilot,代码行数:44,代码来源:configvehicletypewidget.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: startRetrievingObjects

/**
 * Initiate object retrieval, initialize queue with objects to be retrieved.
 */
void TelemetryMonitor::startRetrievingObjects()
{
    // Clear object queue
    queue.clear();
    // Get all objects, add metaobjects, settings and data objects with OnChange update mode to the queue
    QList< QList<UAVObject *> > objs = objMngr->getObjects();
    for (int n = 0; n < objs.length(); ++n) {
        UAVObject *obj = objs[n][0];
        UAVMetaObject *mobj = dynamic_cast<UAVMetaObject *>(obj);
        UAVDataObject *dobj = dynamic_cast<UAVDataObject *>(obj);
        UAVObject::Metadata mdata = obj->getMetadata();
        if (mobj != NULL) {
            queue.enqueue(obj);
        } else if (dobj != NULL) {
            if (dobj->isSettings()) {
                queue.enqueue(obj);
            } else {
                if (UAVObject::GetFlightTelemetryUpdateMode(mdata) == UAVObject::UPDATEMODE_ONCHANGE) {
                    queue.enqueue(obj);
                }
            }
        }
    }
    // Start retrieving
    qDebug() << tr("Starting to retrieve meta and settings objects from the autopilot (%1 objects)")
        .arg(queue.length());
    retrieveNextObject();
}
开发者ID:Alex-Rongzhen-Huang,项目名称:OpenPilot,代码行数:31,代码来源:telemetrymonitor.cpp

示例6: toggleControl

/*!
  \brief Called when the gcs control is toggled and enabled or disables flight write access to manual control command
  */
void GCSControlGadgetWidget::toggleControl(int state)
{
    ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
    UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
    UAVDataObject* obj = dynamic_cast<UAVDataObject*>( objManager->getObject(QString("ManualControlCommand")) );

    UAVObject::Metadata mdata = obj->getMetadata();
    if (state)
    {
        mccInitialData = mdata;
        UAVObject::SetFlightAccess(mdata, UAVObject::ACCESS_READONLY);
        UAVObject::SetFlightTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_ONCHANGE);
        UAVObject::SetGcsTelemetryAcked(mdata, false);
        UAVObject::SetGcsTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_ONCHANGE);
        mdata.gcsTelemetryUpdatePeriod = 100;
        m_gcscontrol->checkBoxUDPControl->setEnabled(true);

    }
    else
    {
        mdata = mccInitialData;
        toggleUDPControl(false);
        m_gcscontrol->checkBoxUDPControl->setEnabled(false);
    }
    obj->setMetadata(mdata);
}
开发者ID:rghunter,项目名称:gcscontrol,代码行数:29,代码来源:gcscontrolgadgetwidget.cpp

示例7: disconnect

void LevellingUtil::stopMeasurement()
{
    m_isMeasuring = false;

    //Stop timeout timer
    m_timeoutTimer.stop();
    disconnect(&m_timeoutTimer, SIGNAL(timeout()), this, SLOT(timeout()));

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

    // Stop listening for updates from accels
    UAVDataObject *uavObject = Accels::GetInstance(uavObjectManager);
    disconnect(uavObject, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(accelMeasurementsUpdated(UAVObject*)));
    uavObject->setMetadata(m_previousAccelMetaData);

    // Stop listening for updates from gyros
    uavObject = Gyros::GetInstance(uavObjectManager);
    disconnect(uavObject, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(gyroMeasurementsUpdated(UAVObject*)));
    uavObject->setMetadata(m_previousGyroMetaData);

    // Enable gyro bias correction again
    AttitudeSettings::DataFields attitudeSettingsData = AttitudeSettings::GetInstance(uavObjectManager)->getData();
    attitudeSettingsData.BiasCorrectGyro = AttitudeSettings::BIASCORRECTGYRO_TRUE;
    AttitudeSettings::GetInstance(uavObjectManager)->setData(attitudeSettingsData);
}
开发者ID:1heinz,项目名称:TauLabs,代码行数:27,代码来源:levellingutil.cpp

示例8: mccChanged

void GCSControlGadgetWidget::mccChanged(UAVObject * obj)
{
    ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
    UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
    UAVDataObject* flightStatus = dynamic_cast<UAVDataObject*>( objManager->getObject(QString("FlightStatus")) );
    m_gcscontrol->comboBoxFlightMode->setCurrentIndex(m_gcscontrol->comboBoxFlightMode->findText(flightStatus->getField("FlightMode")->getValue().toString()));
    m_gcscontrol->checkBoxArmed->setChecked(flightStatus->getField("Armed")->getValue() == "Armed");
}
开发者ID:rghunter,项目名称:gcscontrol,代码行数:8,代码来源:gcscontrolgadgetwidget.cpp

示例9: 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

示例10: objUpdatedManual

void objUpdatedManual(UAVObject *obj)
{
	boost::recursive_timed_mutex::scoped_lock lock(mutex);
	upmanual++;
	std::cout << "[Manual] " << obj->toString();

	UAVDataObject *dobj = dynamic_cast<UAVDataObject *>(obj);
	if (dobj)
		std::cout << dobj->toStringData();
}
开发者ID:TSC21,项目名称:opgateway,代码行数:10,代码来源:test_uavobjects.cpp

示例11: updRequested

void updRequested(UAVObject *obj)
{
	boost::recursive_timed_mutex::scoped_lock lock(mutex);
	upreq++;
	std::cout << "[Object Requested] " << obj->toString();

	UAVDataObject *dobj = dynamic_cast<UAVDataObject *>(obj);
	if (dobj)
		std::cout << dobj->toStringData();
}
开发者ID:TSC21,项目名称:opgateway,代码行数:10,代码来源:test_uavobjects.cpp

示例12: newInstance

void newInstance(UAVObject *obj)
{
	boost::recursive_timed_mutex::scoped_lock lock(mutex);
	newinst++;
	std::cout << "[NEW Instance] " << obj->toString();

	UAVDataObject *dobj = dynamic_cast<UAVDataObject *>(obj);
	if (dobj)
		std::cout << dobj->toStringData();
}
开发者ID:TSC21,项目名称:opgateway,代码行数:10,代码来源:test_uavobjects.cpp

示例13: getInstanceID

void ExtendedDebugLogEntry::setData(const DebugLogEntry::DataFields &data, UAVObjectManager *objectManager)
{
    DebugLogEntry::setData(data);

    if (getType() == DebugLogEntry::TYPE_UAVOBJECT) {
        UAVDataObject *object = (UAVDataObject *)objectManager->getObject(getObjectID(), getInstanceID());
        Q_ASSERT(object);
        m_object = object->clone(getInstanceID());
        m_object->unpack(getData().Data);
    }
}
开发者ID:Alex-Rongzhen-Huang,项目名称:OpenPilot,代码行数:11,代码来源:flightlogmanager.cpp

示例14: bind_objUpdated

void bind_objUpdated(UAVObject *obj)
{
	boost::recursive_timed_mutex::scoped_lock lock(mutex);
	bind_updated++;
	std::cout << "[BIND Updated] " << obj->toString();

	UAVDataObject *dobj = dynamic_cast<UAVDataObject *>(obj);
	if (dobj)
		std::cout << dobj->toStringData();

}
开发者ID:TSC21,项目名称:opgateway,代码行数:11,代码来源:test_uavobjects.cpp

示例15: toggleArmed

void GCSControlGadgetWidget::toggleArmed(int state)
{
    ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
    UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
    UAVDataObject* obj = dynamic_cast<UAVDataObject*>( objManager->getObject(QString("FlightStatus")) );
    if(state)
        obj->getField("Armed")->setValue("Armed");
    else
        obj->getField("Armed")->setValue("Disarmed");
    obj->updated();
}
开发者ID:rghunter,项目名称:gcscontrol,代码行数:11,代码来源:gcscontrolgadgetwidget.cpp


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