icub-test
PositionDirect.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 _POSITIONDIRECT_H_
22 #define _POSITIONDIRECT_H_
23 
24 #include <string>
25 #include <yarp/robottestingframework/TestCase.h>
26 #include <yarp/dev/ControlBoardInterfaces.h>
27 #include <yarp/dev/PolyDriver.h>
28 
60 class PositionDirect : public yarp::robottestingframework::TestCase {
61 public:
63  virtual ~PositionDirect();
64 
65  virtual bool setup(yarp::os::Property& property);
66 
67  virtual void tearDown();
68 
69  virtual void run();
70 
71  void goHome();
72  void executeCmd();
73  void setMode(int desired_mode);
74 
75 private:
76  std::string robotName;
77  std::string partName;
78  int* jointsList;
79  double frequency;
80  double amplitude;
81  double cycles;
82  double tolerance;
83  double sampleTime;
84  double zero;
85  int n_part_joints;
86  int n_cmd_joints;
87  enum cmd_mode_t
88  {
89  single_joint = 0,
90  all_joints = 1,
91  some_joints =2
92  } cmd_mode;
93 
94  yarp::dev::PolyDriver *dd;
95  yarp::dev::IPositionControl *ipos;
96  yarp::dev::IControlMode *icmd;
97  yarp::dev::IInteractionMode *iimd;
98  yarp::dev::IEncoders *ienc;
99  yarp::dev::IPositionDirect *idir;
100 
101  double cmd_single;
102  double* cmd_tot;
103  double* cmd_some;
104 
105  double* pos_tot;
106 
107  double prev_cmd;
108 };
109 
110 #endif //_PositionDirect_H
This tests checks the positionDirect control, sending a sinusoidal reference signal,...