Visual Servoing Platform
version 3.7.0
Toggle main menu visibility
Loading...
Searching...
No Matches
vpPoseVector.h
1
/*
2
* ViSP, open source Visual Servoing Platform software.
3
* Copyright (C) 2005 - 2024 by Inria. All rights reserved.
4
*
5
* This software is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
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 https://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
42
43
#ifndef VP_POSE_VECTOR_H
44
#define VP_POSE_VECTOR_H
45
46
#include <visp3/core/vpConfig.h>
47
#include <visp3/core/vpArray2D.h>
48
#include <visp3/core/vpHomogeneousMatrix.h>
49
#include <visp3/core/vpMatrix.h>
50
#include <visp3/core/vpRotationMatrix.h>
51
52
BEGIN_VISP_NAMESPACE
53
class
vpRotationMatrix
;
54
class
vpHomogeneousMatrix
;
55
class
vpTranslationVector
;
56
class
vpThetaUVector
;
57
class
vpRowVector
;
58
202
class
VISP_EXPORT
vpPoseVector
:
public
vpArray2D
<double>
203
{
204
public
:
205
// constructor
206
vpPoseVector
();
207
// constructor from 3 angles (in radian)
208
vpPoseVector
(
double
tx,
double
ty,
double
tz,
double
tux,
double
tuy,
double
tuz);
209
// constructor convert an homogeneous matrix in a pose
210
VP_EXPLICIT
vpPoseVector
(
const
vpHomogeneousMatrix
&M);
211
// constructor convert a translation and a "thetau" vector into a pose
212
vpPoseVector
(
const
vpTranslationVector
&tv,
const
vpThetaUVector
&tu);
213
// constructor convert a translation and a rotation matrix into a pose
214
vpPoseVector
(
const
vpTranslationVector
&tv,
const
vpRotationMatrix
&R);
215
216
vpPoseVector
&
buildFrom
(
const
double
&tx,
const
double
&ty,
const
double
&tz,
const
double
&tux,
const
double
&tuy,
const
double
&tuz);
217
// convert an homogeneous matrix in a pose
218
vpPoseVector
&
buildFrom
(
const
vpHomogeneousMatrix
&M);
219
// convert a translation and a "thetau" vector into a pose
220
vpPoseVector
&
buildFrom
(
const
vpTranslationVector
&tv,
const
vpThetaUVector
&tu);
221
// convert a translation and a rotation matrix into a pose
222
vpPoseVector
&
buildFrom
(
const
vpTranslationVector
&tv,
const
vpRotationMatrix
&R);
223
224
void
extract
(
vpRotationMatrix
&R)
const
;
225
void
extract
(
vpThetaUVector
&tu)
const
;
226
void
extract
(
vpTranslationVector
&tv)
const
;
227
void
extract
(
vpQuaternionVector
&q)
const
;
228
229
vpRotationMatrix
getRotationMatrix
()
const
;
230
vpThetaUVector
getThetaUVector
()
const
;
231
vpTranslationVector
getTranslationVector
()
const
;
232
233
// Load an homogeneous matrix from a file
234
void
load
(std::ifstream &f);
235
260
inline
double
&
operator[]
(
unsigned
int
i) {
return
*(
data
+ i); }
279
inline
const
double
&
operator[]
(
unsigned
int
i)
const
{
return
*(
data
+ i); }
280
281
// Print a vector [T thetaU] thetaU in degree
282
void
print()
const
;
283
int
print(std::ostream &s,
unsigned
int
length,
char
const
*intro =
nullptr
)
const
;
284
290
VP_NORETURN
void
resize
(
unsigned
int
nrows,
unsigned
int
ncols,
bool
flagNullify =
true
)
291
{
292
(void)nrows;
293
(void)ncols;
294
(void)flagNullify;
295
throw
(
vpException
(
vpException::fatalError
,
"Cannot resize a pose vector"
));
296
}
297
298
// Save an homogeneous matrix in a file
299
void
save
(std::ofstream &f)
const
;
300
void
set(
double
tx,
double
ty,
double
tz,
double
tux,
double
tuy,
double
tuz);
301
vpRowVector
t
()
const
;
302
303
std::vector<double> toStdVector()
const
;
304
305
#ifdef VISP_HAVE_NLOHMANN_JSON
306
public
:
307
static
const
std::string
jsonTypeName
;
308
private
:
309
friend
void
to_json
(nlohmann::json &j,
const
vpPoseVector
&cam);
310
friend
void
from_json
(
const
nlohmann::json &j,
vpPoseVector
&cam);
311
// Conversion helper function to avoid circular dependencies and MSVC errors that are not exported in the DLL
312
void
parse_json(
const
nlohmann::json &j);
313
void
convert_to_json(nlohmann::json &j)
const
;
314
public
:
315
#endif
316
317
private
:
318
static
const
unsigned
int
constr_value_6;
319
#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
324
328
VP_DEPRECATED
void
init() { }
330
#endif
331
};
332
333
#ifdef VISP_HAVE_NLOHMANN_JSON
334
#include VISP_NLOHMANN_JSON(json.hpp)
335
inline
void
to_json
(nlohmann::json &j,
const
vpPoseVector
&r)
336
{
337
r.convert_to_json(j);
338
}
339
340
inline
void
from_json
(
const
nlohmann::json &j,
vpPoseVector
&r)
341
{
342
r.parse_json(j);
343
}
344
#endif
345
END_VISP_NAMESPACE
346
#endif
vpArray2D< double >::data
double * data
Definition
vpArray2D.h:149
vpArray2D< double >::vpArray2D
vpArray2D()
Definition
vpArray2D.h:155
vpArray2D::to_json
friend void to_json(nlohmann::json &j, const vpArray2D< T > &array)
vpArray2D::load
static bool load(const std::string &filename, vpArray2D< Type > &A, bool binary=false, char *header=nullptr)
Definition
vpArray2D.h:760
vpArray2D::t
vpArray2D< Type > t() const
Compute the transpose of the array.
Definition
vpArray2D.h:1273
vpArray2D::save
static bool save(const std::string &filename, const vpArray2D< Type > &A, bool binary=false, const char *header="")
Definition
vpArray2D.h:965
vpArray2D::from_json
friend void from_json(const nlohmann::json &j, vpArray2D< T > &array)
vpException
error that can be emitted by ViSP classes.
Definition
vpException.h:60
vpException::fatalError
@ fatalError
Fatal error.
Definition
vpException.h:72
vpHomogeneousMatrix
Implementation of an homogeneous matrix and operations on such kind of matrices.
Definition
vpHomogeneousMatrix.h:221
vpPoseVector::getTranslationVector
vpTranslationVector getTranslationVector() const
Definition
vpPoseVector.cpp:326
vpPoseVector::operator[]
double & operator[](unsigned int i)
Definition
vpPoseVector.h:260
vpPoseVector::from_json
friend void from_json(const nlohmann::json &j, vpPoseVector &cam)
Definition
vpPoseVector.h:340
vpPoseVector::jsonTypeName
static const std::string jsonTypeName
Definition
vpPoseVector.h:307
vpPoseVector::to_json
friend void to_json(nlohmann::json &j, const vpPoseVector &cam)
Definition
vpPoseVector.h:335
vpPoseVector::extract
void extract(vpRotationMatrix &R) const
Definition
vpPoseVector.cpp:315
vpPoseVector::getThetaUVector
vpThetaUVector getThetaUVector() const
Definition
vpPoseVector.cpp:349
vpPoseVector::operator[]
const double & operator[](unsigned int i) const
Definition
vpPoseVector.h:279
vpPoseVector::vpPoseVector
vpPoseVector()
Definition
vpPoseVector.cpp:62
vpPoseVector::buildFrom
vpPoseVector & buildFrom(const double &tx, const double &ty, const double &tz, const double &tux, const double &tuy, const double &tuz)
Definition
vpPoseVector.cpp:193
vpPoseVector::getRotationMatrix
vpRotationMatrix getRotationMatrix() const
Definition
vpPoseVector.cpp:339
vpPoseVector::resize
VP_NORETURN void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true)
Definition
vpPoseVector.h:290
vpQuaternionVector
Implementation of a rotation vector as quaternion angle minimal representation.
Definition
vpQuaternionVector.h:106
vpRotationMatrix
Implementation of a rotation matrix and operations on such kind of matrices.
Definition
vpRotationMatrix.h:130
vpRowVector
Implementation of row vector and the associated operations.
Definition
vpRowVector.h:124
vpThetaUVector
Implementation of a rotation vector as axis-angle minimal representation.
Definition
vpThetaUVector.h:172
vpTranslationVector
Class that consider the case of a translation vector.
Definition
vpTranslationVector.h:119
BEGIN_VISP_NAMESPACE
Definition
vpMbtDistanceCircle.cpp:55
modules
core
include
visp3
core
vpPoseVector.h
Generated by
1.17.0