YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
IImpedanceControlTest.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025-2025 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef IIMPEDANCECONTROLTEST_H
7#define IIMPEDANCECONTROLTEST_H
8
10#include <catch2/catch_amalgamated.hpp>
11
12#include <memory>
13#include <numeric>
14#include <vector>
15
16using namespace yarp::dev;
17using namespace yarp::os;
18
19namespace yarp::dev::tests
20{
22 {
23 REQUIRE(iimp != nullptr);
24
25 int axis=0;
26 double val = 0;
27 bool b = true;
28
29 b = iimp->getAxes(&axis);
30 CHECK (b);
31 CHECK (axis>0);
32
33 double vstiff=1;
34 double vdamp=2;
35 double voff=3;
36
37 {
38 double stiff=0;
39 double damp=0;
40 b = iimp->getImpedance(0, &stiff, &damp);
41 CHECK(b);
42 CHECK(stiff==0);
43 CHECK(damp==0);
44
45 double off=0;
46 b = iimp->getImpedanceOffset(0, &off);
47 CHECK(b);
48 CHECK(off==0);
49 }
50
51 {
52 b = iimp->setImpedance(0, vstiff, vdamp);
53 CHECK(b);
54 b = iimp->setImpedanceOffset(0, voff);
55 CHECK(b);
56
57 double stiff=0;
58 double damp=0;
59 b = iimp->getImpedance(0, &stiff, &damp);
60 CHECK(b);
61 CHECK(stiff==1);
62 CHECK(damp==2);
63
64 double off=0;
65 b = iimp->getImpedanceOffset(0, &off);
66 CHECK(b);
67 CHECK(off==3);
68 }
69
70 {
71 double mins=0;
72 double maxs=0;
73 double mind=0;
74 double maxd=0;
75 b = iimp->getCurrentImpedanceLimit(0, &mins,&maxs, &mind, &maxd);
76 CHECK(b);
77 CHECK(mins==1.0);
78 CHECK(maxs==10.0);
79 CHECK(mind==2.0);
80 CHECK(maxd==20.0);
81 }
82
83 }
84}
85
86#endif
Interface for control boards implementing impedance control.
A mini-server for performing network communication in the background.
void exec_iImpedanceControl_test_1(IImpedanceControl *iimp)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.