iCub-main
tactileFingers.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2011 Department of Robotics Brain and Cognitive Sciences - Istituto Italiano di Tecnologia
3  * Author: Ugo Pattacini
4  * email: ugo.pattacini@iit.it
5  * Permission is granted to copy, distribute, and/or modify this program
6  * under the terms of the GNU General Public License, version 2 or any
7  * later version published by the Free Software Foundation.
8  *
9  * A copy of the license can be found at
10  * http://www.robotcub.org/icub/license/gpl.txt
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15  * Public License for more details
16 */
17 
37 #ifndef __PERCEPTIVEMODELS_TACTILEFINGERS_H__
38 #define __PERCEPTIVEMODELS_TACTILEFINGERS_H__
39 
40 #include <yarp/os/all.h>
41 #include <yarp/sig/all.h>
42 
44 #include <iCub/perception/nodes.h>
45 #include <iCub/perception/models.h>
46 
47 
48 namespace iCub
49 {
50 
51 namespace perception
52 {
53 
60 class TactileFinger : public Node
61 {
62 protected:
64  double outputGain;
65 
66  bool extractSensorsData(yarp::sig::Vector &in) const;
67 
68 public:
84  bool fromProperty(const yarp::os::Property &options);
85 
91  void toProperty(yarp::os::Property &options) const;
92 
101  bool toStream(std::ostream &str) const;
102 
107  bool calibrate(const yarp::os::Property &options);
108 
115  bool getSensorsData(yarp::os::Value &data) const;
116 
126  bool getOutput(yarp::os::Value &out) const;
127 
132  bool isCalibrated() const;
133 
138  bool isDirectLogic() const
139  {
140  return directLogic;
141  }
142 };
143 
144 
151 class TactileFingersModel : public virtual Model
152 {
153 private:
154  std::string type;
155  std::string robot;
156  std::string carrier;
157 
158  SensorPort sensPort[60];
159  TactileFinger fingers[5];
160  bool configured;
161  bool compensation;
162 
163  yarp::os::BufferedPort<yarp::os::Bottle> *port;
164 
165  void close();
166 
167 public:
172 
193  bool fromProperty(const yarp::os::Property &options);
194 
200  void toProperty(yarp::os::Property &options) const;
201 
210  bool toStream(std::ostream &str) const;
211 
216  bool calibrate(const yarp::os::Property &options);
217 
222  bool isCalibrated() const;
223 
232  bool getOutput(yarp::os::Value &out) const;
233 
237  virtual ~TactileFingersModel();
238 };
239 
240 
241 }
242 
243 }
244 
245 #endif
246 
247 
@ data
An abstract class that provides basic methods for interfacing with the data acquisition.
Definition: models.h:62
An abstract class that exposes the basic methods for the handling of data acquired through the attach...
Definition: nodes.h:94
This class implements the reading of a value from a port.
Definition: sensors.h:239
An implementation of the Node class that represents the tactile finger.
bool isDirectLogic() const
Retrieve the status of internal logic.
bool extractSensorsData(yarp::sig::Vector &in) const
void toProperty(yarp::os::Property &options) const
Return a Property representation of all the node parameters.
bool isCalibrated() const
Not available.
bool toStream(std::ostream &str) const
Similar to the toProperty() method but it operates on output streams (e.g.
bool fromProperty(const yarp::os::Property &options)
Configure the finger taking its parameters from a Property object.
bool getOutput(yarp::os::Value &out) const
Retrieve the finger output.
bool getSensorsData(yarp::os::Value &data) const
Retrieve tactile data from the ports.
bool calibrate(const yarp::os::Property &options)
Not available.
A class that provides a mesaure of contact detection for each finger relying on tactile sensors.
bool fromProperty(const yarp::os::Property &options)
Configure the model taking its parameters from a Property object.
void toProperty(yarp::os::Property &options) const
Return a Property representation of all the model parameters.
bool calibrate(const yarp::os::Property &options)
Not available.
bool isCalibrated() const
Not available.
bool toStream(std::ostream &str) const
Similar to the toProperty() method but it operates on output streams (e.g.
bool getOutput(yarp::os::Value &out) const
Retrieve the complete output of the model.
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.
out
Definition: sine.m:8