YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
FakePositionSensor.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#ifndef YARP_DEVICE_FAKE_POSITIONSENSOR
7#define YARP_DEVICE_FAKE_POSITIONSENSOR
8
10
11#include <yarp/dev/all.h>
13
14#include <mutex>
15
17
33{
34private:
35
36 mutable std::mutex m_mutex;
37 unsigned int m_channelsNum;
38
39 struct myfakesensor
40 {
41 std::string m_name = "mySensor";
42 std::string m_framename = "myFrame";
44 double m_timestamp = 0.0;
45 yarp::sig::Vector m_data;
46
47 myfakesensor()
48 {
49 m_data.resize(3);
50 m_data[0] = 1.0;
51 m_data[1] = 2.0;
52 m_data[2] = 3.0;
53 }
54 };
55
56 std::vector<myfakesensor> m_position_sensors;
57 std::vector<myfakesensor> m_orientation_sensors;
58
59public:
60 FakePositionSensor(double period = 0.05);
61
63
64 bool open(yarp::os::Searchable& config) override;
65 bool close() override;
66
67 //Interfaces
68 size_t getNrOfPositionSensors() const override;
69 yarp::dev::MAS_status getPositionSensorStatus(size_t sens_index) const override;
70 bool getPositionSensorName(size_t sens_index, std::string& name) const override;
71 bool getPositionSensorFrameName(size_t sens_index, std::string& frameName) const override;
72 bool getPositionSensorMeasure(size_t sens_index, yarp::sig::Vector& xyz, double& timestamp) const override;
73
74 size_t getNrOfOrientationSensors() const override;
75 yarp::dev::MAS_status getOrientationSensorStatus(size_t sens_index) const override;
76 bool getOrientationSensorName(size_t sens_index, std::string& name) const override;
77 bool getOrientationSensorFrameName(size_t sens_index, std::string& frameName) const override;
78 bool getOrientationSensorMeasureAsRollPitchYaw(size_t sens_index, yarp::sig::Vector& xyz, double& timestamp) const override;
79
80 // RateThread interface
81 void run() override;
82 bool threadInit() override;
83 void threadRelease() override;
84};
85
86
87#endif // YARP_DEVICE_FAKE_POSITIONSENSOR
This class is the parameters parser for class FakePositionSensor.
fakePositionSensor: Fake position sensor device for testing purpose and reference for new similar dev...
bool getOrientationSensorFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame of the specified sensor.
bool close() override
Close the DeviceDriver.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
yarp::dev::MAS_status getPositionSensorStatus(size_t sens_index) const override
Get the status of the specified sensor.
bool getOrientationSensorMeasureAsRollPitchYaw(size_t sens_index, yarp::sig::Vector &xyz, double &timestamp) const override
Get the last reading of the orientation sensor as roll pitch yaw.
bool getPositionSensorMeasure(size_t sens_index, yarp::sig::Vector &xyz, double &timestamp) const override
Get the last reading of the position sensor as x y z.
yarp::dev::MAS_status getOrientationSensorStatus(size_t sens_index) const override
Get the status of the specified sensor.
void run() override
Loop function.
bool getPositionSensorFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame of the specified sensor.
bool threadInit() override
Initialization method.
size_t getNrOfOrientationSensors() const override
Get the number of orientation sensors exposed by this device.
void threadRelease() override
Release method.
bool getPositionSensorName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
size_t getNrOfPositionSensors() const override
Get the number of position sensors exposed by this device.
bool getOrientationSensorName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
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 position sensors, such as UWB localization sensors.
An abstraction for a periodic thread.
A base class for nested structures that can be searched.
Definition Searchable.h:31
void resize(size_t size) override
Resize the vector.
Definition Vector.h:221
MAS_status
Status of a given analog sensor exposed by a multiple analog sensors interface.
@ MAS_OK
The sensor is working correctly.