iCub-main
skinWrapper.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 iCub Facility, Istituto Italiano di Tecnologia
3  * Authors: Alberto Cardellino
4  * CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT
5  *
6  */
7 
8 #ifndef SKINWRAPPER_H_
9 #define SKINWRAPPER_H_
10 
11 
12 //#include "RobotInterfaceRemap.h"
13 //#include "extractPath.h"
14 
15 #include <string>
16 #include <sstream>
17 
18 #include <yarp/os/Network.h>
19 #include <yarp/os/Port.h>
20 #include <yarp/os/Bottle.h>
21 #include <yarp/os/Time.h>
22 #include <yarp/os/Property.h>
23 
24 #include <yarp/dev/IGenericSensor.h>
25 #include <yarp/dev/IAnalogSensor.h>
26 #include <yarp/dev/PolyDriver.h>
27 #include <yarp/dev/PolyDriverList.h>
28 #include <yarp/dev/IMultipleWrapper.h>
29 
30 //#include <list>
31 #include <vector>
32 #include <iostream>
33 #include <string>
34 #include <sstream>
35 #include <yarp/sig/Vector.h>
36 
37 #include <yarp/os/PeriodicThread.h>
38 #include <yarp/os/BufferedPort.h>
39 #include <yarp/os/Stamp.h>
40 
41 #include <yarp/os/LogStream.h>
42 
43 class skinWrapper : public yarp::dev::DeviceDriver,
44  public yarp::dev::IMultipleWrapper
45 {
46 private:
47  // Up to day the skinwrapper is able to handle (attach to) just one analog sensor device
48  int period;
49  yarp::dev::IAnalogSensor *analog;
50  int numPorts;
51  yarp::dev::IMultipleWrapper *multipleWrapper;
52 
53 // yarp::sig::Vector wholeData; // may be useful if one the skin wrapper has to get data from more than one device...
54 
55 public:
56  std::string id;
57  yarp::dev::PolyDriver driver;
58 
59  skinWrapper();
60  ~skinWrapper();
61 
62 // bool open(yarp::os::Property &params, yarp::os::Property &params);
63  bool open(yarp::os::Searchable &params);
64  bool close();
65  void calibrate();
66  yarp::sig::Vector * getData();
67 
68  void setId(const std::string &i)
69  {
70  id=i;
71  }
72 
73  bool attachAll(const yarp::dev::PolyDriverList &p);
74  bool detachAll();
75 };
76 
77 #endif /* SKINWRAPPER_H_ */
std::string id
Definition: skinWrapper.h:56
bool detachAll()
yarp::dev::PolyDriver driver
Definition: skinWrapper.h:57
bool attachAll(const yarp::dev::PolyDriverList &p)
bool open(yarp::os::Searchable &params)
Definition: skinWrapper.cpp:36
void calibrate()
Definition: skinWrapper.cpp:28
bool close()
Definition: skinWrapper.cpp:92
void setId(const std::string &i)
Definition: skinWrapper.h:68
yarp::sig::Vector * getData()