iCub-main
embObjFTsensor.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2018 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  * Author: Valentina Gaggero
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
23 #ifndef __embObjFTsensor_h__
24 #define __embObjFTsensor_h__
25 
26 #include <yarp/dev/DeviceDriver.h>
27 #include <yarp/dev/IAnalogSensor.h>
28 #include "IethResource.h"
29 
30 #include <yarp/dev/MultipleAnalogSensorsInterfaces.h>
31 
32 
33 namespace yarp {
34  namespace dev {
35  class embObjFTsensor;
36  }
37 }
38 
39 
40 #define EMBOBJSTRAIN_USESERVICEPARSER
41 
42 // -- class embObjFTsensor
43 
44 class yarp::dev::embObjFTsensor: public yarp::dev::DeviceDriver,
45  public eth::IethResource,
46  public yarp::dev::IAnalogSensor,
47  public yarp::dev::ITemperatureSensors,
48  public yarp::dev::ISixAxisForceTorqueSensors
49 {
50 public:
51 
54 
55  // An open function yarp factory compatible
56  bool open(yarp::os::Searchable &config);
57  bool close();
58 
59  // IAnalogSensor interface
60  virtual int read(yarp::sig::Vector &out);
61  virtual int getState(int ch);
62  virtual int getChannels();
63  virtual int calibrateChannel(int ch, double v);
64  virtual int calibrateSensor();
65  virtual int calibrateSensor(const yarp::sig::Vector& value);
66  virtual int calibrateChannel(int ch);
67 
68  // IethResource interface
69  virtual bool initialised();
70  virtual eth::iethresType_t type();
71  virtual bool update(eOprotID32_t id32, double timestamp, void* rxdata);
72 
73  // ITemperatureSensors
74  virtual size_t getNrOfTemperatureSensors() const override;
75  virtual yarp::dev::MAS_status getTemperatureSensorStatus(size_t sens_index) const override;
76  virtual bool getTemperatureSensorName(size_t sens_index, std::string &name) const override;
77  virtual bool getTemperatureSensorFrameName(size_t sens_index, std::string &frameName) const override;
78  virtual bool getTemperatureSensorMeasure(size_t sens_index, double& out, double& timestamp) const override;
79  virtual bool getTemperatureSensorMeasure(size_t sens_index, yarp::sig::Vector& out, double& timestamp) const override;
80 
81  // ISixAxisForceTorqueSensors
82  virtual size_t getNrOfSixAxisForceTorqueSensors() const override;
83  virtual yarp::dev::MAS_status getSixAxisForceTorqueSensorStatus(size_t sens_index) const override;
84  virtual bool getSixAxisForceTorqueSensorName(size_t sens_index, std::string &name) const override;
85  virtual bool getSixAxisForceTorqueSensorFrameName(size_t sens_index, std::string &frameName) const override;
86  virtual bool getSixAxisForceTorqueSensorMeasure(size_t sens_index, yarp::sig::Vector& out, double& timestamp) const override;
87 
88 
89 private:
90  void *mPriv;
91 
92  void cleanup(void);
93  std::string getBoardInfo(void) const;
94  bool updateStrainValues(eOprotID32_t id32, double timestamp, void* rxdata);
95  bool updateTemperatureValues(eOprotID32_t id32, double timestamp, void* rxdata);
96 
97  void resetCounters();
98  void getCounters(unsigned int &saturations, unsigned int &errors, unsigned int &timeouts);
99  bool enableTemperatureTransmission(bool enable);
100 };
101 
102 
103 #endif
104 
virtual bool getTemperatureSensorFrameName(size_t sens_index, std::string &frameName) const override
bool open(yarp::os::Searchable &config)
virtual size_t getNrOfTemperatureSensors() const override
virtual int read(yarp::sig::Vector &out)
Read a vector from the sensor.
virtual size_t getNrOfSixAxisForceTorqueSensors() const override
virtual bool update(eOprotID32_t id32, double timestamp, void *rxdata)
virtual eth::iethresType_t type()
virtual bool getSixAxisForceTorqueSensorFrameName(size_t sens_index, std::string &frameName) const override
virtual bool getTemperatureSensorName(size_t sens_index, std::string &name) const override
virtual yarp::dev::MAS_status getSixAxisForceTorqueSensorStatus(size_t sens_index) const override
virtual bool getTemperatureSensorMeasure(size_t sens_index, double &out, double &timestamp) const override
virtual bool getSixAxisForceTorqueSensorName(size_t sens_index, std::string &name) const override
virtual int calibrateChannel(int ch, double v)
virtual yarp::dev::MAS_status getTemperatureSensorStatus(size_t sens_index) const override
virtual bool getSixAxisForceTorqueSensorMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
virtual int getState(int ch)
static int v
Definition: iCub_Sim.cpp:42
iethresType_t
Definition: IethResource.h:61
Copyright (C) 2008 RobotCub Consortium.
out
Definition: sine.m:8