本文整理汇总了C++中yarp::os::Property::find方法的典型用法代码示例。如果您正苦于以下问题:C++ Property::find方法的具体用法?C++ Property::find怎么用?C++ Property::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yarp::os::Property
的用法示例。
在下文中一共展示了Property::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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!=""){
}
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}
示例11: load
bool MonitorSharedLib::load(const yarp::os::Property& options)
{
string filename = options.find("filename").asString();
monitorFactory.open(filename.c_str(), "MonitorObject_there");
if(!monitorFactory.isValid()) {
string msg = string("Cannot load shared library ") + filename + string(" (");
msg += Vocab::decode(monitorFactory.getStatus()) + string(")");
yError(msg.c_str());
return false;
}
monitorFactory.addRef();
monitor.open(monitorFactory);
if(!monitor.isValid()) {
yError("Cannot create an instance of MonitorObject");
return false;
}
return monitor->create(options);
}
示例12: periodInMilliSeconds
// *********************************************************************************************************************
// *********************************************************************************************************************
// ICUB WHOLE BODY DYNAMICS ESTIMATOR
// *********************************************************************************************************************
// *********************************************************************************************************************
ExternalWrenchesAndTorquesEstimator::ExternalWrenchesAndTorquesEstimator(int _period,
yarpWholeBodySensors *_sensors,
yarp::os::BufferedPort<iCub::skinDynLib::skinContactList> * _port_skin_contacts,
yarp::os::Property & _wbi_yarp_conf
)
: periodInMilliSeconds(_period),
sensors(_sensors),
port_skin_contacts(_port_skin_contacts),
enable_omega_domega_IMU(false),
min_taxel(0),
wbi_yarp_conf(_wbi_yarp_conf),
assume_fixed_base_from_odometry(false)
{
resizeAll(sensors->getSensorNumber(SENSOR_ENCODER));
resizeFTs(sensors->getSensorNumber(SENSOR_FORCE_TORQUE));
resizeIMUs(sensors->getSensorNumber(SENSOR_IMU));
///< Skin timestamp
last_reading_skin_contact_list_Stamp = -1000.0;
if( _wbi_yarp_conf.check("fixed_base") )
{
assume_fixed_base = true;
fixed_link = _wbi_yarp_conf.find("fixed_base").asString();
}
else
{
assume_fixed_base = false;
}
if( _wbi_yarp_conf.check("assume_fixed_from_odometry") )
{
this->assume_fixed_base_from_odometry = true;
}
}
示例13: yError
// Iif a subdevice parameter is given to the wrapper, it will open it as well
// and and attach to it immediatly.
bool yarp::dev::ServerInertial::openAndAttachSubDevice(yarp::os::Property& prop)
{
yarp::os::Value &subdevice = prop.find("subdevice");
IMU_polydriver = new yarp::dev::PolyDriver;
// yDebug("Subdevice %s\n", subdevice.toString().c_str());
if (subdevice.isString())
{
// maybe user isn't doing nested configuration
yarp::os::Property p;
p.setMonitor(prop.getMonitor(), "subdevice"); // pass on any monitoring
p.fromString(prop.toString());
p.put("device",subdevice.toString());
IMU_polydriver->open(p);
}
else
IMU_polydriver->open(subdevice);
if (!IMU_polydriver->isValid())
{
yError("cannot create device <%s>\n", subdevice.toString().c_str());
return false;
}
// if we are here, poly is valid
IMU_polydriver->view(IMU); // attach to subdevice
if(IMU == NULL)
{
yError("Error, subdevice <%s> has no valid IMU interface\n", subdevice.toString().c_str());
IMU_polydriver->close();
return false;
}
// iTimed interface
IMU_polydriver->view(iTimed); // not mandatory
return true;
}
示例14: init
/*! \brief Init the application with the current configuration.
*
* \param config the configuration
*/
void MainWindow::init(yarp::os::Property config)
{
this->config = config;
string basepath=config.check("ymanagerini_dir", yarp::os::Value("")).asString().c_str();
templateList.clear();
if(config.check("modpath")){
string strPath;
string modPaths(config.find("modpath").asString().c_str());
while (modPaths!=""){
string::size_type pos=modPaths.find(";");
strPath=modPaths.substr(0, pos);
yarp::manager::trimString(strPath);
if (!isAbsolute(strPath.c_str()))
strPath=basepath+strPath;
if((strPath.rfind(PATH_SEPERATOR)==string::npos) ||
(strPath.rfind(PATH_SEPERATOR)!=strPath.size()-1))
strPath = strPath + string(PATH_SEPERATOR);
lazyManager.addModules(strPath.c_str());
if (pos==string::npos || pos==0)
break;
modPaths=modPaths.substr(pos+1);
}
}
if(config.check("respath")){
string strPath;
string resPaths(config.find("respath").asString().c_str());
while (resPaths!=""){
string::size_type pos=resPaths.find(";");
strPath=resPaths.substr(0, pos);
yarp::manager::trimString(strPath);
if (!isAbsolute(strPath.c_str()))
strPath=basepath+strPath;
if((strPath.rfind(PATH_SEPERATOR)==string::npos) ||
(strPath.rfind(PATH_SEPERATOR)!=strPath.size()-1))
strPath = strPath + string(PATH_SEPERATOR);
lazyManager.addResources(strPath.c_str());
if (pos==string::npos)
break;
resPaths=resPaths.substr(pos+1);
}
}
yarp::manager::ErrorLogger* logger = yarp::manager::ErrorLogger::Instance();
if(config.check("apppath")){
string strPath;
string appPaths(config.find("apppath").asString().c_str());
while (appPaths!=""){
string::size_type pos=appPaths.find(";");
strPath=appPaths.substr(0, pos);
yarp::manager::trimString(strPath);
if (!isAbsolute(strPath.c_str())){
strPath=basepath+strPath;
}
if((strPath.rfind(PATH_SEPERATOR)==string::npos) ||
(strPath.rfind(PATH_SEPERATOR)!=strPath.size()-1)){
strPath = strPath + string(PATH_SEPERATOR);
}
if(config.find("load_subfolders").asString() == "yes"){
if(!loadRecursiveApplications(strPath.c_str())){
logger->addError("Cannot load the applications from " + strPath);
}
loadRecursiveTemplates(strPath.c_str());
std::sort(templateList.begin(),
templateList.end(), AppTemplateCompare);
std::vector<yarp::manager::AppTemplate>::iterator itr;
for(itr=templateList.begin(); itr!=templateList.end(); itr++)
ui->entitiesTree->addAppTemplate(&(*itr));
}
else{
lazyManager.addApplications(strPath.c_str());
}
if (pos==string::npos){
break;
}
appPaths=appPaths.substr(pos+1);
}
}
if (config.check("templpath")){
string strPath;
string templPaths(config.find("templpath").asString().c_str());
while (templPaths!=""){
string::size_type pos=templPaths.find(";");
strPath=templPaths.substr(0, pos);
yarp::manager::trimString(strPath);
if (!isAbsolute(strPath.c_str())){
strPath=basepath+strPath;
}
//.........这里部分代码省略.........
示例15: initConfiguration
bool SkinGroup::initConfiguration(yarp::os::Property &conf) {
//int s = conf.size();
//this->groupName = conf.get(0).asString().c_str();
yarp::os::Value v = conf.find("groupname");
if(v.isNull()) {
printf("Not Group Name specified\n");
return false;
}
else {
this->groupName = v.asString().c_str();
}
initLogFile(conf);
yarp::os::Value v2 = conf.find("parts");
if(v2.isNull()) {
return false;
}
else {
// add all parts to this group
if(!initSensors(conf)) {
cerr << "ERROR: initSensors error. (SkinGroup)" << endl;
return false;
}
}
/*
for (int j = 1; j < conf.size(); j++)
{
cout << conf.get(j).asString() << endl;
int k = 0;
for (k = 0; k < parts->size(); k++)
{
if (parts->at(k)->getPartName() == string(
conf.get(j).asString().c_str()))
{
cout << "part : " << parts->at(k)->getPartName().c_str()
<< " is found and added to SkinGroup "
<< this->groupName << endl;
this->skinParts.push_back(parts->at(k));
break;
}
}
if (k == parts->size())
{
// Not found. Error
cerr << "Sensor " << conf.get(j).asString().c_str()
<< " for group " << this->groupName << " is not available."
<< endl;
return false;
}
}
// not necessary. just to double check
if (this->skinParts.size() != conf.size() - 1)
{
// Not found. Error
cerr << "Not all sensors in sensorgroup " << this->groupName
<< " are available. Check the config files" << endl;
return false;
}
*/
cout << "OK. Sensors added for sensorgroup " << this->groupName << endl;
// init other settings, e.g. offsets for each sensor in the whole data set
taxelDimension = 0;
for (size_t k = 0; k < skinParts.size(); k++)
{
offsets.push_back(taxelDimension);
taxelDimension += skinParts[k]->getAllNumTaxels();
}
// other variables
tempTactileData = new TactileData(taxelDimension);
// load svm model file
// TODO:
yarp::os::ConstString _svmmodelfile = conf.find("svmmodel").asString();
_svmmodelfile = conf.check("svmmodelfilepath", yarp::os::Value("traindata"), "").asString() + FILESEPARATOR + _svmmodelfile;
this->svmmodelfile = _svmmodelfile.c_str();
cout << "SKINGROUP : " << this->groupName << " has " << this->taxelDimension << " taxels" << endl;
//this->classification = new TactileClassificationRawData(this->taxelDimension);
this->classification = new TactileClassificationHist(this->taxelDimension);
if(!this->classification->loadSVMModel(svmmodelfile.c_str()))
{
cout << "ERROR: cannot load SVMModel file " << svmmodelfile.c_str() << endl;
return false;
}
yarp::os::Property custProp;
custProp.put("normalisation", "none");
//.........这里部分代码省略.........