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