YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
FakeIMU.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#include <string>
10#include <yarp/os/Stamp.h>
11#include <yarp/math/Math.h>
13
21class FakeIMU :
29{
30public:
31 FakeIMU();
32 FakeIMU(const FakeIMU&) = delete;
33 FakeIMU(FakeIMU&&) = delete;
34 FakeIMU& operator=(const FakeIMU&) = delete;
36
37 ~FakeIMU() override;
38
39 // Device Driver interface
40 bool open(yarp::os::Searchable &config) override;
41 bool close() override;
42
43 /* IThreeAxisGyroscopes methods */
44 size_t getNrOfThreeAxisGyroscopes() const override;
45 yarp::dev::MAS_status getThreeAxisGyroscopeStatus(size_t sens_index) const override;
46 bool getThreeAxisGyroscopeName(size_t sens_index, std::string &name) const override;
47 bool getThreeAxisGyroscopeFrameName(size_t sens_index, std::string &frameName) const override;
48 bool getThreeAxisGyroscopeMeasure(size_t sens_index, yarp::sig::Vector& out, double& timestamp) const override;
49
50 /* IThreeAxisLinearAccelerometers methods */
51 size_t getNrOfThreeAxisLinearAccelerometers() const override;
52 yarp::dev::MAS_status getThreeAxisLinearAccelerometerStatus(size_t sens_index) const override;
53 bool getThreeAxisLinearAccelerometerName(size_t sens_index, std::string &name) const override;
54 bool getThreeAxisLinearAccelerometerFrameName(size_t sens_index, std::string &frameName) const override;
55 bool getThreeAxisLinearAccelerometerMeasure(size_t sens_index, yarp::sig::Vector& out, double& timestamp) const override;
56
57 /* IThreeAxisMagnetometers methods */
58 size_t getNrOfThreeAxisMagnetometers() const override;
59 yarp::dev::MAS_status getThreeAxisMagnetometerStatus(size_t sens_index) const override;
60 bool getThreeAxisMagnetometerName(size_t sens_index, std::string &name) const override;
61 bool getThreeAxisMagnetometerFrameName(size_t sens_index, std::string &frameName) const override;
62 bool getThreeAxisMagnetometerMeasure(size_t sens_index, yarp::sig::Vector& out, double& timestamp) const override;
63
64 /* IOrientationSensors methods */
65 size_t getNrOfOrientationSensors() const override;
66 yarp::dev::MAS_status getOrientationSensorStatus(size_t sens_index) const override;
67 bool getOrientationSensorName(size_t sens_index, std::string &name) const override;
68 bool getOrientationSensorFrameName(size_t sens_index, std::string &frameName) const override;
69 bool getOrientationSensorMeasureAsRollPitchYaw(size_t sens_index, yarp::sig::Vector& rpy, double& timestamp) const override;
70
71private:
72 yarp::dev::MAS_status genericGetStatus(size_t sens_index) const;
73 bool genericGetSensorName(size_t sens_index, std::string &name) const;
74 bool genericGetFrameName(size_t sens_index, std::string &frameName) const;
75
76 bool threadInit() override;
77 void run() override;
78
80 yarp::sig::Vector gravity;
82 yarp::sig::Vector accels;
83
84 unsigned int nchannels;
85 double dummy_value;
86 yarp::os::Stamp lastStamp;
87};
This class is the parameters parser for class FakeIMU.
fakeIMU : fake device implementing the device interface typically implemented by an Inertial Measurem...
Definition FakeIMU.h:29
bool getThreeAxisMagnetometerFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame of the specified sensor.
Definition FakeIMU.cpp:218
yarp::dev::MAS_status getThreeAxisGyroscopeStatus(size_t sens_index) const override
Get the status of the specified sensor.
Definition FakeIMU.cpp:132
FakeIMU & operator=(const FakeIMU &)=delete
FakeIMU & operator=(FakeIMU &&)=delete
~FakeIMU() override
Definition FakeIMU.cpp:47
bool getThreeAxisLinearAccelerometerMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
Get the last reading of the specified sensor.
Definition FakeIMU.cpp:185
bool getOrientationSensorFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame of the specified sensor.
Definition FakeIMU.cpp:256
size_t getNrOfOrientationSensors() const override
Get the number of orientation sensors exposed by this device.
Definition FakeIMU.cpp:241
FakeIMU()
This device implements a fake analog sensor emulating an IMU.
Definition FakeIMU.cpp:35
yarp::dev::MAS_status getThreeAxisLinearAccelerometerStatus(size_t sens_index) const override
Get the status of the specified sensor.
Definition FakeIMU.cpp:170
bool getThreeAxisLinearAccelerometerName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
Definition FakeIMU.cpp:175
bool getThreeAxisGyroscopeName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
Definition FakeIMU.cpp:137
FakeIMU(FakeIMU &&)=delete
bool getThreeAxisGyroscopeMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
Get the last reading of the gyroscope.
Definition FakeIMU.cpp:147
bool close() override
Close the DeviceDriver.
Definition FakeIMU.cpp:63
bool getThreeAxisMagnetometerMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
Get the last reading of the specified sensor.
Definition FakeIMU.cpp:223
bool getThreeAxisMagnetometerName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
Definition FakeIMU.cpp:213
size_t getNrOfThreeAxisLinearAccelerometers() const override
Get the number of three axis linear accelerometers exposed by this device.
Definition FakeIMU.cpp:165
bool getThreeAxisGyroscopeFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame of the specified sensor.
Definition FakeIMU.cpp:142
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
Definition FakeIMU.cpp:52
size_t getNrOfThreeAxisMagnetometers() const override
Get the number of magnetometers exposed by this device.
Definition FakeIMU.cpp:203
bool getOrientationSensorName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
Definition FakeIMU.cpp:251
bool getOrientationSensorMeasureAsRollPitchYaw(size_t sens_index, yarp::sig::Vector &rpy, double &timestamp) const override
Get the last reading of the orientation sensor as roll pitch yaw.
Definition FakeIMU.cpp:261
size_t getNrOfThreeAxisGyroscopes() const override
Get the number of three axis gyroscopes exposed by this sensor.
Definition FakeIMU.cpp:127
bool getThreeAxisLinearAccelerometerFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame of the specified sensor.
Definition FakeIMU.cpp:180
FakeIMU(const FakeIMU &)=delete
yarp::dev::MAS_status getThreeAxisMagnetometerStatus(size_t sens_index) const override
Get the status of the specified sensor.
Definition FakeIMU.cpp:208
yarp::dev::MAS_status getOrientationSensorStatus(size_t sens_index) const override
Get the status of the specified sensor.
Definition FakeIMU.cpp:246
Interface implemented by all device drivers.
Device interface to one or multiple orientation sensors, such as IMUs with on board estimation algori...
Device interface to one or multiple three axis gyroscopes.
Device interface to one or multiple three axis linear accelerometers.
Device interface to one or multiple three axis magnetometers.
An abstraction for a periodic thread.
A base class for nested structures that can be searched.
Definition Searchable.h:31
An abstraction for a time stamp and/or sequence number.
Definition Stamp.h:21
A class for a Matrix.
Definition Matrix.h:39
MAS_status
Status of a given analog sensor exposed by a multiple analog sensors interface.