本文整理汇总了C++中yarp::os::Searchable类的典型用法代码示例。如果您正苦于以下问题:C++ Searchable类的具体用法?C++ Searchable怎么用?C++ Searchable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Searchable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: KinectSkeletonData
bool yarp::dev::KinectDeviceDriverClient::open(yarp::os::Searchable& config){
string localPortPrefix,remotePortPrefix;
_inUserSkeletonPort = _outPort = NULL;
_skeletonData = new KinectSkeletonData();
if(config.check("localPortPrefix")) localPortPrefix = config.find("localPortPrefix").asString();
else {
printf("\t- Error: localPortPrefix element not found in PolyDriver.\n");
return false;
}
if(config.check("remotePortPrefix")) remotePortPrefix = config.find("remotePortPrefix").asString();
else {
printf("\t- Error: remotePortPrefix element not found in PolyDriver.\n");
return false;
}
Network yarp;
string remotePortIn = remotePortPrefix+":i";
if(!yarp.exists(remotePortIn.c_str())){
printf("\t- Error: remote port not found. (%s)\n\t Check if KinectDeviceDriverServer is running.\n",remotePortIn.c_str());
return false;
}
if(!connectPorts(remotePortPrefix,localPortPrefix)) {
printf("\t- Error: Could not connect or create ports.\n");
return false;
}
//_portMod = new PortCtrlMod();
//_portMod->setInterfaceDriver(this);
_inUserSkeletonPort->useCallback(*this);
_inDepthMapPort->useCallback(*this);
_inImageMapPort->useCallback(*this);
return true;
}
示例3: open
bool Conspicuity::open(yarp::os::Searchable& config){
_sizeConsp = config.check("numCenterSurroundScales",
Value(3),
"Number of center surround scale levels (gaussian pyramide size = numScales + 2) (int).").asInt();
if (_sizeConsp < 1)
_sizeConsp = 1;
_sizePyr = _sizeConsp + 2;
//_prtRgb.open("/rgb");
/* filterName = config.check( "filterName",
yarp::os::Value("emd"),
"Name of this instance of the emd filter (string).").asString(); */
return true;
}
示例4: open
bool YarpJointDev::open ( yarp::os::Searchable& config ) {
yarp::os::Value partName = config.find ( "part" );
if ( partName.isNull() || !partName.isString() )
return false;
_chain = boost::shared_ptr<NaoJointChain> (
new NaoJointChain ( std::string ( partName.asString() ) ) );
/// Initializing trajectory speeds to max speed.
for ( unsigned i = 0; i < _chain->GetNumberOfJoints(); ++i )
_refSpeeds.push_back ( 1.0f );
_maxRefSpeed = 1.0f;
return true;
}
示例5: yError
bool yarp::dev::LocationsServer::open(yarp::os::Searchable &config)
{
m_local_name.clear();
m_local_name = config.find("local").asString().c_str();
m_ros_enabled = false;
if (m_local_name == "")
{
yError("LocationsServer::open() error you have to provide valid local name");
return false;
}
if (config.check("ROS_enabled"))
{
m_ros_enabled = true;
m_rosNode = new yarp::os::Node("/LocationServer");
m_rosPublisherPort.topic("/locationServerMarkers");
}
if (config.check("locations_file"))
{
std::string location_file = config.find("locations_file").asString();
bool ret = load_locations(location_file);
if (ret) { yInfo() << "Location file" << location_file << "successfully loaded."; }
else { yError() << "Problems opening file" << location_file; }
}
if (config.check("period"))
{
m_period = config.find("period").asInt();
}
else
{
m_period = 10;
yWarning("LocationsServer: using default period of %d ms" , m_period);
}
ConstString local_rpc = m_local_name;
local_rpc += "/rpc";
if (!m_rpc_port.open(local_rpc.c_str()))
{
yError("LocationsServer::open() error could not open rpc port %s, check network", local_rpc.c_str());
return false;
}
m_rpc_port.setReader(*this);
return true;
}
示例6: sensorScopedName
bool yarp::dev::GazeboYarpMultiCameraDriver::open(yarp::os::Searchable& config)
{
//Get gazebo pointers
std::string sensorScopedName(config.find(YarpScopedName.c_str()).asString().c_str());
m_parentSensor = (gazebo::sensors::MultiCameraSensor*)GazeboYarpPlugins::Handler::getHandler()->getSensor(sensorScopedName);
if (!m_parentSensor) {
yError() << "GazeboYarpMultiCameraDriver Error: camera sensor was not found";
return false;
}
m_vertical_flip = config.check("vertical_flip");
m_horizontal_flip = config.check("horizontal_flip");
m_display_timestamp = config.check("display_timestamp");
m_display_time_box = config.check("display_time_box");
m_vertical = config.check("vertical");
m_camera_count = this->m_parentSensor->CameraCount();
for (unsigned int i = 0; i < m_camera_count; ++i) {
m_camera.push_back(m_parentSensor->Camera(i));
if(m_camera[i] == NULL) {
yError() << "GazeboYarpMultiCameraDriver: camera" << i << "pointer is not valid";
return false;
}
m_width.push_back(m_camera[i]->ImageWidth());
m_height.push_back(m_camera[i]->ImageHeight());
m_max_width = std::max(m_max_width, m_width[i]);
m_max_height = std::max(m_max_height, m_height[i]);
m_bufferSize.push_back(3 * m_width[i] * m_height[i]);
m_dataMutex.push_back(new yarp::os::Semaphore());
m_dataMutex[i]->wait();
m_imageBuffer.push_back(new unsigned char[m_bufferSize[i]]);
memset(m_imageBuffer[i], 0x00, m_bufferSize[i]);
m_dataMutex[i]->post();
m_lastTimestamp.push_back(yarp::os::Stamp());
}
// Connect all the cameras only when everything is set up
for (unsigned int i = 0; i < m_camera_count; ++i) {
this->m_updateConnection.push_back(this->m_camera[i]->ConnectNewImageFrame(boost::bind(&yarp::dev::GazeboYarpMultiCameraDriver::captureImage, this, i, _1, _2, _3, _4, _5)));
}
return true;
}
示例7: printf
bool DimaxU2C::open(yarp::os::Searchable& config) {
printf("DimaxU2C: open\n");
numJoints = config.check("axes",
yarp::os::Value(DEFAULT_NUM_MOTORS),
"number of motors").asInt();
speeds = new double[numJoints];
accels = new double[numJoints];
int *amap = new int[numJoints];
double *enc = new double[numJoints];
double *zos = new double[numJoints];
for (int i=0;i<numJoints;i++) {
speeds[i]=10;
accels[i]=0;
// for now we are mapping one to one so you pass
// the raw motor position in range 800-2200
// TODO: convert from angle to joint value
amap[i]=i;
enc[i]=1.0;
zos[i]=0.0;
}
printf("Calling initialize: numJoints %d\n",numJoints);
initialize(numJoints, // number of joints/axes
amap, // axes map
enc, // encoder to angles conversion factors
zos // zeros of encoders
);
if (servos) {
printf("Initialise Servo object\n");
servos->init();
return true;
} else {
ACE_OS::fprintf(stderr,"DimaxU2C: No Servo object created\n");
return false;
}
return true;
}
示例8: 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;
}
示例9: 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;
}
示例10: configure
bool Standardizer::configure(yarp::os::Searchable& config) {
bool success = this->IScaler::configure(config);
// set the desired output mean (double)
if(config.find("mean").isDouble() || config.find("mean").isInt()) {
this->setDesiredMean(config.find("mean").asDouble());
success = true;
}
// set the desired output standard deviation (double)
if(config.find("std").isDouble() || config.find("std").isInt()) {
this->setDesiredStd(config.find("std").asDouble());
success = true;
}
return success;
}
示例11: 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;
}
示例12: fromConfig
bool embObjMais::fromConfig(yarp::os::Searchable &_config)
{
#if defined(EMBOBJMAIS_USESERVICEPARSER)
if(false == parser->parseService(_config, serviceConfig))
{
return false;
}
return true;
#else
Bottle xtmp;
int _period = 0;
// Analog Sensor stuff
Bottle config = _config.findGroup("GENERAL");
if (!extractGroup(config, xtmp, "Period","transmitting period of the sensors", 1))
{
yError() << "embObjMais Using default value = 0 (disabled)";
_period = 0;
}
else
{
_period = xtmp.get(1).asInt();
yDebug() << "embObjMais::fromConfig() detects embObjMais Using value of" << _period;
}
serviceConfig.acquisitionrate = _period;
return true;
#endif
}
示例13: configure
bool IFixedSizeMatrixInputLearner::configure(yarp::os::Searchable& config) {
bool success = false;
// set the domain rows (int)
if(config.find("domRows").isInt()) {
this->setDomainRows(config.find("domRows").asInt());
success = true;
}
// set the domain cols (int)
if(config.find("domCols").isInt()) {
this->setDomainCols(config.find("domCols").asInt());
success = true;
}
// set the codomain size (int)
if(config.find("cod").isInt()) {
this->setCoDomainSize(config.find("cod").asInt());
success = true;
}
return success;
}
开发者ID:helloxss,项目名称:online-inertial-parameter-estimation,代码行数:21,代码来源:IFixedSizeMatrixInputLearner.cpp
示例14: yDebug
bool laserHokuyo::open(yarp::os::Searchable& config)
{
bool correct=true;
internal_status = HOKUYO_STATUS_NOT_READY;
info = "Hokuyo Laser";
device_status = DEVICE_OK_STANBY;
#if LASER_DEBUG
yDebug("%s\n", config.toString().c_str());
#endif
bool br = config.check("GENERAL");
if (br == false)
{
yError("cannot read 'GENERAL' section");
return false;
}
yarp::os::Searchable& general_config = config.findGroup("GENERAL");
//list of mandatory options
//TODO change comments
period = general_config.check("Period", Value(50), "Period of the sampling thread").asInt();
start_position = general_config.check("Start_Position", Value(0), "Start position").asInt();
end_position = general_config.check("End_Position", Value(1080), "End Position").asInt();
error_codes = general_config.check("Convert_Error_Codes", Value(0), "Substitute error codes with legal measurments").asInt();
yarp::os::ConstString s = general_config.check("Laser_Mode", Value("GD"), "Laser Mode (GD/MD").asString();
if (general_config.check("Measurement_Units"))
{
yError() << "Deprecated parameter 'Measurement_Units'. Please Remove it from the configuration file.";
}
if (error_codes==1)
{
yInfo("'error_codes' option enabled. Invalid samples will be substituded with out-of-range measurements.");
}
if (s=="GD")
{
laser_mode = GD_MODE;
yInfo("Using GD mode (single acquisition)");
}
else if (s=="MD")
{
laser_mode = MD_MODE;
yInfo("Using MD mode (continuous acquisition)");
}
else
{
laser_mode = GD_MODE;
yError("Laser_mode not found. Using GD mode (single acquisition)");
}
bool ok = general_config.check("Serial_Configuration");
if (!ok)
{
yError("Cannot find configuration file for serial port communication!");
return false;
}
yarp::os::ConstString serial_filename = general_config.find("Serial_Configuration").asString();
//string st = config.toString();
setRate(period);
Property prop;
prop.put("device", "serialport");
ok = prop.fromConfigFile(serial_filename.c_str(),config,false);
if (!ok)
{
yError("Unable to read from serial port configuration file");
return false;
}
pSerial=0;
driver.open(prop);
if (!driver.isValid())
{
yError("Error opening PolyDriver check parameters");
return false;
}
driver.view(pSerial);
if (!pSerial)
{
yError("Error opening serial driver. Device not available");
return false;
}
Bottle b;
Bottle b_ans;
string ans;
// *** Check if the URG device is present ***
b.addString("SCIP2.0\n");
pSerial->send(b);
yarp::os::Time::delay(0.040);
pSerial->receive(b_ans);
if (b_ans.size()>0)
//.........这里部分代码省略.........
示例15: open
bool parametricCalibrator::open(yarp::os::Searchable& config)
{
yTrace();
Property p;
p.fromString(config.toString());
if (p.check("GENERAL")==false)
{
yError() << "missing [GENERAL] section";
return false;
}
if(p.findGroup("GENERAL").check("deviceName"))
{
deviceName = p.findGroup("GENERAL").find("deviceName").asString();
}
else
{
yError() << "missing deviceName parameter";
return false;
}
std::string str;
if(config.findGroup("GENERAL").find("verbose").asInt())
{
str=config.toString().c_str();
yTrace() << deviceName.c_str() << str;
}
// Check Vanilla = do not use calibration!
skipCalibration =config.findGroup("GENERAL").find("skipCalibration").asBool() ;// .check("Vanilla",Value(1), "Vanilla config");
skipCalibration = !!skipCalibration;
if(skipCalibration )
yWarning() << "parametric calibrator: skipping calibration!! This option was set in general.xml file.";
int nj = 0;
if(p.findGroup("GENERAL").check("joints"))
{
nj = p.findGroup("GENERAL").find("joints").asInt();
}
else
{
yError() << deviceName.c_str() << ": missing joints parameter" ;
return false;
}
type = new unsigned char[nj];
param1 = new double[nj];
param2 = new double[nj];
param3 = new double[nj];
maxPWM = new int[nj];
zeroPos = new double[nj];
zeroVel = new double[nj];
currPos = new double[nj];
currVel = new double[nj];
homePos = new double[nj];
homeVel = new double[nj];
zeroPosThreshold = new double[nj];
int i=0;
Bottle& xtmp = p.findGroup("CALIBRATION").findGroup("calibration1");
if (xtmp.size()-1!=nj) {yError() << deviceName << ": invalid number of Calibration1 params " << xtmp.size()<< " " << nj; return false;}
for (i = 1; i < xtmp.size(); i++) param1[i-1] = xtmp.get(i).asDouble();
xtmp = p.findGroup("CALIBRATION").findGroup("calibration2");
if (xtmp.size()-1!=nj) {yError() << "invalid number of Calibration2 params"; return false;}
for (i = 1; i < xtmp.size(); i++) param2[i-1] = xtmp.get(i).asDouble();
xtmp = p.findGroup("CALIBRATION").findGroup("calibration3");
if (xtmp.size()-1!=nj) {yError() << "invalid number of Calibration3 params"; return false;}
for (i = 1; i < xtmp.size(); i++) param3[i-1] = xtmp.get(i).asDouble();
xtmp = p.findGroup("CALIBRATION").findGroup("calibrationType");
if (xtmp.size()-1!=nj) {yError() << "invalid number of Calibration3 params"; return false;}
for (i = 1; i < xtmp.size(); i++) type[i-1] = (unsigned char) xtmp.get(i).asDouble();
xtmp = p.findGroup("CALIBRATION").findGroup("positionZero");
if (xtmp.size()-1!=nj) {yError() << "invalid number of PositionZero params"; return false;}
for (i = 1; i < xtmp.size(); i++) zeroPos[i-1] = xtmp.get(i).asDouble();
xtmp = p.findGroup("CALIBRATION").findGroup("velocityZero");
if (xtmp.size()-1!=nj) {yError() << "invalid number of VelocityZero params"; return false;}
for (i = 1; i < xtmp.size(); i++) zeroVel[i-1] = xtmp.get(i).asDouble();
xtmp = p.findGroup("HOME").findGroup("positionHome");
if (xtmp.size()-1!=nj) {yError() << "invalid number of PositionHome params"; return false;}
for (i = 1; i < xtmp.size(); i++) homePos[i-1] = xtmp.get(i).asDouble();
xtmp = p.findGroup("HOME").findGroup("velocityHome");
if (xtmp.size()-1!=nj) {yError() << "invalid number of VelocityHome params"; return false;}
for (i = 1; i < xtmp.size(); i++) homeVel[i-1] = xtmp.get(i).asDouble();
xtmp = p.findGroup("CALIBRATION").findGroup("maxPwm");
if (xtmp.size()-1!=nj) {yError() << "invalid number of MaxPwm params"; return false;}
for (i = 1; i < xtmp.size(); i++) maxPWM[i-1] = xtmp.get(i).asInt();
xtmp = p.findGroup("CALIBRATION").findGroup("posZeroThreshold");
if (xtmp.size()-1!=nj) {yError() << "invalid number of PosZeroThreshold params"; return false;}
//.........这里部分代码省略.........