Visual Servoing Platform  version 3.2.1 under development (2019-12-07)
vpPoseVector.h
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  * Pose object. A pose is a size 6 vector [t, tu]^T where tu is
33  * a rotation vector (theta u representation) and t is a translation vector.
34  *
35  * Authors:
36  * Eric Marchand
37  * Fabien Spindler
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/vpHomogeneousMatrix.h>
60 #include <visp3/core/vpMatrix.h>
61 #include <visp3/core/vpRotationMatrix.h>
62 
151 class VISP_EXPORT vpPoseVector : public vpArray2D<double>
152 {
153 public:
154  // constructor
155  vpPoseVector();
156  // constructor from 3 angles (in radian)
157  vpPoseVector(const double tx, const double ty, const double tz, const double tux, const double tuy, const double tuz);
158  // constructor convert an homogeneous matrix in a pose
159  explicit vpPoseVector(const vpHomogeneousMatrix &M);
160  // constructor convert a translation and a "thetau" vector into a pose
161  vpPoseVector(const vpTranslationVector &tv, const vpThetaUVector &tu);
162  // constructor convert a translation and a rotation matrix into a pose
167  virtual ~vpPoseVector(){};
168 
169  vpPoseVector buildFrom(const double tx, const double ty, const double tz, const double tux, const double tuy,
170  const double tuz);
171  // convert an homogeneous matrix in a pose
172  vpPoseVector buildFrom(const vpHomogeneousMatrix &M);
173  // convert a translation and a "thetau" vector into a pose
174  vpPoseVector buildFrom(const vpTranslationVector &tv, const vpThetaUVector &tu);
175  // convert a translation and a rotation matrix into a pose
176  vpPoseVector buildFrom(const vpTranslationVector &tv, const vpRotationMatrix &R);
177 
178  void extract(vpRotationMatrix &R) const;
179  void extract(vpThetaUVector &tu) const;
180  void extract(vpTranslationVector &tv) const;
181  void extract(vpQuaternionVector &q) const;
182 
183  vpRotationMatrix getRotationMatrix() const;
184  vpThetaUVector getThetaUVector() const;
185  vpTranslationVector getTranslationVector() const;
186 
187  // Load an homogeneous matrix from a file
188  void load(std::ifstream &f);
189 
214  inline double &operator[](unsigned int i) { return *(data + i); }
233  inline const double &operator[](unsigned int i) const { return *(data + i); }
234 
235  // Print a vector [T thetaU] thetaU in degree
236  void print() const;
237  int print(std::ostream &s, unsigned int length, char const *intro = 0) const;
238 
244  void resize(const unsigned int nrows, const unsigned int ncols, const bool flagNullify = true)
245  {
246  (void)nrows;
247  (void)ncols;
248  (void)flagNullify;
249  throw(vpException(vpException::fatalError, "Cannot resize a pose vector"));
250  };
251 
252  // Save an homogeneous matrix in a file
253  void save(std::ofstream &f) const;
254  void set(const double tx, const double ty, const double tz, const double tux, const double tuy, const double tuz);
255  vpRowVector t() const;
256 
257 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
258 
266  vp_deprecated void init(){};
268 #endif
269 };
270 
271 #endif
void resize(const unsigned int nrows, const unsigned int ncols, const bool flagNullify=true)
Definition: vpPoseVector.h:244
static bool save(const std::string &filename, const vpArray2D< Type > &A, const bool binary=false, const char *header="")
Definition: vpArray2D.h:739
Implementation of an homogeneous matrix and operations on such kind of matrices.
Implementation of row vector and the associated operations.
Definition: vpRowVector.h:115
error that can be emited by ViSP classes.
Definition: vpException.h:71
double & operator[](unsigned int i)
Definition: vpPoseVector.h:214
Implementation of a generic 2D array used as base class for matrices and vectors. ...
Definition: vpArray2D.h:131
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:542
const double & operator[](unsigned int i) const
Definition: vpPoseVector.h:233
Implementation of a rotation vector as quaternion angle minimal representation.
virtual ~vpPoseVector()
Definition: vpPoseVector.h:167
Implementation of a pose vector and operations on poses.
Definition: vpPoseVector.h:151
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:266