iCub-main
embObjIMU.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 
9 
10 #ifndef __embObjIMU_h__
11 #define __embObjIMU_h__
12 
13 #include <string>
14 #include <yarp/dev/DeviceDriver.h>
15 
16 #include <yarp/dev/MultipleAnalogSensorsInterfaces.h>
17 
18 #include "IethResource.h"
19 
20 
21 
38 namespace yarp {
39  namespace dev {
40  class embObjIMU;
41  }
42 }
43 
44 class yarp::dev::embObjIMU : public DeviceDriver,
45  public yarp::dev::IThreeAxisGyroscopes,
46  public yarp::dev::IThreeAxisLinearAccelerometers,
47  public yarp::dev::IThreeAxisMagnetometers,
48  public yarp::dev::IOrientationSensors,
49  public eth::IethResource
50 {
51 
52 public:
53  embObjIMU();
54  ~embObjIMU();
55 
56  // Device Driver interface
57  virtual bool open(yarp::os::Searchable &config) override;
58  virtual bool close() override;
59 
60  /* IThreeAxisGyroscopes methods */
61  virtual size_t getNrOfThreeAxisGyroscopes() const override;
62  virtual yarp::dev::MAS_status getThreeAxisGyroscopeStatus(size_t sens_index) const override;
63  virtual bool getThreeAxisGyroscopeName(size_t sens_index, std::string &name) const override;
64  virtual bool getThreeAxisGyroscopeFrameName(size_t sens_index, std::string &frameName) const override;
65  virtual bool getThreeAxisGyroscopeMeasure(size_t sens_index, yarp::sig::Vector& out, double& timestamp) const override;
66 
67  /* IThreeAxisLinearAccelerometers methods */
68  virtual size_t getNrOfThreeAxisLinearAccelerometers() const override;
69  virtual yarp::dev::MAS_status getThreeAxisLinearAccelerometerStatus(size_t sens_index) const override;
70  virtual bool getThreeAxisLinearAccelerometerName(size_t sens_index, std::string &name) const override;
71  virtual bool getThreeAxisLinearAccelerometerFrameName(size_t sens_index, std::string &frameName) const override;
72  virtual bool getThreeAxisLinearAccelerometerMeasure(size_t sens_index, yarp::sig::Vector& out, double& timestamp) const override;
73 
74  /* IThreeAxisMagnetometers methods */
75  virtual size_t getNrOfThreeAxisMagnetometers() const override;
76  virtual yarp::dev::MAS_status getThreeAxisMagnetometerStatus(size_t sens_index) const override;
77  virtual bool getThreeAxisMagnetometerName(size_t sens_index, std::string &name) const override;
78  virtual bool getThreeAxisMagnetometerFrameName(size_t sens_index, std::string &frameName) const override;
79  virtual bool getThreeAxisMagnetometerMeasure(size_t sens_index, yarp::sig::Vector& out, double& timestamp) const override;
80 
81  /* IOrientationSensors methods */
82  virtual size_t getNrOfOrientationSensors() const override;
83  virtual yarp::dev::MAS_status getOrientationSensorStatus(size_t sens_index) const override;
84  virtual bool getOrientationSensorName(size_t sens_index, std::string &name) const override;
85  virtual bool getOrientationSensorFrameName(size_t sens_index, std::string &frameName) const override;
86  virtual bool getOrientationSensorMeasureAsRollPitchYaw(size_t sens_index, yarp::sig::Vector& rpy, double& timestamp) const override;
87 
88 
89  /* Iethresource methods */
90  virtual bool initialised();
91  virtual eth::iethresType_t type();
92  virtual bool update(eOprotID32_t id32, double timestamp, void* rxdata);
93 
94 
95 private:
96 
97  void *mPriv;
98 
99  std::string getBoardInfo(void) const;
100  void cleanup(void);
101 
102  //debug
103  void updateDebugPrints(eOprotID32_t id32, double timestamp, void* rxdata);
104 
105 };
106 
107 #endif //__embObjIMU_h__
108 
virtual yarp::dev::MAS_status getThreeAxisGyroscopeStatus(size_t sens_index) const override
Definition: embObjIMU.cpp:176
virtual bool getOrientationSensorFrameName(size_t sens_index, std::string &frameName) const override
Definition: embObjIMU.cpp:261
virtual size_t getNrOfThreeAxisMagnetometers() const override
Definition: embObjIMU.cpp:221
virtual bool getOrientationSensorName(size_t sens_index, std::string &name) const override
Definition: embObjIMU.cpp:256
virtual bool getThreeAxisLinearAccelerometerName(size_t sens_index, std::string &name) const override
Definition: embObjIMU.cpp:206
embObjIMU()
This device implements the embObjIMU sensor.
Definition: embObjIMU.cpp:45
virtual yarp::dev::MAS_status getThreeAxisLinearAccelerometerStatus(size_t sens_index) const override
Definition: embObjIMU.cpp:201
virtual eth::iethresType_t type()
Definition: embObjIMU.cpp:278
virtual bool getOrientationSensorMeasureAsRollPitchYaw(size_t sens_index, yarp::sig::Vector &rpy, double &timestamp) const override
Definition: embObjIMU.cpp:266
virtual bool close() override
Definition: embObjIMU.cpp:161
virtual bool initialised()
Definition: embObjIMU.cpp:273
virtual bool update(eOprotID32_t id32, double timestamp, void *rxdata)
Definition: embObjIMU.cpp:286
virtual yarp::dev::MAS_status getOrientationSensorStatus(size_t sens_index) const override
Definition: embObjIMU.cpp:251
virtual yarp::dev::MAS_status getThreeAxisMagnetometerStatus(size_t sens_index) const override
Definition: embObjIMU.cpp:226
virtual size_t getNrOfThreeAxisGyroscopes() const override
Definition: embObjIMU.cpp:171
virtual bool getThreeAxisGyroscopeFrameName(size_t sens_index, std::string &frameName) const override
Definition: embObjIMU.cpp:186
virtual size_t getNrOfOrientationSensors() const override
Definition: embObjIMU.cpp:246
virtual bool getThreeAxisGyroscopeMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
Definition: embObjIMU.cpp:191
virtual bool open(yarp::os::Searchable &config) override
Definition: embObjIMU.cpp:69
virtual bool getThreeAxisGyroscopeName(size_t sens_index, std::string &name) const override
Definition: embObjIMU.cpp:181
virtual bool getThreeAxisMagnetometerName(size_t sens_index, std::string &name) const override
Definition: embObjIMU.cpp:231
virtual bool getThreeAxisLinearAccelerometerFrameName(size_t sens_index, std::string &frameName) const override
Definition: embObjIMU.cpp:211
virtual size_t getNrOfThreeAxisLinearAccelerometers() const override
Definition: embObjIMU.cpp:196
virtual bool getThreeAxisMagnetometerFrameName(size_t sens_index, std::string &frameName) const override
Definition: embObjIMU.cpp:236
virtual bool getThreeAxisLinearAccelerometerMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
Definition: embObjIMU.cpp:216
virtual bool getThreeAxisMagnetometerMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
Definition: embObjIMU.cpp:241
iethresType_t
Definition: IethResource.h:61
Copyright (C) 2008 RobotCub Consortium.
out
Definition: sine.m:8