Visual Servoing Platform  version 3.5.0 under development (2022-02-15)
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(double tx, double ty, double tz, double tux, double tuy, 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(double tx, double ty, double tz, double tux, double tuy, double tuz);
170  // convert an homogeneous matrix in a pose
171  vpPoseVector buildFrom(const vpHomogeneousMatrix &M);
172  // convert a translation and a "thetau" vector into a pose
173  vpPoseVector buildFrom(const vpTranslationVector &tv, const vpThetaUVector &tu);
174  // convert a translation and a rotation matrix into a pose
175  vpPoseVector buildFrom(const vpTranslationVector &tv, const vpRotationMatrix &R);
176 
177  void extract(vpRotationMatrix &R) const;
178  void extract(vpThetaUVector &tu) const;
179  void extract(vpTranslationVector &tv) const;
180  void extract(vpQuaternionVector &q) const;
181 
182  vpRotationMatrix getRotationMatrix() const;
183  vpThetaUVector getThetaUVector() const;
184  vpTranslationVector getTranslationVector() const;
185 
186  // Load an homogeneous matrix from a file
187  void load(std::ifstream &f);
188 
213  inline double &operator[](unsigned int i) { return *(data + i); }
232  inline const double &operator[](unsigned int i) const { return *(data + i); }
233 
234  // Print a vector [T thetaU] thetaU in degree
235  void print() const;
236  int print(std::ostream &s, unsigned int length, char const *intro = 0) const;
237 
243  void resize(unsigned int nrows, unsigned int ncols, bool flagNullify = true)
244  {
245  (void)nrows;
246  (void)ncols;
247  (void)flagNullify;
248  throw(vpException(vpException::fatalError, "Cannot resize a pose vector"));
249  };
250 
251  // Save an homogeneous matrix in a file
252  void save(std::ofstream &f) const;
253  void set(double tx, double ty, double tz, double tux, double tuy, double tuz);
254  vpRowVector t() const;
255 
256 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
257 
265  vp_deprecated void init(){};
267 #endif
268 };
269 
270 #endif
Implementation of an homogeneous matrix and operations on such kind of matrices.
Implementation of row vector and the associated operations.
Definition: vpRowVector.h:115
static bool save(const std::string &filename, const vpArray2D< Type > &A, bool binary=false, const char *header="")
Definition: vpArray2D.h:737
error that can be emited by ViSP classes.
Definition: vpException.h:71
double & operator[](unsigned int i)
Definition: vpPoseVector.h:213
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.
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true)
Definition: vpPoseVector.h:243
const double & operator[](unsigned int i) const
Definition: vpPoseVector.h:232
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.
static bool load(const std::string &filename, vpArray2D< Type > &A, bool binary=false, char *header=NULL)
Definition: vpArray2D.h:540
vp_deprecated void init()
Definition: vpPoseVector.h:265