icub-test
Loading...
Searching...
No Matches
TorqueControlStiffDampCheck.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 _TORQUECONTORLSTIFFDAMPCHECK_H_
22#define _TORQUECONTORLSTIFFDAMPCHECK_H_
23
24#include <string>
25#include <yarp/robottestingframework/TestCase.h>
26#include <yarp/dev/ControlBoardInterfaces.h>
27#include <yarp/dev/PolyDriver.h>
28
29
30using namespace yarp::os;
31
32class TorqueControlStiffDampCheck : public yarp::robottestingframework::TestCase {
33public:
34 TorqueControlStiffDampCheck();
35 virtual ~TorqueControlStiffDampCheck();
36
37 virtual bool setup(yarp::os::Property& property);
38
39 virtual void tearDown();
40
41 virtual void run();
42
43 void goHome();
44 void setMode(int desired_control_mode, yarp::dev::InteractionModeEnum desired_interaction_mode);
45 void verifyMode(int desired_control_mode, yarp::dev::InteractionModeEnum desired_interaction_mode, std::string title);
46 bool setAndCheckImpedance(int joint, double stiffness, double damping);
47 void saveToFile(std::string filename, yarp::os::Bottle &b);
48 std::string getPath(const std::string& str);
49
50private:
51 std::string robotName;
52 std::string partName;
53 int* jointsList;
54 int n_part_joints;
55 int n_cmd_joints;
56 double *stiffness;
57 double *damping;
58 double *home;
59 double *pos_tot;
60 double testLen_sec;
61 Bottle b_pos_trq;
62 Bottle b_vel_trq;
63 bool plot_enabled;
64
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 yarp::dev::IImpedanceControl *iimp;
74
75};
76
77#endif //_TORQUECONTORLSTIFFDAMPCHECK_H