iCub-main
Loading...
Searching...
No Matches
parametricCalibrator.h
Go to the documentation of this file.
1// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2
3/*
4 *
5 * Copyright (C) 20014 iCub Facility, Istituto Italiano di Tecnologia
6 *
7 * Authors: Alberto Cardellino, Marco Randazzo, Valentina Gaggero
8 *
9 * CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT
10 *
11 */
12
13#ifndef __ICUB_PARAMETRIC_CALIBRATOR__
14#define __ICUB_PARAMETRIC_CALIBRATOR__
15
16#include <mutex>
17#include <string>
18#include <list>
19#include <yarp/dev/DeviceDriver.h>
20#include <yarp/dev/CalibratorInterfaces.h>
21#include <yarp/dev/ControlBoardInterfaces.h>
22
23namespace yarp {
24 namespace dev
25 {
27 }
28}
29
34
41class yarp::dev::parametricCalibrator : public ICalibrator, public DeviceDriver, public IRemoteCalibrator
42{
43public:
48
53
60 ReturnValue calibrate(DeviceDriver *dd) override;
61
68 virtual bool open (yarp::os::Searchable& config) override;
69
74 virtual bool close () override;
75
76 virtual ReturnValue park(DeviceDriver *dd, bool wait=true) override;
77
78 virtual ReturnValue quitPark() override;
79
80 virtual ReturnValue quitCalibrate() override;
81
82 // IRemoteCalibrator
83
84 virtual yarp::dev::IRemoteCalibrator *getCalibratorDevice();
85
86 virtual ReturnValue calibrateSingleJoint(int j) override;
87
88 virtual ReturnValue calibrateWholePart() override;
89
90 virtual ReturnValue homingSingleJoint(int j) override;
91
92 virtual ReturnValue homingWholePart() override;
93
94 virtual ReturnValue parkSingleJoint(int j, bool _wait=true) override;
95
96 virtual ReturnValue parkWholePart() override;
97
98private:
99 std::mutex calibMutex;
100
101 bool calibrate();
102 bool calibrateJoint(int j);
103 bool goToZero(int j);
104 bool checkCalibrateJointEnded(std::list<int> set);
105 bool checkGoneToZeroThreshold(int j);
106 bool checkHwFault(int j);
107
108 yarp::dev::PolyDriver *dev2calibrate;
109 IControlCalibration *iCalibrate;
110 IPidControl *iPids;
111 IEncoders *iEncoders;
112 IPositionControl *iPosition;
113 IControlMode *iControlMode;
114 IAmplifierControl *iAmp;
115
116 std::list<std::list<int> > joints;
117
118 size_t n_joints;
119 unsigned char *type;
120 double *param1;
121 double *param2;
122 double *param3;
123 int *maxPWM;
124 double *currPos;
125 double *currVel;
126 double *original_max_pwm;
127 double *limited_max_pwm;
128 double *zeroVel;
129 double *zeroPos;
130 double *homeVel;
131 double *homePos;
132 double *zeroPosThreshold;
133 bool abortCalib;
134 bool abortParking;
135 bool isCalibrated;
136 bool skipCalibration;
137 bool clearHwFault;
138
139 int totJointsToCalibrate;
140 std::string deviceName;
141 yarp::os::Bottle calibJointsString; // joints handled by this caibrator as a string for error messages
142 std::list<int> calibJoints; // joints handled by this caibrator as a list
143
144};
145#endif
parametricCalibrator: implement calibration routines for the iCub arm(s) (version 1....
virtual ReturnValue parkSingleJoint(int j, bool _wait=true) override
virtual ReturnValue parkWholePart() override
virtual ReturnValue homingSingleJoint(int j) override
virtual ReturnValue quitPark() override
virtual bool close() override
Close the device driver.
virtual ReturnValue calibrateWholePart() override
virtual ReturnValue calibrateSingleJoint(int j) override
virtual ReturnValue park(DeviceDriver *dd, bool wait=true) override
virtual ReturnValue quitCalibrate() override
virtual yarp::dev::IRemoteCalibrator * getCalibratorDevice()
virtual ReturnValue homingWholePart() override
ReturnValue calibrate(DeviceDriver *dd) override
Calibrate method.
virtual bool open(yarp::os::Searchable &config) override
Open the device driver.
Copyright (C) 2008 RobotCub Consortium.