79 #include <yarp/os/Network.h>
80 #include <yarp/os/Value.h>
81 #include <yarp/os/Property.h>
82 #include <yarp/os/RFModule.h>
83 #include <yarp/dev/PolyDriver.h>
84 #include <yarp/dev/ControlBoardInterfaces.h>
90 using namespace yarp::os;
103 IPositionControl *ipos;
116 string name=rf.find(
"name").asString();
117 string robot=rf.find(
"robot").asString();
118 string hand=rf.find(
"hand").asString();
119 string modelType=rf.find(
"modelType").asString();
120 fingerName=rf.find(
"finger").asString();
122 if (fingerName==
"thumb")
124 else if (fingerName==
"index")
126 else if (fingerName==
"middle")
128 else if (fingerName==
"ring")
130 else if (fingerName==
"little")
134 printf(
"unknown finger!\n");
138 Property driverOpt(
"(device remote_controlboard)");
139 driverOpt.put(
"remote",
"/"+robot+
"/"+hand+
"_arm");
140 driverOpt.put(
"local",
"/"+name);
141 if (!driver.open(driverOpt))
147 IControlLimits *ilim;
150 ilim->getLimits(joint,&
min,&
max);
151 double margin=0.1*(
max-
min);
157 genOpt.put(
"name",name+
"/"+modelType);
158 genOpt.put(
"robot",robot);
159 genOpt.put(
"type",hand);
160 genOpt.put(
"verbose",1);
161 string general(genOpt.toString());
162 string thumb(
"(thumb (name thumb))");
163 string index(
"(index (name index))");
164 string middle(
"(middle (name middle))");
165 string ring(
"(ring (name ring))");
166 string little(
"(little (name little))");
168 Property options((general+
" "+thumb+
" "+index+
" "+middle+
" "+ring+
" "+little).c_str());
169 printf(
"configuring options: %s\n",options.toString().c_str());
171 if (modelType==
"springy")
173 else if (modelType==
"tactile")
177 printf(
"unknown model type!\n");
197 printf(
"model options: %s\n",options.toString().c_str());
214 options.put(
"finger",fingerName);
218 ipos->setRefAcceleration(joint,1e9);
219 if ((fingerName==
"ring")||(fingerName==
"little"))
220 ipos->setRefSpeed(joint,60.0);
222 ipos->setRefSpeed(joint,30.0);
224 ipos->positionMove(joint,*val);
230 Value
data; finger->getSensorsData(
data);
231 Value
out; finger->getOutput(
out);
232 printf(
"%s sensors data = %s; output = %s\n",
233 finger->getName().c_str(),
data.toString().c_str(),
out.toString().c_str());
236 double fb; ienc->getEncoder(joint,&fb);
237 if (fabs(*val-fb)<5.0)
240 ipos->positionMove(joint,*val);
253 if (!
yarp.checkNetwork())
255 printf(
"YARP server not available!\n");
260 rf.setDefault(
"name",
"percex");
261 rf.setDefault(
"robot",
"icub");
262 rf.setDefault(
"hand",
"right");
263 rf.setDefault(
"modelType",
"springy");
264 rf.setDefault(
"finger",
"index");
265 rf.configure(
argc,argv);
268 return mod.runModule(rf);
bool configure(ResourceFinder &rf)
An abstract class that provides basic methods for interfacing with the data acquisition.
Node * getNode(const std::string &name) const
Retrieve an attached node by its name.
virtual bool calibrate(const yarp::os::Property &options)=0
Some kinds of models need to be calibrated to properly operate.
virtual bool fromProperty(const yarp::os::Property &options)=0
Configure the model taking its parameters from a Property object.
virtual void toProperty(yarp::os::Property &options) const =0
Return a Property representation of all the model parameters.
An abstract class that exposes the basic methods for the handling of data acquired through the attach...
A class that provides the user with a suitable framework to deal with the elastic approach for the pr...
A class that provides a mesaure of contact detection for each finger relying on tactile sensors.
Copyright (C) 2008 RobotCub Consortium.
int main(int argc, char *argv[])