ViSP  2.10.0

#include <vpRzyzVector.h>

+ Inheritance diagram for vpRzyzVector:

Public Member Functions

 vpRzyzVector ()
 
 vpRzyzVector (const vpRzyzVector &rzyz)
 
 vpRzyzVector (const double phi, const double theta, const double psi)
 
 vpRzyzVector (const vpRotationMatrix &R)
 
 vpRzyzVector (const vpThetaUVector &tu)
 
void buildFrom (const double phi, const double theta, const double psi)
 
vpRzyzVector buildFrom (const vpRotationMatrix &R)
 
vpRzyzVector buildFrom (const vpThetaUVector &R)
 
vpRzyzVectoroperator= (double x)
 
double & operator[] (unsigned int n)
 
const double & operator[] (unsigned int n) const
 
unsigned int size () const
 
vpRowVector t () const
 

Protected Member Functions

void init (const unsigned int size)
 

Protected Attributes

double * r
 
unsigned int _size
 

Friends

class vpRotationMatrix
 
class vpThetaUVector
 

Detailed Description

Class that consider the case of the Euler $(\varphi,\theta,\psi)$ angles using the z-y-z convention, where $(\varphi,\theta,\psi)$ are respectively the rotation angles around the $z$, $y$ and $z$ axis.

\[R_{zyz}(\varphi,\theta,\psi) = R_z(\varphi) \; R_y(\theta) \; R_z(\psi)\]

with

\[ R_{z}(\varphi) = \left( \begin{array}{ccc} \cos \varphi & -\sin\varphi & 0\\ \sin\varphi &\cos \varphi& 0 \\ 0 & 0 & 1 \end{array} \right) \; R_{y}(\theta) = \left( \begin{array}{ccc} \cos \theta & 0 & \sin\theta\\ 0 & 1 & 0 \\ -\sin\theta & 0 &\cos \theta \end{array} \right) \; R_{z}(\psi) = \left( \begin{array}{ccc} \cos \psi & -\sin\psi & 0\\ \sin\psi &\cos \psi& 0 \\ 0 & 0 & 1 \end{array} \right) \]

The rotation matrix corresponding to the z-y-z convention is given by:

\[ R_{zyz}(\varphi,\theta,\psi) = \left( \begin{array}{ccc} \cos\varphi \cos\theta \cos\psi - \sin\varphi\sin\psi & -\cos\varphi \cos\theta \sin\psi -\sin\varphi\cos\psi & \cos\varphi \sin\theta \\ \sin\varphi \cos\theta \cos\psi + \cos\varphi\sin\psi & -\sin\varphi \cos\theta \sin\psi +\cos\varphi\cos\psi & \sin\varphi \sin\theta \\ -\sin\theta \cos\psi & \sin\theta \sin\psi & \cos\theta \end{array} \right) \]

The code below shows first how to initialize this representation of Euler angles, than how to contruct a rotation matrix from a vpRzyzVector and finaly how to extract the vpRzyzVector Euler angles from the build rotation matrix.

#include <visp/vpMath.h>
#include <visp/vpRotationMatrix.h>
#include <visp/vpRzyzVector.h>
int main()
{
// Initialise the Euler angles
rzyz[0] = vpMath::rad( 45.f); // phi angle in rad/s around z axis
rzyz[1] = vpMath::rad(-30.f); // theta angle in rad/s around y axis
rzyz[2] = vpMath::rad( 90.f); // psi angle in rad/s around z axis
// Construct a rotation matrix from the Euler angles
// Extract the Euler angles around z,y,z axis from a rotation matrix
rzyz.buildFrom(R);
// Print the extracted Euler angles. Values are the same than the
// one used for initialization
std::cout << rzyz;
// Since the rotation vector is 3 values column vector, the
// transpose operation produce a row vector.
vpRowVector rzyz_t = rzyz.t();
// Print the transpose row vector
std::cout << rzyz_t << std::endl;
}
Examples:
testRobotViper850.cpp, and testViper850.cpp.

Definition at line 150 of file vpRzyzVector.h.

Constructor & Destructor Documentation

vpRzyzVector::vpRzyzVector ( )
inline

Default constructor that initialize all the angles to zero.

Definition at line 157 of file vpRzyzVector.h.

vpRzyzVector::vpRzyzVector ( const vpRzyzVector rzyz)
inline

Copy constructor.

Definition at line 159 of file vpRzyzVector.h.

vpRzyzVector::vpRzyzVector ( const double  phi,
const double  theta,
const double  psi 
)
inline

Constructor from 3 angles (in radian).

Parameters
phi: $\varphi$ angle around the $z$ axis.
theta: $\theta$ angle around the $y$ axis.
psi: $\psi$ angle around the $z$ axis.

Definition at line 167 of file vpRzyzVector.h.

References vpRotationVector::r.

vpRzyzVector::vpRzyzVector ( const vpRotationMatrix R)

Constructor that initialize $R_{zyz}=(\varphi,\theta,\psi)$ Euler angles from a rotation matrix.

Parameters
R: Rotation matrix used to initialize the Euler angles.

Definition at line 59 of file vpRzyzVector.cpp.

References buildFrom().

vpRzyzVector::vpRzyzVector ( const vpThetaUVector tu)

Constructor that initialize $R_{zyz}=(\varphi,\theta,\psi)$ Euler angles vector from a $\theta u$ vector.

Parameters
tu: $\theta u$ representation of a rotation used here as input to initialize the Euler angles.

Definition at line 70 of file vpRzyzVector.cpp.

References buildFrom().

Member Function Documentation

void vpRzyzVector::buildFrom ( const double  phi,
const double  theta,
const double  psi 
)
inline

Construction from 3 angles (in radian).

Parameters
phi: $\varphi$ angle around the $z$ axis.
theta: $\theta$ angle around the $y$ axis.
psi: $\psi$ angle around the $z$ axis.
Examples:
testRobotViper850.cpp, and testViper850.cpp.

Definition at line 182 of file vpRzyzVector.h.

References vpRotationVector::r.

Referenced by buildFrom(), and vpRzyzVector().

vpRzyzVector vpRzyzVector::buildFrom ( const vpRotationMatrix R)

Convert a rotation matrix into a $R_{zyz}=(\varphi,\theta,\psi)$ Euler angles vector.

Parameters
R: Rotation matrix used as input.
Returns
$R_{zyz}=(\varphi,\theta,\psi)$ Euler angles vector.

Definition at line 84 of file vpRzyzVector.cpp.

References vpRotationVector::r.

vpRzyzVector vpRzyzVector::buildFrom ( const vpThetaUVector tu)

Convert a $\theta u$ vector into a $R_{zyz}=(\varphi,\theta,\psi)$ Euler angles vector.

Parameters
tu: $\theta u$ representation of a rotation used here as input.
Returns
$R_{zyz}=(\varphi,\theta,\psi)$ Euler angles vector.

Definition at line 114 of file vpRzyzVector.cpp.

References vpRotationMatrix::buildFrom(), and buildFrom().

void vpRotationVector::init ( const unsigned int  size)
protectedinherited

Definition at line 117 of file vpRotationVector.cpp.

References vpRotationVector::_size, and vpRotationVector::r.

vpRzyzVector & vpRzyzVector::operator= ( double  v)

Initialize each element of the vector to the same angle value v.

Parameters
v: Angle value to set for each element of the vector.
#include <visp/vpMath.h>
#include <visp/vpRzyzVector.h>
int main()
{
// Initialise the rotation vector
r = vpMath::rad( 45.f); // All the 3 angles are set to 45 degrees
}

Definition at line 143 of file vpRzyzVector.cpp.

References vpRotationVector::r.

double& vpRotationVector::operator[] ( unsigned int  n)
inlineinherited

Operator that allows to set the value of an element of the rotation vector: r[i] = value

Definition at line 130 of file vpRotationVector.h.

const double& vpRotationVector::operator[] ( unsigned int  n) const
inlineinherited

Operator that allows to get the value of an element of the rotation vector: value = r[i]

Definition at line 135 of file vpRotationVector.h.

unsigned int vpRotationVector::size ( ) const
inherited

Returns the size of the rotation vector

Size of the rotation vector: number of double values describing the rotation. Common sizes are 4 for a quaternion and 3 for angle-based rotation vectors.

Definition at line 71 of file vpRotationVector.cpp.

References vpRotationVector::_size.

Referenced by vpRotationVector::operator=().

vpRowVector vpRotationVector::t ( ) const
inherited

Return the transpose of the rotation vector.

Examples:
testViper850.cpp.

Definition at line 57 of file vpRotationVector.cpp.

References vpRotationVector::_size, and vpRotationVector::r.

Friends And Related Function Documentation

friend class vpRotationMatrix
friend

Definition at line 152 of file vpRzyzVector.h.

friend class vpThetaUVector
friend

Definition at line 153 of file vpRzyzVector.h.

Member Data Documentation

unsigned int vpRotationVector::_size
protectedinherited