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
21 size_t nrOfSensors = 0;
23 CHECK(ret);
24 CHECK(nrOfSensors > 0); // getNrOfOrientationSensors of multipleanalogsensorsclient works correctly
25
27 double timestamp{ 0.0 }, clientTimestamp{ 0.0 };
28
30 CHECK(status == MAS_status::MAS_OK); // multipleanalogsensorsclient getOrientationSensorStatus return value is MAS_OK
31
32 bool result = ios->getOrientationSensorMeasureAsRollPitchYaw(0, sensorMeasure, timestamp);
34
35 CHECK(result == resultClient); // getOrientationSensorMeasureAsRollPitchYaw return value is consistent between sensor and client
36
37 for (int i = 0; i < 3; i++) {
38 CHECK(sensorMeasure[i] == Catch::Approx(clientMeasure[i])); // getOrientationSensorMeasureAsRollPitchYaw measure is consistent between sensor and client
39 }
40
41 CHECK(std::abs(timestamp - clientTimestamp) < 0.2); // getOrientationSensorMeasureAsRollPitchYaw measure is consistent between sensor and client (up to 200 ms)
42
43 std::string name;
44 result = ios->getOrientationSensorName(0, name);
45 CHECK(result);
46 CHECK(!name.empty());
47
48 result = ios->getOrientationSensorFrameName(0, name);
49 CHECK(result);
50 CHECK(!name.empty());
51 }
52}
53
54#endif
Device interface to one or multiple orientation sensors, such as IMUs with on board estimation algori...
virtual yarp::dev::ReturnValue 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.
virtual yarp::dev::MAS_status getOrientationSensorStatus(size_t sens_index) const =0
Get the status of the specified sensor.
virtual yarp::dev::ReturnValue getOrientationSensorFrameName(size_t sens_index, std::string &frameName) const =0
Get the name of the frame of the specified sensor.
virtual yarp::dev::ReturnValue getNrOfOrientationSensors(size_t &num) const =0
Get the number of orientation sensors exposed by this device.
virtual yarp::dev::ReturnValue getOrientationSensorName(size_t sens_index, std::string &name) const =0
Get the name of the specified sensor.
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.
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.