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 yarp::dev::ReturnValue getNrOfThreeAxisGyroscopes(size_t& num) const override;
45 yarp::dev::MAS_status getThreeAxisGyroscopeStatus(size_t sens_index) const override;
46 yarp::dev::ReturnValue getThreeAxisGyroscopeName(size_t sens_index, std::string &name) const override;
47 yarp::dev::ReturnValue getThreeAxisGyroscopeFrameName(size_t sens_index, std::string &frameName) const override;
48 yarp::dev::ReturnValue getThreeAxisGyroscopeMeasure(size_t sens_index, yarp::sig::Vector& out, double& timestamp) const override;
49
50 /* IThreeAxisLinearAccelerometers methods */
52 yarp::dev::MAS_status getThreeAxisLinearAccelerometerStatus(size_t sens_index) const override;
53 yarp::dev::ReturnValue getThreeAxisLinearAccelerometerName(size_t sens_index, std::string &name) const override;
54 yarp::dev::ReturnValue getThreeAxisLinearAccelerometerFrameName(size_t sens_index, std::string &frameName) const override;
55 yarp::dev::ReturnValue getThreeAxisLinearAccelerometerMeasure(size_t sens_index, yarp::sig::Vector& out, double& timestamp) const override;
56
57 /* IThreeAxisMagnetometers methods */
58 yarp::dev::ReturnValue getNrOfThreeAxisMagnetometers(size_t& num) const override;
59 yarp::dev::MAS_status getThreeAxisMagnetometerStatus(size_t sens_index) const override;
60 yarp::dev::ReturnValue getThreeAxisMagnetometerName(size_t sens_index, std::string &name) const override;
61 yarp::dev::ReturnValue getThreeAxisMagnetometerFrameName(size_t sens_index, std::string &frameName) const override;
62 yarp::dev::ReturnValue getThreeAxisMagnetometerMeasure(size_t sens_index, yarp::sig::Vector& out, double& timestamp) const override;
63
64 /* IOrientationSensors methods */
65 yarp::dev::ReturnValue getNrOfOrientationSensors(size_t& num) const override;
66 yarp::dev::MAS_status getOrientationSensorStatus(size_t sens_index) const override;
67 yarp::dev::ReturnValue getOrientationSensorName(size_t sens_index, std::string &name) const override;
68 yarp::dev::ReturnValue getOrientationSensorFrameName(size_t sens_index, std::string &frameName) const override;
69 yarp::dev::ReturnValue 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 yarp::dev::ReturnValue genericGetSensorName(size_t sens_index, std::string &name) const;
74 yarp::dev::ReturnValue 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
yarp::dev::MAS_status getThreeAxisGyroscopeStatus(size_t sens_index) const override
Get the status of the specified sensor.
Definition FakeIMU.cpp:133
FakeIMU & operator=(const FakeIMU &)=delete
yarp::dev::ReturnValue getNrOfThreeAxisMagnetometers(size_t &num) const override
Get the number of magnetometers exposed by this device.
Definition FakeIMU.cpp:205
FakeIMU & operator=(FakeIMU &&)=delete
~FakeIMU() override
Definition FakeIMU.cpp:47
yarp::dev::ReturnValue getThreeAxisLinearAccelerometerName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
Definition FakeIMU.cpp:177
yarp::dev::ReturnValue getThreeAxisLinearAccelerometerFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame of the specified sensor.
Definition FakeIMU.cpp:182
FakeIMU()
This device implements a fake analog sensor emulating an IMU.
Definition FakeIMU.cpp:35
yarp::dev::ReturnValue getOrientationSensorFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame of the specified sensor.
Definition FakeIMU.cpp:260
yarp::dev::MAS_status getThreeAxisLinearAccelerometerStatus(size_t sens_index) const override
Get the status of the specified sensor.
Definition FakeIMU.cpp:172
yarp::dev::ReturnValue getNrOfOrientationSensors(size_t &num) const override
Get the number of orientation sensors exposed by this device.
Definition FakeIMU.cpp:244
yarp::dev::ReturnValue getThreeAxisMagnetometerMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
Get the last reading of the specified sensor.
Definition FakeIMU.cpp:226
yarp::dev::ReturnValue getThreeAxisGyroscopeName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
Definition FakeIMU.cpp:138
FakeIMU(FakeIMU &&)=delete
yarp::dev::ReturnValue getNrOfThreeAxisLinearAccelerometers(size_t &num) const override
Get the number of three axis linear accelerometers exposed by this device.
Definition FakeIMU.cpp:166
yarp::dev::ReturnValue getThreeAxisMagnetometerName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
Definition FakeIMU.cpp:216
yarp::dev::ReturnValue getThreeAxisMagnetometerFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame of the specified sensor.
Definition FakeIMU.cpp:221
yarp::dev::ReturnValue getNrOfThreeAxisGyroscopes(size_t &num) const override
Get the number of three axis gyroscopes exposed by this sensor.
Definition FakeIMU.cpp:127
yarp::dev::ReturnValue getThreeAxisGyroscopeFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame of the specified sensor.
Definition FakeIMU.cpp:143
bool close() override
Close the DeviceDriver.
Definition FakeIMU.cpp:63
yarp::dev::ReturnValue getThreeAxisGyroscopeMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
Get the last reading of the gyroscope.
Definition FakeIMU.cpp:148
yarp::dev::ReturnValue getThreeAxisLinearAccelerometerMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
Get the last reading of the specified sensor.
Definition FakeIMU.cpp:187
yarp::dev::ReturnValue 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:265
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
Definition FakeIMU.cpp:52
yarp::dev::ReturnValue getOrientationSensorName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
Definition FakeIMU.cpp:255
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:211
yarp::dev::MAS_status getOrientationSensorStatus(size_t sens_index) const override
Get the status of the specified sensor.
Definition FakeIMU.cpp:250
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:18
A class for a Matrix.
Definition Matrix.h:40
MAS_status
Status of a given analog sensor exposed by a multiple analog sensors interface.