iCub-main
affinity.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 
29 #ifndef __ICUB_OPT_AFFINITY_H__
30 #define __ICUB_OPT_AFFINITY_H__
31 
32 #include <deque>
33 #include <yarp/os/all.h>
34 #include <yarp/sig/all.h>
36 
37 namespace iCub
38 {
39 
40 namespace optimization
41 {
42 
51 {
52 protected:
53  yarp::sig::Matrix min, max;
54  yarp::sig::Matrix A0;
55 
56  int max_iter;
57  double tol;
58 
59  std::deque<yarp::sig::Vector> p0;
60  std::deque<yarp::sig::Vector> p1;
61 
62  double evalError(const yarp::sig::Matrix &A);
63 
64 public:
69 
78  virtual void setBounds(const yarp::sig::Matrix &min, const yarp::sig::Matrix &max);
79 
88  virtual bool addPoints(const yarp::sig::Vector &p0, const yarp::sig::Vector &p1);
89 
95  virtual size_t getNumPoints() const { return p0.size(); }
96 
104  virtual void getPoints(std::deque<yarp::sig::Vector> &p0, std::deque<yarp::sig::Vector> &p1) const;
105 
109  virtual void clearPoints();
110 
117  virtual bool setInitialGuess(const yarp::sig::Matrix &A);
118 
125  virtual bool setCalibrationOptions(const yarp::os::Property &options);
126 
136  virtual bool calibrate(yarp::sig::Matrix &A, double &error);
137 
142 };
143 
144 }
145 
146 }
147 
148 #endif
149 
150 
A class that deals with the problem of determining the affine transformation matrix A between two set...
Definition: affinity.h:51
virtual size_t getNumPoints() const
Return the number of 3D-points pairs currently contained into the internal database.
Definition: affinity.h:95
std::deque< yarp::sig::Vector > p1
Definition: affinity.h:60
virtual bool setInitialGuess(const yarp::sig::Matrix &A)
Allow specifiying the initial guess for the affine transformation matrix we seek for.
Definition: affinity.cpp:317
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 affine transformatio...
Definition: affinity.cpp:249
virtual bool calibrate(yarp::sig::Matrix &A, double &error)
Perform optimization to determine the affine matrix A.
Definition: affinity.cpp:341
std::deque< yarp::sig::Vector > p0
Definition: affinity.h:59
double evalError(const yarp::sig::Matrix &A)
Definition: affinity.cpp:265
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 A...
Definition: affinity.cpp:281
virtual bool setCalibrationOptions(const yarp::os::Property &options)
Allow setting further options used during calibration.
Definition: affinity.cpp:328
virtual void clearPoints()
Clear the internal database of 3D points.
Definition: affinity.cpp:309
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.
Definition: affinity.cpp:300
virtual ~AffinityWithMatchedPoints()
Destructor.
Definition: affinity.h:141
AffinityWithMatchedPoints()
Default Constructor.
Definition: affinity.cpp:229
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.
A
Definition: sine.m:16