iCub-main
embObjPOS.h
Go to the documentation of this file.
1 
2 /*
3  * Copyright (C) 2020 iCub Tech - Istituto Italiano di Tecnologia
4  * Author: Marco Accame
5  * email: marco.accame@iit.it
6 */
7 
8 
9 #ifndef __embObjPOS_h__
10 #define __embObjPOS_h__
11 
12 #include <string>
13 #include <mutex>
14 #include <yarp/dev/DeviceDriver.h>
15 #include <yarp/dev/IAnalogSensor.h>
16 #include <yarp/sig/Vector.h>
17 
18 
19 
21 
22 #include "serviceParser.h"
23 
24 
25 namespace yarp {
26  namespace dev {
27  class embObjPOS;
28  }
29 }
30 
31 
32 
33 class yarp::dev::embObjPOS: public yarp::dev::DeviceDriver,
34  public yarp::dev::IAnalogSensor,
35  public eth::IethResource
36 {
37 
38 public:
39 
40  embObjPOS();
41  ~embObjPOS();
42 
43  bool open(yarp::os::Searchable &config);
44  bool close();
45 
46  // IAnalogSensor interface
47  virtual int read(yarp::sig::Vector &out);
48  virtual int getState(int ch);
49  virtual int getChannels();
50  virtual int calibrateChannel(int ch, double v);
51  virtual int calibrateSensor();
52  virtual int calibrateSensor(const yarp::sig::Vector& value);
53  virtual int calibrateChannel(int ch);
54 
55  // IethResource interface
56  virtual bool initialised();
57  virtual eth::iethresType_t type();
58  virtual bool update(eOprotID32_t id32, double timestamp, void* rxdata);
59 
60 private:
61 
63  std::mutex m_mutex;
64  yarp::sig::Vector m_data;
65 
66 
67 private:
68 
69  bool fromConfig(yarp::os::Searchable &config, servConfigPOS_t &serviceConfig);
70  bool sendConfig2boards(servConfigPOS_t &serviceConfig);
71  bool sendStart2boards(void);
72  bool initRegulars(void);
73  void cleanup(void);
74 // void printServiceConfig(void);
75 
76 
77 };
78 
79 
80 #endif
81 
virtual int calibrateSensor()
Definition: embObjPOS.cpp:296
virtual int getChannels()
Definition: embObjPOS.cpp:290
virtual bool update(eOprotID32_t id32, double timestamp, void *rxdata)
Definition: embObjPOS.cpp:326
virtual int read(yarp::sig::Vector &out)
Read a vector from the sensor.
Definition: embObjPOS.cpp:266
virtual eth::iethresType_t type()
Definition: embObjPOS.cpp:320
virtual bool initialised()
Definition: embObjPOS.cpp:74
virtual int getState(int ch)
Definition: embObjPOS.cpp:283
bool open(yarp::os::Searchable &config)
Definition: embObjPOS.cpp:80
virtual int calibrateChannel(int ch, double v)
Definition: embObjPOS.cpp:314
static int v
Definition: iCub_Sim.cpp:42
iethresType_t
Definition: IethResource.h:61
Copyright (C) 2008 RobotCub Consortium.
out
Definition: sine.m:8