Visual Servoing Platform  version 3.0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
testTwistMatrix.cpp
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2017 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * ("GPL") version 2 as published by the Free Software Foundation.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ViSP with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * See http://visp.inria.fr for more information.
17  *
18  * This software was developed at:
19  * Inria Rennes - Bretagne Atlantique
20  * Campus Universitaire de Beaulieu
21  * 35042 Rennes Cedex
22  * France
23  *
24  * If you have questions regarding the use of this file, please contact
25  * Inria at visp@inria.fr
26  *
27  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29  *
30  * Description:
31  * Tests some vpMatrix functionalities.
32  *
33  * Authors:
34  * Fabien Spindler
35  *
36  *****************************************************************************/
37 
46 #include <visp3/core/vpConfig.h>
47 #include <visp3/core/vpDebug.h>
48 
49 #include <stdlib.h>
50 #include <stdio.h>
51 
52 #include <visp3/core/vpMath.h>
53 #include <visp3/core/vpMatrix.h>
54 #include <visp3/core/vpColVector.h>
55 #include <visp3/core/vpRxyzVector.h>
56 #include <visp3/core/vpTranslationVector.h>
57 #include <visp3/core/vpRotationMatrix.h>
58 #include <visp3/core/vpVelocityTwistMatrix.h>
59 
60 int
61 main()
62 {
63  try {
64  vpTRACE("--------------------------");
65  vpTRACE("--- TEST vpVelocityTwistMatrix ---");
66  vpTRACE("--------------------------");
67 
68  // Set the translation
70  cte[0] = 1.;
71  cte[1] = 0.5;
72  cte[2] = -1.;
73 
74  // Set the rotation
75  vpRxyzVector cre;
76  cre[0] = M_PI/2.;
77  cre[1] = -M_PI/2.;
78  cre[2] = -M_PI/4.;
79 
80  // Build rotation matrix
81  vpRotationMatrix cRe(cre);
82 
83  // Build the twist matrix
84  vpVelocityTwistMatrix cVe(cte, cRe);
85 
86  vpTRACE("cVe twist matrix:");
87  cVe.print (std::cout, 6);
88 
89  // Set a speed skew
90  vpColVector ev(6);
91 
92  ev[0] = 1.;
93  ev[1] = 0.1;
94  ev[2] = -0.5;
95  ev[3] = M_PI/180.;
96  ev[4] = M_PI/18.;
97  ev[5] = M_PI/10.;
98 
99  vpTRACE("ev colvector:");
100  ev.print (std::cout, 6);
101 
102  // Set a speed skew
103  vpColVector cv;
104 
105  cv = cVe * ev;
106 
107  vpTRACE("cv = cVe * ev:");
108  cv.print (std::cout, 6);
109  return 0;
110  }
111  catch(vpException &e) {
112  std::cout << "Catch an exception: " << e << std::endl;
113  return 1;
114  }
115 }
error that can be emited by ViSP classes.
Definition: vpException.h:73
Implementation of a rotation matrix and operations on such kind of matrices.
int print(std::ostream &s, unsigned int length, char const *intro=0) const
#define vpTRACE
Definition: vpDebug.h:414
Implementation of a velocity twist matrix and operations on such kind of matrices.
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
Implementation of a rotation vector as Euler angle minimal representation.
Definition: vpRxyzVector.h:154
Class that consider the case of a translation vector.