icub-test
TorqueControlAccuracy.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 _TORQUEACCURACY_H_
22 #define _TORQUEACCURACY_H_
23 
24 #include <string>
25 #include <yarp/robottestingframework/TestCase.h>
26 #include <yarp/dev/ControlBoardInterfaces.h>
27 #include <yarp/dev/PolyDriver.h>
28 
52 class TorqueControlAccuracy : public yarp::robottestingframework::TestCase {
53 public:
55  virtual ~TorqueControlAccuracy();
56 
57  virtual bool setup(yarp::os::Property& property);
58 
59  virtual void tearDown();
60 
61  virtual void run();
62 
63  bool goHome();
64  void executeCmd();
65  void setMode(int desired_mode);
66  void saveToFile(std::string filename, yarp::os::Bottle &b);
67 
68 private:
69  std::string m_robotName;
70  std::string m_partName;
71  int* m_jointsList;
72  int m_cycles;
73  double m_sampleTime;
74  double* m_zeros;
75  double m_step;
76  int m_n_part_joints;
77  int m_n_cmd_joints;
78  yarp::os::Bottle m_dataToSave;
79 
80  yarp::dev::PolyDriver *dd;
81  yarp::dev::IPositionControl *ipos;
82  yarp::dev::IControlMode *icmd;
83  yarp::dev::IInteractionMode *iimd;
84  yarp::dev::IEncoders *ienc;
85  yarp::dev::ITorqueControl *itrq;
86 
87  double m_cmd_single;
88  double* m_encoders;
89  double* m_torques;
90 };
91 
92 #endif
This tests checks the a torque PID response, sending a step reference signal with a setRefTorque comm...