icub-test
motorEncodersSignCheck.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 _MOTORENCODERSSIGNCHECK_H_
22 #define _MOTORENCODERSSIGNCHECK_H_
23 
24 //#include <string>
25 #include <yarp/robottestingframework/TestCase.h>
26 #include <yarp/dev/ControlBoardInterfaces.h>
27 #include <yarp/dev/PolyDriver.h>
28 #include <yarp/sig/Vector.h>
29 //#include <yarp/sig/Matrix.h>
30 #include "yarp/robottestingframework/JointsPosMotion.h"
31 
32 
61 class MotorEncodersSignCheck : public yarp::robottestingframework::TestCase {
62 public:
64  virtual ~MotorEncodersSignCheck();
65 
66  virtual bool setup(yarp::os::Property& property);
67 
68  virtual void tearDown();
69 
70  virtual void run();
71  void setModeSingle(int i, int desired_control_mode, yarp::dev::InteractionModeEnum desired_interaction_mode);
72  void OplExecute(int i);
73 
74 private:
75 
76  yarp::robottestingframework::jointsPosMotion *jPosMotion;
77 
78  std::string robotName;
79  std::string partName;
80  yarp::sig::Vector jointsList;
81  yarp::sig::Vector home;
82  yarp::sig::Vector opl_step;
83  yarp::sig::Vector opl_max;
84  yarp::sig::Vector opl_delay;
85  yarp::sig::Vector max_lims;
86  yarp::sig::Vector min_lims;
87  yarp::sig::Vector pos_threshold;
88  yarp::sig::Vector opl_start;
89 
90  int n_part_joints;
91 
92  yarp::dev::PolyDriver *dd;
93  yarp::dev::IControlMode *icmd;
94  yarp::dev::IInteractionMode *iimd;
95  yarp::dev::IEncoders *ienc;
96  yarp::dev::IPWMControl *ipwm;
97  yarp::dev::IMotorEncoders *imenc;
98  yarp::dev::IPidControl *ipid;
99 };
100 
101 #endif //_opticalEncoders_H
This tests checks if the motor encoder readings increase when positive pwm is applayed to motor.