icub-test
Loading...
Searching...
No Matches
TorqueControlConsistency.h
1/*
2 * iCub Robot Unit Tests (Robot Testing Framework)
3 *
4 * Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT)
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#ifndef _TORQUECONTORLCONSISTENCY_H_
22#define _TORQUECONTORLCONSISTENCY_H_
23
24#include <string>
25#include <yarp/robottestingframework/TestCase.h>
26#include <yarp/dev/ControlBoardInterfaces.h>
27#include <yarp/dev/PolyDriver.h>
28
29class TorqueControlConsistency : public yarp::robottestingframework::TestCase {
30public:
31 TorqueControlConsistency();
32 virtual ~TorqueControlConsistency();
33
34 virtual bool setup(yarp::os::Property& property);
35
36 virtual void tearDown();
37
38 virtual void run();
39
40 void goHome();
41 void executeCmd();
42 void setMode(int desired_control_mode, yarp::dev::InteractionModeEnum desired_interaction_mode);
43 void verifyMode(int desired_control_mode, yarp::dev::InteractionModeEnum desired_interaction_mode, std::string title);
44 void setRefTorque(double value);
45 void verifyRefTorque(double value, std::string title);
46
47 void zeroCurrentLimits();
48 void getOriginalCurrentLimits();
49 void resetOriginalCurrentLimits();
50
51private:
52 std::string robotName;
53 std::string partName;
54 int* jointsList;
55
56 double zero;
57 int n_part_joints;
58 int n_cmd_joints;
59 enum cmd_mode_t
60 {
61 single_joint = 0,
62 all_joints = 1,
63 some_joints =2
64 } cmd_mode;
65
66 yarp::dev::PolyDriver *dd;
67 yarp::dev::IPositionControl *ipos;
68 yarp::dev::IAmplifierControl *iamp;
69 yarp::dev::IControlMode *icmd;
70 yarp::dev::IInteractionMode *iimd;
71 yarp::dev::IEncoders *ienc;
72 yarp::dev::ITorqueControl *itrq;
73
74 double cmd_single;
75 double* cmd_tot;
76 double* cmd_some;
77
78 double prevcurr_single;
79 double* prevcurr_tot;
80 double* prevcurr_some;
81
82 double* pos_tot;
83};
84
85#endif //_TORQUECONTORLCONSISTENCY_H