YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
IPositionSensorsTest.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023-2023 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef IPOSITIONSENSOTSTEST_H
7#define IPOSITIONSENSOTSTEST_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 == 1); // getNrOfPositionSensors of multipleanalogsensorsclient works correctly
23
25 double timestamp{ 0.0 }, clientTimestamp{ 0.0 };
26
27 MAS_status status = ios->getPositionSensorStatus(0);
28 CHECK(status == MAS_status::MAS_OK); // multipleanalogsensorsclient getPositionSensorStatus return value is MAS_OK
29
30 bool result = ios->getPositionSensorMeasure(0, sensorMeasure, timestamp);
32
33 CHECK(result == resultClient); // getPositionSensorMeasure 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])); // getPositionSensorMeasure 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->getPositionSensorName(0,name);
43 CHECK(result);
44 CHECK(!name.empty());
45
46 result = ios->getPositionSensorFrameName(0,name);
47 CHECK(result);
48 CHECK(!name.empty());
49 }
50}
51
52#endif
Device interface to one or multiple position sensors, such as UWB localization sensors.
virtual bool getPositionSensorMeasure(size_t sens_index, yarp::sig::Vector &xyz, double &timestamp) const =0
Get the last reading of the position sensor as x y z.
virtual bool getPositionSensorName(size_t sens_index, std::string &name) const =0
Get the name of the specified sensor.
virtual size_t getNrOfPositionSensors() const =0
Get the number of position sensors exposed by this device.
virtual yarp::dev::MAS_status getPositionSensorStatus(size_t sens_index) const =0
Get the status of the specified sensor.
virtual bool getPositionSensorFrameName(size_t sens_index, std::string &frameName) const =0
Get the name of the frame of the specified sensor.
A mini-server for performing network communication in the background.
void exec_IPositionSensors_test_1(IPositionSensors *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.