Visual Servoing Platform  version 3.0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
vpPoseVector.h
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  * Pose object. A pose is a size 6 vector [t, tu]^T where tu is
32  * a rotation vector (theta u representation) and t is a translation vector.
33  *
34  * Authors:
35  * Eric Marchand
36  * Fabien Spindler
37  *
38  *****************************************************************************/
39 
40 
41 #ifndef vpPOSEVECTOR_H
42 #define vpPOSEVECTOR_H
43 
52 class vpRotationMatrix;
55 class vpThetaUVector;
56 class vpRowVector;
57 
58 #include <visp3/core/vpArray2D.h>
59 #include <visp3/core/vpMatrix.h>
60 #include <visp3/core/vpRotationMatrix.h>
61 #include <visp3/core/vpHomogeneousMatrix.h>
62 
63 
93 class VISP_EXPORT vpPoseVector : public vpArray2D<double>
94 {
95 public:
96  // constructor
97  vpPoseVector() ;
98  // constructor from 3 angles (in radian)
99  vpPoseVector(const double tx, const double ty, const double tz,
100  const double tux, const double tuy, const double tuz) ;
101  // constructor convert an homogeneous matrix in a pose
103  // constructor convert a translation and a "thetau" vector into a pose
105  const vpThetaUVector& tu) ;
106  // constructor convert a translation and a rotation matrix into a pose
108  const vpRotationMatrix& R) ;
112  virtual ~vpPoseVector() {};
113 
114  vpPoseVector buildFrom(const double tx, const double ty, const double tz,
115  const double tux, const double tuy, const double tuz) ;
116  // convert an homogeneous matrix in a pose
117  vpPoseVector buildFrom(const vpHomogeneousMatrix& M) ;
118  // convert a translation and a "thetau" vector into a pose
119  vpPoseVector buildFrom(const vpTranslationVector& tv,
120  const vpThetaUVector& tu) ;
121  // convert a translation and a rotation matrix into a pose
122  vpPoseVector buildFrom(const vpTranslationVector& tv,
123  const vpRotationMatrix& R) ;
124 
125  void extract(vpRotationMatrix &R) const;
126  void extract(vpThetaUVector &tu) const;
127  void extract(vpTranslationVector &tv) const;
128  void extract(vpQuaternionVector& q) const;
129 
130  vpRotationMatrix getRotationMatrix() const;
131  vpThetaUVector getThetaUVector() const;
132  vpTranslationVector getTranslationVector() const;
133 
134  // Load an homogeneous matrix from a file
135  void load(std::ifstream &f) ;
136 
161  inline double &operator [](unsigned int i) { return *(data + i); }
180  inline const double &operator [](unsigned int i) const { return *(data+i); }
181 
182  // Print a vector [T thetaU] thetaU in degree
183  void print() const;
184  int print(std::ostream& s, unsigned int length, char const* intro=0) const;
185 
191  void resize(const unsigned int nrows, const unsigned int ncols,
192  const bool flagNullify = true)
193  {
194  (void)nrows;
195  (void)ncols;
196  (void)flagNullify;
197  throw(vpException(vpException::fatalError, "Cannot resize a pose vector"));
198  };
199 
200  // Save an homogeneous matrix in a file
201  void save(std::ofstream &f) const ;
202  void set(const double tx, const double ty, const double tz,
203  const double tux, const double tuy, const double tuz);
204  vpRowVector t() const;
205 
206 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
207 
215  vp_deprecated void init() {};
217 #endif
218 } ;
219 
220 #endif
void resize(const unsigned int nrows, const unsigned int ncols, const bool flagNullify=true)
Definition: vpPoseVector.h:191
static bool save(const std::string &filename, const vpArray2D< Type > &A, const bool binary=false, const char *header="")
Definition: vpArray2D.h:499
Implementation of an homogeneous matrix and operations on such kind of matrices.
Implementation of row vector and the associated operations.
Definition: vpRowVector.h:70
error that can be emited by ViSP classes.
Definition: vpException.h:73
Implementation of a generic 2D array used as vase class of matrices and vectors.
Definition: vpArray2D.h:70
Implementation of a rotation matrix and operations on such kind of matrices.
static bool load(const std::string &filename, vpArray2D< Type > &A, const bool binary=false, char *header=NULL)
Definition: vpArray2D.h:308
Implementation of a rotation vector as quaternion angle minimal representation.
Type * operator[](unsigned int i)
Set element using A[i][j] = x.
Definition: vpArray2D.h:259
virtual ~vpPoseVector()
Definition: vpPoseVector.h:112
Implementation of a pose vector and operations on poses.
Definition: vpPoseVector.h:93
Class that consider the case of a translation vector.
Implementation of a rotation vector as axis-angle minimal representation.
vp_deprecated void init()
Definition: vpPoseVector.h:215