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

C++ os::Property类代码示例

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

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



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

示例1: catch

void
MetricsRequestHandler::fillInDescription(const YarpString &   request,
                                         yarp::os::Property & info)
{
    ODL_OBJENTER(); //####
    ODL_S1s("request = ", request); //####
    ODL_P1("info = ", &info); //####
    try
    {
        info.put(MpM_REQREP_DICT_REQUEST_KEY_, request);
        info.put(MpM_REQREP_DICT_OUTPUT_KEY_, MpM_REQREP_LIST_START_ MpM_REQREP_DICT_START_
                 MpM_REQREP_DICT_END_ MpM_REQREP_1_OR_MORE_ MpM_REQREP_LIST_END_);
        info.put(MpM_REQREP_DICT_VERSION_KEY_, METRICS_REQUEST_VERSION_NUMBER_);
        info.put(MpM_REQREP_DICT_DETAILS_KEY_, T_("Return the measurements for the channels of the "
                                                  "service\n"
                                                  "Input: nothing\n"
                                                  "Output: a list of dictionaries containing "
                                                  "measurements for the service channels"));
        yarp::os::Value    keywords;
        yarp::os::Bottle * asList = keywords.asList();

        asList->addString(request);
        info.put(MpM_REQREP_DICT_KEYWORDS_KEY_, keywords);
    }
    catch (...)
    {
        ODL_LOG("Exception caught"); //####
        throw;
    }
    ODL_OBJEXIT(); //####
} // MetricsRequestHandler::fillInDescription
开发者ID:MovementAndMeaning,项目名称:Core_MPlusM,代码行数:31,代码来源:m+mMetricsRequestHandler.cpp


示例2: scan_xml

void Prop::scan_xml(const std::string& txt, yarp::os::Property& data) {
  data.clear();
  string line;
  for (int i=0; i<(int)txt.size(); i++) {
    char ch = txt[i];
    if (ch=='\"') {
      line += " ";
      continue;
    }
    if (ch!='\r'&&ch!='\n') {
      line += ch;
      continue;
    } 

    Bottle b(line.c_str());
    
    string var = "dud";
    for (int j=1; j<b.size(); j++) {
      if (b.get(j-1).asString()=="id=") {
	var = b.get(j).asString();
	continue;
      }
      if (b.get(j-1).asString()=="import=") {
	data.put(var.c_str(),b.get(j));
      }
    }
  }
}
开发者ID:paulfitz,项目名称:makesweet,代码行数:28,代码来源:Prop.cpp


示例3: catch

void
WhereRequestHandler::fillInDescription(const YarpString &   request,
                                       yarp::os::Property & info)
{
    ODL_OBJENTER(); //####
    ODL_S1s("request = ", request); //####
    ODL_P1("info = ", &info); //####
    try
    {
        info.put(MpM_REQREP_DICT_REQUEST_KEY_, request);
        info.put(MpM_REQREP_DICT_VERSION_KEY_, WHERE_REQUEST_VERSION_NUMBER_);
        info.put(MpM_REQREP_DICT_DETAILS_KEY_, T_("Return the remembered IP address and port\n"
                                                  "Input: nothing\n"
                                                  "Output: the remembered IP address and port"));
        yarp::os::Value    keywords;
        yarp::os::Bottle * asList = keywords.asList();

        asList->addString(request);
        info.put(MpM_REQREP_DICT_KEYWORDS_KEY_, keywords);
    }
    catch (...)
    {
        ODL_LOG("Exception caught"); //####
        throw;
    }
    ODL_OBJEXIT(); //####
} // WhereRequestHandler::fillInDescription
开发者ID:MovementAndMeaning,项目名称:Core_MPlusM,代码行数:27,代码来源:m+mWhereRequestHandler.cpp


示例4: catch

void
StartSumRequestHandler::fillInDescription(const YarpString &   request,
                                          yarp::os::Property & info)
{
    ODL_OBJENTER(); //####
    ODL_S1s("request = ", request); //####
    ODL_P1("info = ", &info); //####
    try
    {
        info.put(MpM_REQREP_DICT_REQUEST_KEY_, request);
        info.put(MpM_REQREP_DICT_VERSION_KEY_, STARTSUM_REQUEST_VERSION_NUMBER_);
        info.put(MpM_REQREP_DICT_DETAILS_KEY_, T_("Start the running sum\n"
                                                  "Input: nothing\n"
                                                  "Output: nothing"));
        yarp::os::Value    keywords;
        yarp::os::Bottle * asList = keywords.asList();

        asList->addString(request);
        info.put(MpM_REQREP_DICT_KEYWORDS_KEY_, keywords);
    }
    catch (...)
    {
        ODL_LOG("Exception caught"); //####
        throw;
    }
    ODL_OBJEXIT(); //####
} // StartSumRequestHandler::fillInDescription
开发者ID:MovementAndMeaning,项目名称:Core_MPlusM,代码行数:27,代码来源:m+mStartSumRequestHandler.cpp


示例5: configureFromProperty

bool PortMonitor::configureFromProperty(yarp::os::Property& options) {
    if(binder) delete binder;
    binder = nullptr;

    std::string script = options.check("type", Value("lua")).asString();
    std::string filename = options.check("file", Value("modifier")).asString();
    std::string constraint = options.check("constraint", Value("")).asString();
    // context is used to find the script files
    std::string context = options.check("context", Value("")).asString();

    // check which monitor should be used
    if((binder = MonitorBinding::create(script.c_str())) == nullptr)
    {
         yError(R"(Currently only 'lua' script and 'dll' object is supported by portmonitor)");
         return false;
    }

    // set the acceptance constraint
    binder->setAcceptConstraint(constraint.c_str());

    std::string strFile = filename;

    if(script != "dll")
    {
        yarp::os::ResourceFinder rf;
        rf.setDefaultContext(context.c_str());
        rf.configure(0, nullptr);
        strFile = rf.findFile(filename);
        if(strFile == "")
            strFile = rf.findFile(filename+".lua");
    }
开发者ID:robotology,项目名称:yarp,代码行数:31,代码来源:PortMonitor.cpp


示例6: setup

bool CameraTest::setup(yarp::os::Property& property) {

    if(property.check("name"))
        setName(property.find("name").asString());

    // updating parameters
    RTF_ASSERT_ERROR_IF(property.check("portname"),
                        "The portname must be given as the test paramter!");
    cameraPortName = property.find("portname").asString();
    measure_time = property.check("measure_time") ? property.find("measure_time").asInt() : TIMES;
    expected_frequency = property.check("expected_frequency") ? property.find("expected_frequency").asInt() : FREQUENCY;
    tolerance = property.check("tolerance") ? property.find("tolerance").asInt() : TOLERANCE;

    // opening port
    RTF_ASSERT_ERROR_IF(port.open("/CameraTest/image:i"),
                        "opening port, is YARP network available?");

    RTF_TEST_REPORT(Asserter::format("Listening to camera for %d seconds",
                                       measure_time));

    // connecting
    RTF_TEST_REPORT(Asserter::format("connecting from %s to %s",
                                       port.getName().c_str(), cameraPortName.c_str()));
    RTF_ASSERT_ERROR_IF(Network::connect(cameraPortName, port.getName()),
                     "could not connect to remote port, camera unavailable");
    return true;
}
开发者ID:nunoguedelha,项目名称:icub-tests,代码行数:27,代码来源:CameraTest.cpp


示例7: setJointSensorsType

bool GazeboYarpJointSensorsDriver::setJointSensorsType(yarp::os::Property & pluginParameters)  //WORKS
{
    std::cout << ".ini file found, using joint names in ini file" << std::endl;
    
    std::string parameter_name = "gazeboJointSensorsType";
    
    if(!pluginParameters.check(parameter_name.c_str())) {
        std::cout << "GazeboYarpJointSensorsDriver::setJointSensorsType() error: cannot find " << parameter_name << " parameter." << std::endl;
        return false;
    }
    
    std::string sensors_type = pluginParameters.find(parameter_name.c_str()).asString().c_str();
    
    if( sensors_type == "position" ) {
        jointsensors_type = Position;
    } else if ( sensors_type == "speed" ) {
        jointsensors_type = Speed;
    } else if ( sensors_type == "torque" ) {
        jointsensors_type = Torque;
    } else {
        std::cerr << "GazeboYarpJointSensorsDriver::setJointSensorsType() error: sensor type " << sensors_type << " not recognized." << std::endl
                  << "\t\tThe available types are position, speed and torque." << std::endl;
        return false;
    }
    
    return true;
}
开发者ID:hu-yue,项目名称:gazebo-yarp-plugins,代码行数:27,代码来源:JointSensorsDriver.cpp


示例8: addVectorOfStringToProperty

void addVectorOfStringToProperty(yarp::os::Property& prop, std::string key, std::vector<std::string> & list)
{
    prop.addGroup(key);
    yarp::os::Bottle & bot = prop.findGroup(key).addList();
    for(size_t i=0; i < list.size(); i++)
    {
        bot.addString(list[i].c_str());
    }
    return;
}
开发者ID:robotology,项目名称:codyco-modules,代码行数:10,代码来源:floatingBaseEstimator.cpp


示例9: getYarpWbiProperties

bool yarpWholeBodyInterface::getYarpWbiProperties(
    yarp::os::Property& yarp_wbi_properties)
{
    yarp::os::Property buffer;
    actuatorInt->getYarpWbiProperties(buffer);
    yarp_wbi_properties.fromString(buffer.toString(), false);
    stateInt->getYarpWbiProperties(buffer);
    yarp_wbi_properties.fromString(buffer.toString(), false);
    modelInt->getYarpWbiProperties(buffer);
    yarp_wbi_properties.fromString(buffer.toString(), false);
    return true;
}
开发者ID:,项目名称:,代码行数:12,代码来源:


示例10: setOptions

void selectiveAttentionModule::setOptions(yarp::os::Property opt){
    //options	=opt;
    // definition of the name of the module
    ConstString name=opt.find("name").asString();
    if(name!=""){
        printf("|||  Module named as :%s \n", name.c_str());
        this->setName(name.c_str());
    }
    ConstString value=opt.find("mode").asString();
    if(value!=""){
       
    }
}
开发者ID:robotology,项目名称:attention,代码行数:13,代码来源:selectiveAttentionModule.cpp


示例11: setup

bool ExampleTest::setup(yarp::os::Property &property) {

    // initialization goes here ...
    //updating the test name
    if(property.check("name"))
        setName(property.find("name").asString());

    string example = property.check("example", Value("default value")).asString();

    RTF_TEST_REPORT(Asserter::format("Use '%s' for the example param!",
                                       example.c_str()));
    return true;
}
开发者ID:Karma-Revolutions,项目名称:icub-tests,代码行数:13,代码来源:ExampleTest.cpp


示例12: setup

bool OpenLoopConsistency::setup(yarp::os::Property& property) {

    // updating parameters
    RTF_ASSERT_ERROR_IF(property.check("robot"), "The robot name must be given as the test parameter!");
    RTF_ASSERT_ERROR_IF(property.check("part"), "The part name must be given as the test parameter!");
    RTF_ASSERT_ERROR_IF(property.check("joints"), "The joints list must be given as the test parameter!");
    RTF_ASSERT_ERROR_IF(property.check("zero"),    "The zero position must be given as the test parameter!");

    robotName = property.find("robot").asString();
    partName = property.find("part").asString();

    zero = property.find("zero").asDouble();

    Bottle* jointsBottle = property.find("joints").asList();
    RTF_ASSERT_ERROR_IF(jointsBottle!=0,"unable to parse joints parameter");
    n_cmd_joints = jointsBottle->size();
    RTF_ASSERT_ERROR_IF(n_cmd_joints>0,"invalid number of joints, it must be >0");

    Property options;
    options.put("device", "remote_controlboard");
    options.put("remote", "/"+robotName+"/"+partName);
    options.put("local", "/OpenLoopConsistencyTest/"+robotName+"/"+partName);

    dd = new PolyDriver(options);
    RTF_ASSERT_ERROR_IF(dd->isValid(),"Unable to open device driver");
    RTF_ASSERT_ERROR_IF(dd->view(iopl),"Unable to open openloop interface");
    RTF_ASSERT_ERROR_IF(dd->view(ienc),"Unable to open encoders interface");
    RTF_ASSERT_ERROR_IF(dd->view(iamp),"Unable to open ampliefier interface");
    RTF_ASSERT_ERROR_IF(dd->view(ipos),"Unable to open position interface");
    RTF_ASSERT_ERROR_IF(dd->view(icmd),"Unable to open control mode interface");
    RTF_ASSERT_ERROR_IF(dd->view(iimd),"Unable to open interaction mode interface");

    if (!ienc->getAxes(&n_part_joints))
    {
        RTF_ASSERT_ERROR("unable to get the number of joints of the part");
    }

    if      (n_part_joints<=0)
        RTF_ASSERT_ERROR("Error this part has in invalid (<=0) number of jonits");
    else if (jointsBottle->size() == 1)
        cmd_mode=single_joint;
    else if (jointsBottle->size() < n_part_joints)
        cmd_mode=some_joints;
    else if (jointsBottle->size() == n_part_joints)
        cmd_mode=all_joints;
    else
        RTF_ASSERT_ERROR("invalid joint selection?");

    cmd_tot = new double[n_part_joints];
    pos_tot=new double[n_part_joints];
    jointsList=new int[n_cmd_joints];
    cmd_some=new double[n_cmd_joints];
    prevcurr_tot=new double[n_part_joints];
    prevcurr_some=new double[n_cmd_joints];
    for (int i=0; i <n_cmd_joints; i++) jointsList[i]=jointsBottle->get(i).asInt();

    return true;
}
开发者ID:Karma-Revolutions,项目名称:icub-tests,代码行数:58,代码来源:OpenloopConsistency.cpp


示例13: setPortmonitorParams

bool NetworkProfiler::setPortmonitorParams(std::string portName, yarp::os::Property& param) {
    //e.g.,  set in "/view" (log_raw 1)"
    yarp::os::Bottle cmd, reply;
    cmd.addString("set");
    cmd.addString("in");
    cmd.addString(portName.c_str());
    Bottle tmp;
    tmp.fromString(param.toString());
    cmd.add(tmp.get(0));
    Contact srcCon = Contact::fromString(portName);
    bool ret = yarp::os::NetworkBase::write(srcCon, cmd, reply, true, true, 2.0);
    if(!ret) {
        yError()<<"Cannot write to"<<portName;
        return false;
    }
    if(reply.size() > 1) {
        if(reply.get(0).isString() && reply.get(0).asString() == "fail") {
            yError()<<reply.toString();
            return false;
        }
        else if(reply.get(0).isInt() && reply.get(0).asInt() == -1) {
            yError()<<reply.toString();
            return false;
        }
    }
    return true;
}
开发者ID:jgvictores,项目名称:yarp,代码行数:27,代码来源:NetworkProfiler.cpp


示例14: initOutport

void SkinGroup::initOutport(yarp::os::Property &config)
{
  std::string outPortName = config.check("out_port", yarp::os::Value("/outport"), "").asString().c_str();
  
  std::cout << "Out Port name ==>" << outPortName << std::endl;
  classificationOutport.open(outPortName.c_str());
}
开发者ID:jizecn,项目名称:my_humanoid_robot,代码行数:7,代码来源:SkinGroup.cpp


示例15: create

bool SimpleMonitorObject::create(const yarp::os::Property& options)
{
   yDebug("created!\n");
   yDebug("I am attached to the %s\n",
          (options.find("sender_side").asBool()) ? "sender side" : "receiver side");
   return true;
}
开发者ID:ale-git,项目名称:yarp,代码行数:7,代码来源:Simple.cpp


示例16: initLinkAssociatedToContactSensor

bool GazeboYarpContactLoadCellArrayDriver::initLinkAssociatedToContactSensor(yarp::os::Property &pluginParameters)
{
    m_linkAssociateToSensor = pluginParameters.find("linkName").asString();

    const gazebo::physics::Link_V &gazeboModelLinks = m_robot->GetLinks();
    std::string linkNameScopedEnding = "::" + m_linkAssociateToSensor;
    bool linkFound = false;
    for (size_t gazeboLink = 0; gazeboLink < gazeboModelLinks.size(); gazeboLink++)
    {
        std::string gazeboLinkName = gazeboModelLinks[gazeboLink]->GetScopedName();
        if (GazeboYarpPlugins::hasEnding(gazeboLinkName, linkNameScopedEnding))
        {
            linkFound = true;
            m_sensorLink = boost::get_pointer(gazeboModelLinks[gazeboLink]);
            break;
        }
    }

    if (!linkFound)
    {
        yError() << "GazeboYarpContactLoadCellArrayDriver: initContactSensor(): Link associated to sensor not found";
        return false;
    }

    return true;
}
开发者ID:Tobias-Fischer,项目名称:gazebo-yarp-plugins,代码行数:26,代码来源:ContactLoadCellArrayDriver.cpp


示例17: scan_hx

void Prop::scan_hx(const std::string& txt, yarp::os::Property& data) {
  data.clear();
  string line;
  for (int i=0; i<(int)txt.size(); i++) {
    char ch = txt[i];
    if (ch=='\r'||ch=='\n') {
      line = "";
      continue;
    }
    if (ch=='[') {
      line += '(';
      continue;
    }
    if (ch==']') {
      line += ')';
      continue;
    }
    if (ch==',') {
      line += ' ';
      continue;
    }
    if (ch!=';') {
      line += ch;
      continue;
    }
    Bottle b(line.c_str());
    
    string var = "dud";
    for (int j=1; j<b.size(); j++) {
      if (b.get(j-1).asString()=="var") {
	var = b.get(j).asString();
	continue;
      }
      if (b.get(j-1).asString()=="=") {
	Value v = b.get(j);
	ConstString s = v.asString();
	if (s=="true") {
	  data.put(var.c_str(),1);
	} else if (s=="false") {
	  data.put(var.c_str(),0);
	} else {
	  data.put(var.c_str(),v);
	}
      }
    }
  }
}
开发者ID:paulfitz,项目名称:makesweet,代码行数:47,代码来源:Prop.cpp


示例18: configureFromProperty

bool PortMonitor::configureFromProperty(yarp::os::Property& options) {
    if(binder) delete binder;
    binder = NULL;

    ConstString script = options.check("type", Value("lua")).asString();
    ConstString filename = options.check("file", Value("modifier")).asString();
    ConstString constraint = options.check("constraint", Value("")).asString();
    // context is used to find the script files
    ConstString context = options.check("context", Value("")).asString();

    // check which monitor should be used
    if((binder = MonitorBinding::create(script.c_str())) == NULL)
    {
         yError("Currently only \'lua\' script and \'dll\' object is supported by portmonitor");
         return false;
    }

    // set the acceptance constraint
    binder->setAcceptConstraint(constraint.c_str());

    ConstString strFile = filename;

    if(script != "dll")
    {
        yarp::os::ResourceFinder rf;
        rf.setDefaultContext(context.c_str());
        rf.configure(0, NULL);
        strFile = rf.findFile(filename.c_str());
        if(strFile == "")
            strFile = rf.findFile(filename+".lua");
    }

    // provide some useful information for the monitor object
    // which can be accessed in the create() callback.
    Property info;
    info.clear();
    info.put("filename", strFile);
    info.put("type", script);
    info.put("source", options.find("source").asString());
    info.put("destination", options.find("destination").asString());
    info.put("sender_side",  options.find("sender_side").asInt());
    info.put("receiver_side",options.find("receiver_side").asInt());
    info.put("carrier", options.find("carrier").asString());

    PortMonitor::lock();
    bReady =  binder->load(info);
    PortMonitor::unlock();
    return bReady;
    return false;
}
开发者ID:silasxue,项目名称:yarp,代码行数:50,代码来源:PortMonitor.cpp


示例19: configure

bool GazeboYarpContactLoadCellArrayDriver::configure(yarp::os::Property& pluginParams)
{
    // Get load cell locations with respect to the CG of the link (body1)
    yarp::os::Bottle *loadCellNames = pluginParams.find("loadCellNames").asList();
    if (loadCellNames->size() == 0)
    {
        yError() << "GazeboYarpContactLoadCellArrayDriver: Error parsing parameters: \"loadCellNames\" should be followed by  list";
        return false;
    }

    yarp::os::Bottle *loadCellX = pluginParams.find("loadCellX").asList();
    yarp::os::Bottle *loadCellY = pluginParams.find("loadCellY").asList();
    yarp::os::Bottle *loadCellZ = pluginParams.find("loadCellZ").asList();

    if (loadCellX->size() == 0 || loadCellY->size() == 0 || loadCellZ->size() == 0)
    {
        yError() << "GazeboYarpContactLoadCellArrayDriver: Error parsing parameters: \"loadCellX , ..Y, ..Z\" should be followed by  list";
        return false;
    }

    if (loadCellX->size() != loadCellNames->size() || loadCellY->size() != loadCellNames->size() || loadCellZ->size() != loadCellNames->size())
    {
        yError() << "GazeboYarpContactLoadCellArrayDriver: Error parsing parameters: \"loadCellX , ..Y, ..Z\" should be the same size as \"loadCellNames\"";
        return false;
    }

    for (size_t i = 0; i < loadCellNames->size(); i++)
    {
        yarp::sig::Vector loadCellLoc(3);
        loadCellLoc.clear();
        loadCellLoc.push_back(loadCellX->get(i).asDouble());
        loadCellLoc.push_back(loadCellY->get(i).asDouble());
        loadCellLoc.push_back(loadCellZ->get(i).asDouble());
        this->m_loadCellLocations.push_back(loadCellLoc);
     }

     m_contactNormalForces.resize(m_loadCellLocations.size());
     if (!this->prepareMappingMatrix())
     {
         return false;
     }

    return true;
}
开发者ID:Tobias-Fischer,项目名称:gazebo-yarp-plugins,代码行数:44,代码来源:ContactLoadCellArrayDriver.cpp


示例20: create

bool ZfpMonitorObject::create(const yarp::os::Property& options)
{
    shouldCompress = (options.find("sender_side").asBool());
    compressed=NULL;
    decompressed=NULL;
    buffer=NULL;
    sizeToAllocate=0;
    sizeToAllocateB=0;
    return true;
}
开发者ID:robotology,项目名称:yarp,代码行数:10,代码来源:zfpPortmonitor.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ os::ResourceFinder类代码示例发布时间:2022-05-31
下一篇:
C++ os::ConstString类代码示例发布时间: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