8 #include <yarp/os/Thread.h>
9 #include <yarp/os/RFModule.h>
10 #include <yarp/os/Os.h>
15 using namespace yarp::sig;
16 using namespace yarp::os;
23 setId(
"undefinedPartName");
32 analog->calibrateSensor();
40 if(params.check(
"ports"))
42 Bottle *ports=params.find(
"ports").asList();
43 setId(ports->get(0).asString().c_str());
44 numPorts=ports->size();
47 if(!params.check(
"robotName") )
50 yError() <<
"skinWrapper: missing robot Name, check your configuration file!! Quitting\n";
54 if (params.check(
"period"))
56 period=params.find(
"period").asInt32();
61 yDebug() <<
"skinWrapper Warning: part "<<
id<<
" using default period ("<<period<<
")\n";
65 int total_taxels=params.find(
"total_taxels").asInt32();
66 std::string robotName=params.find(
"robotName").asString().c_str();
67 std::string root_name;
73 Property option(params.toString().c_str());
74 option.put(
"name",root_name);
75 option.unput(
"device");
76 option.put(
"device",
"analogServer");
77 option.put(
"channels",total_taxels);
78 option.unput(
"total_taxels");
79 if(!driver.open(option))
81 yError()<<
"skinWrapper: unable to open the device";
86 yError()<<
"skinWrapper: invalid device";
106 if (skinDev.size() != 1)
108 std::cerr<<
"skinWrapper: cannot attach more than one device\n";
112 yarp::dev::PolyDriver * subdevice=skinDev[0]->poly;
114 if (subdevice->isValid())
116 subdevice->view(analog);
120 yError() <<
"skinWrapper: subdevice passed to attach method is invalid!!!";
125 yError() <<
"skinWrapper: The analog sensor is not correctly instantiated, cannot attach !!!";
130 driver.view(multipleWrapper);
134 yError()<<
"skinWrapper: cannot open analog server for skin";
137 if(multipleWrapper == YARP_NULLPTR)
139 yError()<<
"skinWrapper: cannot call attach function";
142 multipleWrapper->attachAll(skinDev);
149 multipleWrapper->detachAll();
Interface for a factory device; a device that can create objects.
bool attachAll(const yarp::dev::PolyDriverList &p)
bool open(yarp::os::Searchable ¶ms)