iCub-main
calibReference.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 iCub Facility - Istituto Italiano di Tecnologia
3  * Author: Ugo Pattacini
4  * email: ugo.pattacini@iit.it
5  * Permission is granted to copy, distribute, and/or modify this program
6  * under the terms of the GNU General Public License, version 2 or any
7  * later version published by the Free Software Foundation.
8  *
9  * A copy of the license can be found at
10  * http://www.robotcub.org/icub/license/gpl.txt
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15  * Public License for more details
16 */
17 
27 #ifndef __ICUB_OPT_CALIBREFERENCE_H__
28 #define __ICUB_OPT_CALIBREFERENCE_H__
29 
30 #include <deque>
31 #include <yarp/os/all.h>
32 #include <yarp/sig/all.h>
34 
35 namespace iCub
36 {
37 
38 namespace optimization
39 {
40 
55 {
56 protected:
57  yarp::sig::Vector min, min_s;
58  yarp::sig::Vector max, max_s;
59  yarp::sig::Vector x0, s0;
60 
61  int max_iter;
62  double tol;
63  double min_s_scalar;
64  double max_s_scalar;
65  double s0_scalar;
66 
67  std::deque<yarp::sig::Vector> p0;
68  std::deque<yarp::sig::Vector> p1;
69 
70  double evalError(const yarp::sig::Matrix &H);
71 
72 public:
77 
88  virtual void setBounds(const yarp::sig::Matrix &min, const yarp::sig::Matrix &max);
89 
106  virtual void setBounds(const yarp::sig::Vector &min, const yarp::sig::Vector &max);
107 
115  virtual void setScalingBounds(const yarp::sig::Vector &min, const yarp::sig::Vector &max);
116 
125  virtual void setScalingBounds(const double min, const double max);
126 
139  virtual bool addPoints(const yarp::sig::Vector &p0, const yarp::sig::Vector &p1);
140 
146  virtual size_t getNumPoints() const { return p0.size(); }
147 
156  virtual void getPoints(std::deque<yarp::sig::Vector> &p0, std::deque<yarp::sig::Vector> &p1) const;
157 
161  virtual void clearPoints();
162 
169  virtual bool setInitialGuess(const yarp::sig::Matrix &H);
170 
176  virtual bool setScalingInitialGuess(const yarp::sig::Vector &s);
177 
184  virtual bool setScalingInitialGuess(const double s);
185 
192  virtual bool setCalibrationOptions(const yarp::os::Property &options);
193 
203  virtual bool calibrate(yarp::sig::Matrix &H, double &error);
204 
217  virtual bool calibrate(yarp::sig::Matrix &H, yarp::sig::Vector &s, double &error);
218 
230  virtual bool calibrate(yarp::sig::Matrix &H, double &s, double &error);
231 
236 };
237 
238 }
239 
240 }
241 
242 #endif
243 
244 
A class that deals with the problem of determining the roto-translation matrix H and scaling factors ...
virtual void getPoints(std::deque< yarp::sig::Vector > &p0, std::deque< yarp::sig::Vector > &p1) const
Retrieve copies of the database of 3D-points pairs.
virtual bool calibrate(yarp::sig::Matrix &H, double &error)
Perform reference calibration to determine the matrix H.
virtual size_t getNumPoints() const
Return the number of 3D-points pairs currently contained into the internal database.
virtual bool setCalibrationOptions(const yarp::os::Property &options)
Allow setting further options used during calibration.
virtual void clearPoints()
Clear the internal database of 3D points.
virtual bool setInitialGuess(const yarp::sig::Matrix &H)
Allow specifiying the initial guess for the roto-translation matrix we seek for.
virtual void setScalingBounds(const yarp::sig::Vector &min, const yarp::sig::Vector &max)
Allow specifying the bounds for the 3D scaling factors.
virtual bool setScalingInitialGuess(const yarp::sig::Vector &s)
Allow specifiying the initial guess for the scaling factors.
virtual bool calibrate(yarp::sig::Matrix &H, double &s, double &error)
Perform reference calibration to determine the matrix H and the scalar scaling factor s.
virtual void setBounds(const yarp::sig::Matrix &min, const yarp::sig::Matrix &max)
Allow specifying the minimum and maximum bounds of the elements belonging to the transformation.
virtual bool addPoints(const yarp::sig::Vector &p0, const yarp::sig::Vector &p1)
Add to the internal database the 3D-point p0 and the 3D-point p1 which is supposed to correspond to H...
double evalError(const yarp::sig::Matrix &H)
virtual bool calibrate(yarp::sig::Matrix &H, yarp::sig::Vector &s, double &error)
Perform reference calibration to determine the matrix H and the scaling factors S.
virtual void setBounds(const yarp::sig::Vector &min, const yarp::sig::Vector &max)
Allow specifying the bounding box for both the translation part (given in meters) and the rotation pa...
A class interface to deal with the problem of determining the matrix transformation between two sets ...
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.