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 
sensors.h
iCub
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.
Definition: emotionInterface.h:17
iCub::perception::TactileFinger::toStream
bool toStream(std::ostream &str) const
Similar to the toProperty() method but it operates on output streams (e.g.
Definition: tactileFingers.cpp:66
iCub::perception::TactileFinger
Definition: tactileFingers.h:60
iCub::perception::TactileFinger::fromProperty
bool fromProperty(const yarp::os::Property &options)
Configure the finger taking its parameters from a Property object.
Definition: tactileFingers.cpp:34
out
out
Definition: sine.m:8
iCub::perception::TactileFinger::getSensorsData
bool getSensorsData(yarp::os::Value &data) const
Retrieve tactile data from the ports.
Definition: tactileFingers.cpp:96
data
@ data
Definition: ST_M1_dataType.h:64
iCub::perception::SensorPort
Definition: sensors.h:200
iCub::perception::Node
Definition: nodes.h:93
iCub::perception::TactileFingersModel::~TactileFingersModel
virtual ~TactileFingersModel()
Destructor.
Definition: tactileFingers.cpp:407
iCub::perception::TactileFingersModel
Definition: tactileFingers.h:151
string
string(REPLACE "-rdynamic" "" CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS}") include_directories($
Definition: CMakeLists.txt:9
models.h
iCub::perception::TactileFinger::toProperty
void toProperty(yarp::os::Property &options) const
Return a Property representation of all the node parameters.
Definition: tactileFingers.cpp:56
nodes.h
iCub::perception::TactileFingersModel::isCalibrated
bool isCalibrated() const
Not available.
Definition: tactileFingers.cpp:358
iCub::perception::TactileFingersModel::toProperty
void toProperty(yarp::os::Property &options) const
Return a Property representation of all the model parameters.
Definition: tactileFingers.cpp:268
iCub::perception::TactileFingersModel::getOutput
bool getOutput(yarp::os::Value &out) const
Retrieve the complete output of the model.
Definition: tactileFingers.cpp:366
iCub::perception::Model
Definition: models.h:61
iCub::perception::TactileFingersModel::fromProperty
bool fromProperty(const yarp::os::Property &options)
Configure the model taking its parameters from a Property object.
Definition: tactileFingers.cpp:176
iCub::perception::TactileFingersModel::TactileFingersModel
TactileFingersModel()
Constructor.
Definition: tactileFingers.cpp:168
iCub::perception::TactileFinger::isDirectLogic
bool isDirectLogic() const
Retrieve the status of internal logic.
Definition: tactileFingers.h:138
iCub::perception::TactileFinger::outputGain
double outputGain
Definition: tactileFingers.h:64
iCub::perception::TactileFingersModel::toStream
bool toStream(std::ostream &str) const
Similar to the toProperty() method but it operates on output streams (e.g.
Definition: tactileFingers.cpp:312
iCub::perception::TactileFinger::extractSensorsData
bool extractSensorsData(yarp::sig::Vector &in) const
Definition: tactileFingers.cpp:126
iCub::perception::TactileFinger::calibrate
bool calibrate(const yarp::os::Property &options)
Not available.
Definition: tactileFingers.cpp:80
iCub::perception::TactileFinger::directLogic
bool directLogic
Definition: tactileFingers.h:63
iCub::perception::TactileFingersModel::calibrate
bool calibrate(const yarp::os::Property &options)
Not available.
Definition: tactileFingers.cpp:350
iCub::perception::TactileFinger::getOutput
bool getOutput(yarp::os::Value &out) const
Retrieve the finger output.
Definition: tactileFingers.cpp:151
iCub::perception::TactileFinger::isCalibrated
bool isCalibrated() const
Not available.
Definition: tactileFingers.cpp:88