YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
IOrientationSensorsTest.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 IORIENTATIONSENSOTSTEST_H
7#define IORIENTATIONSENSOTSTEST_H
8
10#include <catch2/catch_amalgamated.hpp>
11
12using namespace yarp::dev;
13using namespace yarp::os;
14
15namespace yarp::dev::tests
16{
18 {
19 REQUIRE(ios != nullptr);
20
22 CHECK(nrOfSensors > 0); // getNrOfOrientationSensors of multipleanalogsensorsclient works correctly
23
25 double timestamp{ 0.0 }, clientTimestamp{ 0.0 };
26
28 CHECK(status == MAS_status::MAS_OK); // multipleanalogsensorsclient getOrientationSensorStatus return value is MAS_OK
29
30 bool result = ios->getOrientationSensorMeasureAsRollPitchYaw(0, sensorMeasure, timestamp);
32
33 CHECK(result == resultClient); // getOrientationSensorMeasureAsRollPitchYaw return value is consistent between sensor and client
34
35 for (int i = 0; i < 3; i++) {
36 CHECK(sensorMeasure[i] == Catch::Approx(clientMeasure[i])); // getOrientationSensorMeasureAsRollPitchYaw measure is consistent between sensor and client
37 }
38
39 CHECK(std::abs(timestamp - clientTimestamp) < 0.2); // getOrientationSensorMeasureAsRollPitchYaw measure is consistent between sensor and client (up to 200 ms)
40
41 std::string name;
42 result = ios->getOrientationSensorName(0, name);
43 CHECK(result);
44 CHECK(!name.empty());
45
46 result = ios->getOrientationSensorFrameName(0, name);
47 CHECK(result);
48 CHECK(!name.empty());
49 }
50}
51
52#endif
Device interface to one or multiple orientation sensors, such as IMUs with on board estimation algori...
virtual bool getOrientationSensorFrameName(size_t sens_index, std::string &frameName) const =0
Get the name of the frame of the specified sensor.
virtual yarp::dev::MAS_status getOrientationSensorStatus(size_t sens_index) const =0
Get the status of the specified sensor.
virtual bool getOrientationSensorName(size_t sens_index, std::string &name) const =0
Get the name of the specified sensor.
virtual size_t getNrOfOrientationSensors() const =0
Get the number of orientation sensors exposed by this device.
virtual bool getOrientationSensorMeasureAsRollPitchYaw(size_t sens_index, yarp::sig::Vector &rpy, double &timestamp) const =0
Get the last reading of the orientation sensor as roll pitch yaw.
A mini-server for performing network communication in the background.
void exec_IOrientationSensors_test_1(IOrientationSensors *ios)
For streams capable of holding different kinds of content, check what they actually have.
Definition jointData.cpp:13
MAS_status
Status of a given analog sensor exposed by a multiple analog sensors interface.
@ MAS_OK
The sensor is working correctly.
An interface to the operating system, including Port based communication.