ViSP  2.9.0
testFeature.cpp
1 /****************************************************************************
2  *
3  * $Id: testFeature.cpp 4574 2014-01-09 08:48:51Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2014 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Visual feature manipulation.
36  *
37  * Author:
38  * Fabien Spindler
39  *
40  *****************************************************************************/
41 
42 
43 #include <visp/vpColVector.h>
44 #include <visp/vpTranslationVector.h>
45 #include <visp/vpRotationMatrix.h>
46 #include <visp/vpHomogeneousMatrix.h>
47 #include <visp/vpServo.h>
48 #include <visp/vpFeaturePoint.h>
49 #include <visp/vpGenericFeature.h>
50 #include <visp/vpFeatureBuilder.h>
51 #include <visp/vpFeatureThetaU.h>
52 #include <visp/vpDot2.h>
53 #include <visp/vpCameraParameters.h>
54 
55 #include <iostream>
56 
64 int main()
65 {
66  try {
67  for (int i=0; i < 3; i++) {
68  vpServo task ;
69 
70  // Creation od a Theta U vector that represent the rotation
71  // between the desired camera frame and the current one.
72  vpThetaUVector tu_cdRc; // Current visual feature s
73  tu_cdRc[0] =0.1;
74  tu_cdRc[1] =0.2;
75  tu_cdRc[2] =0.3;
76 
77  // Creation of the current feature s
79  s.buildFrom(tu_cdRc);
80  s.print();
81  task.addFeature(s); // Add current ThetaU feature
82 
83  // Creation of the desired feature s^*
84  vpFeatureThetaU s_star(vpFeatureThetaU::cdRc); // init to zero
85 
86  // Compute the interaction matrix for the ThetaU_z feature
87  vpMatrix L_z = s.interaction( vpFeatureThetaU::selectTUz() );
88  // Compute the error vector (s-s^*) for the ThetaU_z feature
89  s.error(s_star, vpFeatureThetaU::selectTUz());
90 
91  // A call to kill() is requested here to destroy properly the current
92  // and desired feature lists.
93  task.kill();
94 
95  std::cout << "End, call vpServo destructors..." << std::endl;
96  }
97  return 0;
98  }
99  catch(vpException e) {
100  std::cout << "Catch an exception: " << e << std::endl;
101  return 1;
102  }
103 }
Definition of the vpMatrix class.
Definition: vpMatrix.h:98
void addFeature(vpBasicFeature &s, vpBasicFeature &s_star, const unsigned int select=vpBasicFeature::FEATURE_ALL)
Definition: vpServo.cpp:449
error that can be emited by ViSP classes.
Definition: vpException.h:76
static unsigned int selectTUz()
void kill()
Definition: vpServo.cpp:189
Class that defines a 3D visual feature from a axis/angle parametrization that represent the rotatio...
Class that consider the case of the parameterization for the rotation.