iCub-main
nlp.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 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 
18 #ifndef __DEPTH2KIN_NLP_H__
19 #define __DEPTH2KIN_NLP_H__
20 
21 #include <string>
22 #include <deque>
23 
24 #include <yarp/sig/all.h>
25 
26 #include <IpIpoptApplication.hpp>
27 
28 #define ALIGN_IPOPT_MAX_ITER 300
29 
30 
31 /****************************************************************/
32 yarp::sig::Matrix computeH(const yarp::sig::Vector &x);
33 
34 
35 /****************************************************************/
37 {
38 protected:
39  yarp::sig::Vector min;
40  yarp::sig::Vector max;
41  yarp::sig::Vector x0;
42  yarp::sig::Matrix Prj;
43 
44  std::deque<yarp::sig::Vector> p2d;
45  std::deque<yarp::sig::Vector> p3d;
46 
47  double evalError(const yarp::sig::Matrix &H);
48 
49 public:
50  EyeAligner();
51  bool setProjection(const yarp::sig::Matrix &Prj);
52  yarp::sig::Matrix getProjection() const;
53  void setBounds(const yarp::sig::Vector &min, const yarp::sig::Vector &max);
54  bool addPoints(const yarp::sig::Vector &p2di, const yarp::sig::Vector &p3di);
55  void clearPoints();
56  size_t getNumPoints() const;
57  bool setInitialGuess(const yarp::sig::Matrix &H);
58  bool calibrate(yarp::sig::Matrix &H, double &error, const int max_iter=ALIGN_IPOPT_MAX_ITER,
59  const int print_level=0, const std::string &derivative_test="none");
60 };
61 
62 
63 #endif
64 
Definition: nlp.h:37
bool setInitialGuess(const yarp::sig::Matrix &H)
Definition: nlp.cpp:415
yarp::sig::Matrix Prj
Definition: nlp.h:42
yarp::sig::Vector max
Definition: nlp.h:40
std::deque< yarp::sig::Vector > p3d
Definition: nlp.h:45
size_t getNumPoints() const
Definition: nlp.cpp:408
yarp::sig::Vector x0
Definition: nlp.h:41
void setBounds(const yarp::sig::Vector &min, const yarp::sig::Vector &max)
Definition: nlp.cpp:371
double evalError(const yarp::sig::Matrix &H)
Definition: nlp.cpp:327
bool calibrate(yarp::sig::Matrix &H, double &error, const int max_iter=ALIGN_IPOPT_MAX_ITER, const int print_level=0, const std::string &derivative_test="none")
Definition: nlp.cpp:434
EyeAligner()
Definition: nlp.cpp:311
bool addPoints(const yarp::sig::Vector &p2di, const yarp::sig::Vector &p3di)
Definition: nlp.cpp:385
yarp::sig::Vector min
Definition: nlp.h:39
bool setProjection(const yarp::sig::Matrix &Prj)
Definition: nlp.cpp:351
std::deque< yarp::sig::Vector > p2d
Definition: nlp.h:44
void clearPoints()
Definition: nlp.cpp:400
yarp::sig::Matrix getProjection() const
Definition: nlp.cpp:364
#define ALIGN_IPOPT_MAX_ITER
Definition: nlp.h:28
yarp::sig::Matrix computeH(const yarp::sig::Vector &x)