YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
IEncodersTimedTest.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 IENCODERSTIMEDTEST_H
7#define IENCODERSTIMEDTEST_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(ienc !=nullptr);
20
21 bool b;
22
23 size_t ax=0;
24 b = ienc->getAxes(ax);
25 CHECK(b);
26
27 double* test_encs = new double [ax];
28 double* test_times = new double[ax];
29 b = ienc->getEncoders(test_encs);
30 CHECK(b);
31 b = ienc->getEncoderSpeeds(test_encs);
32 CHECK(b);
34 CHECK(b);
36 CHECK(b);
37
38 for (size_t i=0; i< ax; i++)
39 {
40 double val=0;
41 double time=0;
42 b = ienc->getEncoder(i,&val);
43 //CHECK(b); //this is streaming, it will return true if data is arrived in time
44 b = ienc->getEncoderSpeed(i, &val);
45 //CHECK(b); //this is streaming, it will return true if data is arrived in time
46 b = ienc->getEncoderAcceleration(i, &val);
47 //CHECK(b); //this is streaming, it will return true if data is arrived in time
48 b = ienc->getEncoderTimed(i, &val, &time);
49 //CHECK(b); //this is streaming, it will return true if data is arrived in time
50 }
51
52 double val=0;
53 b = ienc->resetEncoder(val);
54 CHECK(b);
55 b = ienc->resetEncoders();
56 CHECK(b);
57 b = ienc->setEncoder(0,val);
58 CHECK(b);
59 b = ienc->setEncoders(test_encs);
60 CHECK(b);
61
62 delete[] test_encs;
63 delete[] test_times;
64 }
65}
66
67#endif
Control board, extend encoder interface with timestamps.
virtual yarp::dev::ReturnValue getEncoderTimed(int j, double *encs, double *time)=0
Read the instantaneous acceleration of all axes.
virtual yarp::dev::ReturnValue getEncodersTimed(double *encs, double *time)=0
Read the instantaneous acceleration of all axes.
virtual yarp::dev::ReturnValue getEncoderAcceleration(int j, double *spds)=0
Read the instantaneous acceleration of an axis.
virtual yarp::dev::ReturnValue getEncoderAccelerations(double *accs)=0
Read the instantaneous acceleration of all axes.
virtual yarp::dev::ReturnValue getEncoderSpeeds(double *spds)=0
Read the instantaneous speed of all axes.
virtual yarp::dev::ReturnValue getEncoders(double *encs)=0
Read the position of all axes.
virtual yarp::dev::ReturnValue setEncoders(const double *vals)=0
Set the value of all encoders.
virtual yarp::dev::ReturnValue getEncoderSpeed(int j, double *sp)=0
Read the istantaneous speed of an axis.
virtual yarp::dev::ReturnValue getEncoder(int j, double *v)=0
Read the value of an encoder.
virtual yarp::dev::ReturnValue resetEncoder(int j)=0
Reset encoder, single joint.
virtual yarp::dev::ReturnValue resetEncoders()=0
Reset encoders.
virtual yarp::dev::ReturnValue setEncoder(int j, double val)=0
Set the value of the encoder for a given joint.
virtual yarp::dev::ReturnValue getAxes(size_t &ax)=0
Get the number of controlled axes.
A mini-server for performing network communication in the background.
void exec_iEncodersTimed_test_1(IEncodersTimed *ienc)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.