icub-test
Loading...
Searching...
No Matches
jointLimits.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 _JOINTLIMITS_H_
22#define _JOINTLIMITS_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/os/Bottle.h>
30#include <yarp/sig/Matrix.h>
31
74class JointLimits : public yarp::robottestingframework::TestCase {
75public:
77 virtual ~JointLimits();
78
79 virtual bool setup(yarp::os::Property& property);
80
81 virtual void tearDown();
82
83 virtual void run();
84
85 void goTo(yarp::sig::Vector position);
86 bool goToSingle(int i, double pos, double *reached_pos);
87 bool goToSingleExceed(int i, double position_to_reach, double limit, double reachedLimit, double *reached_pos);
88
89 void setMode(int desired_mode);
90 void saveToFile(std::string filename, yarp::os::Bottle &b);
91
92private:
93 std::string robotName;
94 std::string partName;
95 yarp::sig::Vector jointsList;
96
97 double tolerance;
98
99 int n_part_joints;
100
101 yarp::dev::PolyDriver *dd;
102 yarp::dev::IPositionControl *ipos;
103 yarp::dev::IControlMode *icmd;
104 yarp::dev::IInteractionMode *iimd;
105 yarp::dev::IEncoders *ienc;
106 yarp::dev::IControlLimits *ilim;
107 yarp::dev::IPidControl *ipid;
108
109 yarp::sig::Vector enc_jnt;
110 yarp::sig::Vector max_lims;
111 yarp::sig::Vector min_lims;
112 yarp::sig::Vector outputLimit;
113 yarp::sig::Vector outOfBoundPos;
114 yarp::sig::Vector toleranceList;
115 yarp::sig::Vector home;
116 yarp::sig::Vector speed;
117
118 bool pids_saved;
119 yarp::dev::Pid* original_pids;
120};
121
122#endif //_JOINTLIMITS_H
Check if the software joint limits are properly set.
Definition jointLimits.h:74