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


C++ Searchable::toString方法代码示例

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


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

示例1: open

bool RGBDSensorWrapper::open(yarp::os::Searchable &config)
{
//     DeviceResponder::makeUsage();
//     addUsage("[set] [bri] $fBrightness", "set brightness");
//     addUsage("[set] [expo] $fExposure", "set exposure");
//
    m_conf.fromString(config.toString());
    if(verbose >= 5)
        yTrace() << "\nParameters are: \n" << config.toString();

    if(!fromConfig(config))
    {
        yError() << "Device RGBDSensorWrapper failed to open, check previous log for error messsages.\n";
        return false;
    }

     setId("RGBDSensorWrapper for " + depthFrame_StreamingPort_Name);

    if(!initialize_YARP(config) )
    {
        yError() << sensorId << "Error initializing YARP ports";
        return false;
    }

    if(!initialize_ROS(config) )
    {
        yError() << sensorId << "Error initializing ROS topic";
        return false;
    }
    return true;
}
开发者ID:apaikan,项目名称:yarp,代码行数:31,代码来源:RGBDSensorWrapper.cpp

示例2: open

bool USBCameraDriver::open(yarp::os::Searchable& config)
{
    // open OS dependant device
    yTrace() << "input params are " << config.toString();

#if defined(_MSC_VER)
    os_device = (DeviceDriver*) new WIN_camera;
#elif defined __unix
    os_device = (DeviceDriver*) new V4L_camera;
#endif

    yarp::os::Property prop;
    prop.fromString(config.toString().c_str());
    if(!prop.check("pixelType")){
        switch(pixelType)
        {
            case VOCAB_PIXEL_MONO:
                prop.put("pixelType", VOCAB_PIXEL_MONO);
                break;

            case VOCAB_PIXEL_RGB:
            default:
                prop.put("pixelType", VOCAB_PIXEL_RGB);
                break;
        }
    }
    if(!os_device->open(prop) )
        return false;

    os_device->view(deviceRgb);
    os_device->view(deviceRaw);
    os_device->view(deviceControls);
    os_device->view(deviceControls2);
    os_device->view(deviceTimed);
    os_device->view(deviceRgbVisualParam);

    if(deviceRaw)
    {
        _width = deviceRaw->width();
        _height = deviceRaw->height();
    }

    if(deviceRgb)
    {
        _width = deviceRgb->width();
        _height = deviceRgb->height();
    }
    return true;
}
开发者ID:drdanz,项目名称:icub-main,代码行数:49,代码来源:USBcamera.cpp

示例3: open

bool FakeLaser::open(yarp::os::Searchable& config)
{
    bool correct=true;
    info = "Fake Laser device for test/debugging";
    device_status = DEVICE_OK_STANBY;

#if LASER_DEBUG
    yDebug("%s\n", config.toString().c_str());
#endif

    bool br = config.check("GENERAL");
    if (br != false)
    {
        yarp::os::Searchable& general_config = config.findGroup("GENERAL");
        period = general_config.check("Period", Value(50), "Period of the sampling thread").asInt();
    }

    min_distance = 0.1; //m
    max_distance = 2.5;  //m
    min_angle = 0;      //degrees
    max_angle = 359;    //degrees
    resolution = 1.0;   //degrees

    sensorsNum = (int)((max_angle-min_angle)/resolution);
    laser_data.resize(sensorsNum);
    
    yInfo("Starting debug mode");
    yInfo("max_dist %f, min_dist %f", max_distance, min_distance);
    yInfo("max_angle %f, min_angle %f", max_angle, min_angle);
    yInfo("resolution %f", resolution);
    yInfo("sensors %d", sensorsNum);
    Time::turboBoost();
    RateThread::start();
    return true;
}
开发者ID:BRKMYR,项目名称:yarp,代码行数:35,代码来源:fakeLaser.cpp

示例4: open

bool BmsBattery::open(yarp::os::Searchable& config)
{
    bool correct=true;

    //debug
    yDebug("%s\n", config.toString().c_str());

    Bottle& group_general = config.findGroup("GENERAL");
    Bottle& group_serial  = config.findGroup("SERIAL_PORT");

    if (group_general.isNull())
    {
        yError() << "Insufficient parameters to BmsBattery, section GENERAL missing";
        return false;
    }

    if (group_serial.isNull())
    {
        yError() << "Insufficient parameters to BmsBattery, section SERIAL_PORT missing";
        return false;
    }

    int period=config.find("thread_period").asInt();
    setRate(period);

    Property prop;
    std::string ps = group_serial.toString();
    prop.fromString(ps);
    prop.put("device", "serialport");

    //open the driver
    driver.open(prop);
    if (!driver.isValid())
    {
        yError() << "Error opening PolyDriver check parameters";
#ifndef DEBUG_TEST 
        return false;
#endif
    }

    //open the serial interface
    driver.view(pSerial);
    if (!pSerial)
    {
        yError("Error opening serial driver. Device not available");
#ifndef DEBUG_TEST 
        return false;
#endif
    }

    // Other options
    this->logEnable = group_general.check("logToFile", Value(0), "enable / disable the log to file").asBool();
    this->verboseEnable = group_general.check("verbose", Value(0), "enable/disable the verbose mode").asBool();
    this->screenEnable = group_general.check("screen", Value(0), "enable/disable the screen output").asBool();
    this->debugEnable = group_general.check("debug", Value(0), "enable/disable the debug mode").asBool();
    this->shutdownEnable = group_general.check("shutdown", Value(0), "enable/disable the automatic shutdown").asBool();

    RateThread::start();
    return true;
}
开发者ID:AbuMussabRaja,项目名称:icub-main,代码行数:60,代码来源:bmsBattery.cpp

示例5: open

bool DeviceGroup::open(const char *key, PolyDriver& poly,
                       yarp::os::Searchable& config, const char *comment) {

    Value *name;
    if (config.check(key,name,comment)) {
        if (name->isString()) {
            // maybe user isn't doing nested configuration
            yarp::os::Property p;
            p.setMonitor(config.getMonitor(),
                         name->toString().c_str()); // pass on any monitoring
            p.fromString(config.toString());
            p.put("device",name->toString());
            p.unput("subdevice");
            p.unput("wrapped");
            poly.open(p);
        } else {
            Bottle subdevice = config.findGroup(key).tail();
            poly.open(subdevice);
        }
        if (!poly.isValid()) {
            printf("cannot make <%s>\n", name->toString().c_str());
            return false;
        }
    } else {
        printf("\"--%s <name>\" not set\n", key);
        return false;
    }
    return true;
}
开发者ID:paulfitz,项目名称:yarp,代码行数:29,代码来源:DeviceGroup.cpp

示例6: open

bool BatteryWrapper::open(yarp::os::Searchable &config)
{
    Property params;
    params.fromString(config.toString().c_str());

    if (!config.check("period"))
    {
        yError() << "BatteryWrapper: missing 'period' parameter. Check you configuration file\n";
        return false;
    }
    else
        _rate = config.find("period").asInt();

    if (!config.check("name"))
    {
        yError() << "BatteryWrapper: missing 'name' parameter. Check you configuration file; it must be like:";
        yError() << "   name:         full name of the port, like /robotName/deviceId/sensorType:o";
        return false;
    }
    else
    {
        streamingPortName  = config.find("name").asString().c_str();
        rpcPortName = streamingPortName + "/rpc:i";
        setId("batteryWrapper");
    }

    if(!initialize_YARP(config) )
    {
        yError() << sensorId << "Error initializing YARP ports";
        return false;
    }
    return true;
}
开发者ID:AbuMussabRaja,项目名称:yarp,代码行数:33,代码来源:BatteryWrapper.cpp

示例7: reconfigure

 virtual bool reconfigure(yarp::os::Searchable& config) {
   options.fromString(config.toString());
   if (options.check("overlay")) {
     workOverlay = options.check("overlay",Value("")).toString().c_str();
   }
   needRead = true;
   return true;
 }
开发者ID:ephemeraleclipse,项目名称:ucanvcam,代码行数:8,代码来源:OverlayEffect.cpp

示例8: fromConfig

bool embObjMultiEnc::fromConfig(yarp::os::Searchable &_config)
{
    yDebug()<< "configurazione: ";;
    yDebug() << _config.toString();

    Bottle general = _config.findGroup("JOINTS");
    if(general.isNull())
    {
        yError() << "embObjMultiEnc cannot find general group";
        return false;
    }
    
    Bottle jointsbottle = general.findGroup("listofjoints");
    if (jointsbottle.isNull())
    {
        yError() << "embObjMultiEnc cannot find listofjoints param";
        return false;
    }
          
    Bottle encsbottle = general.findGroup("encoderConversionFactor");
    if (encsbottle.isNull())
    {
        yError() << "embObjMultiEnc cannot find encoderConversionFactor param";
        return false;
    }
     
 
    //jointsbottle contains: "listofjoints 0 1 2 3. So the num of joints is jointsbottle->size() -1 " 
    numofjoints = jointsbottle.size() -1;  
    
    listofjoints.clear();
    for (int i = 1; i < jointsbottle.size(); i++)  listofjoints.push_back(jointsbottle.get(i).asInt());

    yDebug()<< " embObjMultiEnc List of joints: " << numofjoints;
    for(int i=0; i<numofjoints; i++) yDebug() << "pos="<< i << "val="<<  listofjoints[i];
   
    analogdata.resize(numofencperjoint*numofjoints, 0.0);
    encoderConversionFactor.resize(numofencperjoint*numofjoints, 1.0);

    if (numofencperjoint*numofjoints!=encsbottle.size()-1)
    {
        yError() << "embObjMultiEnc invalid size of encoderConversionFactor param";
        return false;
	}
	for (int i=0; i<encsbottle.size()-1; i++)
	{
		encoderConversionFactor[i]=encsbottle.get(i+1).asDouble();
	}
         
    return true;
}
开发者ID:drdanz,项目名称:icub-main,代码行数:51,代码来源:embObjMultiEnc.cpp

示例9: validateConf

bool CanBusInertialMTB::validateConf(yarp::os::Searchable& config,
                                     std::vector<int> & canAddresses)
{
    std::cout << "CanBusInertialMTB::validateConf : " << config.toString() << std::endl;
    bool correct=true;

    correct = correct && checkRequiredParamIsString(config,"canbusDevice");
    correct = correct && checkRequiredParamIsInt(config,"canDeviceNum");
    correct = correct && checkRequiredParamIsVectorOfInt(config,"canAddress",canAddresses);
    correct = correct && checkRequiredParamIsString(config,"physDevice");
    correct = correct && checkRequiredParamIsString(config,"sensorType");

    return correct;
}
开发者ID:robotology,项目名称:icub-main,代码行数:14,代码来源:CanBusInertialMTB.cpp

示例10: open

//DEVICE DRIVER
bool GazeboYarpDepthCameraDriver::open(yarp::os::Searchable &config)
{
    string sensorScopedName((config.find(YarpScopedName.c_str()).asString().c_str()));

    //Get gazebo pointers
    m_conf.fromString(config.toString());
    m_depthCameraSensorPtr = dynamic_cast<gazebo::sensors::DepthCameraSensor*> (GazeboYarpPlugins::Handler::getHandler()->getSensor(sensorScopedName));

    if (!m_depthCameraSensorPtr)
    {
        yError("camera sensor was not found (sensor's scoped name %s!)", sensorScopedName.c_str());
        return false;
    }

    m_depthCameraPtr = this->m_depthCameraSensorPtr->DepthCamera();

    m_width  = m_depthCameraPtr->ImageWidth();
    m_height = m_depthCameraPtr->ImageHeight();
    m_imageFrame_BufferSize = m_depthCameraPtr->ImageDepth() * m_width * m_height;
    m_depthFrame_BufferSize = m_width * m_height * sizeof(float);

    m_depthFrameMutex.wait();

    m_depthFrame_Buffer = new float[m_width * m_height];
    memset(m_depthFrame_Buffer, 0x00, m_depthFrame_BufferSize);

    m_depthFrameMutex.post();

    m_colorFrameMutex.wait();

    m_imageFrame_Buffer = new unsigned char[m_imageFrame_BufferSize];
    memset(m_imageFrame_Buffer, 0x00, m_imageFrame_BufferSize);

    m_colorFrameMutex.post();

    //Connect the driver to the gazebo simulation
    auto imageConnectionBind = boost::bind(&GazeboYarpDepthCameraDriver::OnNewImageFrame, this, _1, _2, _3, _4, _5);
    auto depthConnectionBind = boost::bind(&GazeboYarpDepthCameraDriver::OnNewDepthFrame, this, _1, _2, _3, _4, _5);

    this->m_updateImageFrame_Connection = m_depthCameraPtr->ConnectNewImageFrame(imageConnectionBind);
    this->m_updateDepthFrame_Connection = m_depthCameraPtr->ConnectNewDepthFrame(depthConnectionBind);

    return true;
}
开发者ID:nunoguedelha,项目名称:gazebo-yarp-plugins,代码行数:45,代码来源:DepthCameraDriver.cpp

示例11: open

//DEVICE DRIVER
bool GazeboYarpJointSensorsDriver::open(yarp::os::Searchable& config)
{
    std::cout << "GazeboYarpJointSensorsDriver::open() called" << std::endl;
  
    yarp::os::Property pluginParameters;
    pluginParameters.fromString(config.toString().c_str());

    std::string robotName (pluginParameters.find("robotScopedName").asString().c_str());
    std::cout << "DeviceDriver is looking for robot " << robotName << "...\n";

    _robot = GazeboYarpPlugins::Handler::getHandler()->getRobot(robotName);
    if(NULL == _robot)
    {
        std::cout << "GazeboYarpJointSensorsDriver error: robot was not found\n";
        return false;
    }
    
    bool ok = setJointPointers(pluginParameters);
    assert(joint_ptrs.size() == jointsensors_nr_of_channels);
    if( !ok ) 
    { 
        return false;
    }
    
    ok = setJointSensorsType(pluginParameters);
    if( !ok ) 
    { 
        return false;
    }
    
    data_mutex.wait();
    jointsensors_data.resize(jointsensors_nr_of_channels,0.0);
    data_mutex.post();
    
    //Connect the driver to the gazebo simulation
    this->updateConnection = gazebo::event::Events::ConnectWorldUpdateBegin (
                                 boost::bind ( &GazeboYarpJointSensorsDriver::onUpdate, this, _1 ) );
  
    std::cout << "GazeboYarpJointSensorsDriver::open() returning true" << std::endl;
    return true;
}
开发者ID:hu-yue,项目名称:gazebo-yarp-plugins,代码行数:42,代码来源:JointSensorsDriver.cpp

示例12: open

bool GazeboYarpContactLoadCellArrayDriver::open(yarp::os::Searchable& config)
{
    yarp::os::Property pluginParams;
    pluginParams.fromString(config.toString().c_str());

    std::string robotName(pluginParams.find("robotName").asString().c_str());

    this->m_robot = GazeboYarpPlugins::Handler::getHandler()->getRobot(robotName);
    if (this->m_robot == NULL)
    {
        yError() << "GazeboYarpContactLoadCellArrayDriver: Robot Model was not found";
        return false;
    }

    if (!this->initLinkAssociatedToContactSensor(pluginParams))
    {
        return false;
    }

    if (!this->initContactSensor())
    {
        return false;
    }

    if (!this->configure(pluginParams))
    {
        return false;
    }

    if (!this->prepareLinkInformation())
    {
        return false;
    }

    yarp::os::LockGuard guard(m_dataMutex);

    this->m_updateConnection = gazebo::event::Events::ConnectWorldUpdateBegin(boost::bind(&GazeboYarpContactLoadCellArrayDriver::onUpdate, this, _1));
    this->m_sensor->SetActive(true);

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

示例13: open

bool FakeAnalogSensor::open(yarp::os::Searchable& config)
{
    yTrace();
    bool correct=true;

    //debug
    fprintf(stderr, "%s\n", config.toString().c_str());

    // Check parameters first
//     if(!config.check("channels"))
//     {
//         correct = false;
//         yError() << "Parameter 'channels' missing";
//     }

    if(!config.check("period"))
    {
        correct = false;
        yError() << "Parameter 'period' missing";
    }

    if (!correct)
    {
        yError() << "Insufficient parameters to FakeAnalogSensor\n";
        return false;
    }

    int period=config.find("period").asInt();
    setRate(period);

    //create the data vector:
    this->channelsNum = 1;
    data.resize(channelsNum);
    data.zero();

    RateThread::start();
    return true;
}
开发者ID:jgvictores,项目名称:yarp,代码行数:38,代码来源:fakeAnalogSensor.cpp

示例14: open

bool comanFTsensor::open(yarp::os::Searchable &config)
{
    _comanHandler = comanDevicesHandler::instance();

    if(_comanHandler == NULL)
    {
        yError() << "unable to create a new Coman Device Handler class!";
        return false;
    }

    if(!_comanHandler->open(config))
    {
        yError() << "Unable to initialize Coman Device Handler class... probably np boards were found. Check log.";
        return false;
    }
    _boards_ctrl = _comanHandler->getBoard_ctrl_p();

    if(_boards_ctrl == NULL)
    {
        yError() << "unable to create a new Boards_ctrl class!";
        return false;
    }

    Property prop;
    std::string str=config.toString().c_str();
    yTrace() << str;

    if(!fromConfig(config))
        return false;

    prop.fromString(str.c_str());


    // TODO fix this!
#warning "<><> TODO: This is a copy of the mcs map. Verify that things will never change after this copy or use a pointer (better) <><>"
    _fts = _boards_ctrl->get_fts_map();
    return true;
}
开发者ID:Karma-Revolutions,项目名称:icub-main,代码行数:38,代码来源:comanFTsensor.cpp

示例15: open

bool PolyDriver::open(yarp::os::Searchable& config) {
    if (isValid()) {
        // already open - should close first
        return false;
    }
    if (system_resource==NULL) {
        system_resource = new YarpDevMonitor;
    }
    yAssert(system_resource!=NULL);
    bool removeMonitorAfterwards = false;
    if (config.getMonitor()==NULL) {
        config.setMonitor(&HELPER(system_resource));
        removeMonitorAfterwards = true;
    }

    //dd = Drivers::factory().open(config);
    coreOpen(config);
    HELPER(system_resource).info.fromString(config.toString());
    if (removeMonitorAfterwards) {
        config.setMonitor(NULL);
    }
    return isValid();
}
开发者ID:giuliavezzani,项目名称:yarp,代码行数:23,代码来源:PolyDriver.cpp


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