ViSP  2.7.0

#include <vpRzyxVector.h>

+ Inheritance diagram for vpRzyxVector:

Public Member Functions

 vpRzyxVector ()
 
 vpRzyxVector (const vpRzyxVector &m)
 
 vpRzyxVector (const double phi, const double theta, const double psi)
 
 vpRzyxVector (const vpRotationMatrix &R)
 
 vpRzyxVector (const vpThetaUVector &tu)
 
vpRzyxVectoroperator= (const vpRzyxVector &m)
 
void buildFrom (const double phi, const double theta, const double psi)
 
vpRzyxVector buildFrom (const vpRotationMatrix &R)
 
vpRzyxVector buildFrom (const vpThetaUVector &R)
 
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)$ angle using the z-y-x convention, where $(\varphi,\theta,\psi)$ are respectively the rotation angles around the $z$, $y$ and $x$ axis.

\[R_{zyx}(\varphi,\theta,\psi) = R_z(\varphi) \; R_y(\theta) \; R_x(\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_{x}(\psi) = \left( \begin{array}{ccc} 1 & 0 & 0 \\ 0 &\cos \psi & -\sin\psi \\ 0 &\sin \psi & \cos\psi \\ \end{array} \right) \]

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

\[ R_{zyx}(\varphi,\theta,\psi) = \left( \begin{array}{ccc} \cos\varphi \cos\theta & -\sin\varphi \cos\psi + \cos\varphi\sin\theta\sin\psi & \sin\varphi \sin\psi +\cos\varphi\sin\theta\cos\psi \\ \sin\varphi \cos\theta & \cos\varphi\cos\psi + \sin\varphi\sin\theta \sin\psi & -\cos\varphi \sin\psi +\sin\varphi\sin\theta\cos\psi \\ -\sin\theta & \cos\theta \sin\psi & \cos\theta \cos\psi \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 vpRzyxVector and finaly how to extract the vpRzyxVector Euler angles from the build rotation matrix.

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

Definition at line 151 of file vpRzyxVector.h.

Constructor & Destructor Documentation

vpRzyxVector::vpRzyxVector ( )
inline

Default constructor. Initialize the angles to zero.

Definition at line 158 of file vpRzyxVector.h.

vpRzyxVector::vpRzyxVector ( const vpRzyxVector m)

Copy constructor.

Definition at line 71 of file vpRzyxVector.cpp.

vpRzyxVector::vpRzyxVector ( 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 $x$ axis.

Definition at line 169 of file vpRzyxVector.h.

References vpRotationVector::r.

vpRzyxVector::vpRzyxVector ( const vpRotationMatrix R)

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

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

Definition at line 82 of file vpRzyxVector.cpp.

References buildFrom().

vpRzyxVector::vpRzyxVector ( const vpThetaUVector tu)

Constructor that initialize $R_{zyx}=(\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 94 of file vpRzyxVector.cpp.

References buildFrom().

Member Function Documentation

void vpRzyxVector::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 $x$ axis.

Definition at line 187 of file vpRzyxVector.h.

References vpRotationVector::r.

Referenced by buildFrom(), and vpRzyxVector().

vpRzyxVector vpRzyxVector::buildFrom ( const vpRotationMatrix R)

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

Source: R. Paul, Robot Manipulators: Mathematics, Programming, and Control. MIT Press, 1981, p. 71

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

Definition at line 110 of file vpRzyxVector.cpp.

References vpRotationVector::r.

vpRzyxVector vpRzyxVector::buildFrom ( const vpThetaUVector tu)

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

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

Definition at line 145 of file vpRzyxVector.cpp.

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

void vpRotationVector::init ( const unsigned int  size)
protectedinherited
vpRzyxVector & vpRzyxVector::operator= ( const vpRzyxVector m)

Affectation of two vectors.

Definition at line 59 of file vpRzyxVector.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 120 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 125 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::init(), vpQuaternionVector::operator=(), and vpQuaternionVector::vpQuaternionVector().

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 153 of file vpRzyxVector.h.

friend class vpThetaUVector
friend

Definition at line 154 of file vpRzyxVector.h.

Member Data Documentation

unsigned int vpRotationVector::_size
protectedinherited