ViSP  2.9.0

#include <vpRxyzVector.h>

+ Inheritance diagram for vpRxyzVector:

Public Member Functions

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

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

with

\[R_{x}(\varphi) = \left( \begin{array}{ccc} 1 & 0 & 0 \\ 0 &\cos \varphi & -\sin\varphi \\ 0 &\sin \varphi & \cos\varphi \\ \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 x-y-z convention is given by:

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

#include <iostream>
#include <visp/vpMath.h>
#include <visp/vpRotationMatrix.h>
#include <visp/vpRxyzVector.h>
int main()
{
// Initialise the Euler angles
rxyz[0] = vpMath::rad( 45.f); // phi angle in rad around x axis
rxyz[1] = vpMath::rad(-30.f); // theta angle in rad around y axis
rxyz[2] = vpMath::rad( 90.f); // psi angle in rad around z axis
// Construct a rotation matrix from the Euler angles
// Extract the Euler angles around x,y,z axis from a rotation matrix
rxyz.buildFrom(R);
// Print the extracted Euler angles. Values are the same than the
// one used for initialization
std::cout << rxyz;
// Since the rotation vector is 3 values column vector, the
// transpose operation produce a row vector.
vpRowVector rxyz_t = rxyz.t();
// Print the transpose row vector
std::cout << rxyz_t << std::endl;
}
Examples:
AROgreBasic.cpp, exponentialMap.cpp, HelloWorldOgre.cpp, manGeometricFeatures.cpp, servoAfma6FourPoints2DCamVelocityInteractionCurrent.cpp, servoAfma6FourPoints2DCamVelocityInteractionDesired.cpp, servoViper650FourPoints2DArtVelocityInteractionCurrent.cpp, servoViper650FourPoints2DCamVelocityInteractionCurrent.cpp, servoViper850FourPoints2DArtVelocityInteractionCurrent.cpp, servoViper850FourPoints2DCamVelocityInteractionCurrent.cpp, servoViper850FourPointsKinect.cpp, testRobotAfma6Pose.cpp, testRobotViper850Pose.cpp, testTwistMatrix.cpp, and tutorial-ibvs-4pts-wireframe-robot-viper.cpp.

Definition at line 152 of file vpRxyzVector.h.

Constructor & Destructor Documentation

vpRxyzVector::vpRxyzVector ( )
inline

Default constructor that initialize all the angles to zero.

Definition at line 159 of file vpRxyzVector.h.

vpRxyzVector::vpRxyzVector ( const vpRxyzVector rxyz)
inline

Copy constructor.

Definition at line 161 of file vpRxyzVector.h.

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

Constructor from 3 angles (in radian).

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

Definition at line 169 of file vpRxyzVector.h.

References vpRotationVector::r.

vpRxyzVector::vpRxyzVector ( const vpRotationMatrix R)

Constructor that initialize $R_{xyz}=(\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 vpRxyzVector.cpp.

References buildFrom().

vpRxyzVector::vpRxyzVector ( const vpThetaUVector tu)

Constructor that initialize $R_{xyz}=(\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 vpRxyzVector.cpp.

References buildFrom().

Member Function Documentation

vpRxyzVector vpRxyzVector::buildFrom ( const vpRotationMatrix R)

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

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

Definition at line 83 of file vpRxyzVector.cpp.

References vpRotationVector::r.

vpRxyzVector vpRxyzVector::buildFrom ( const vpThetaUVector tu)

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

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

Definition at line 163 of file vpRxyzVector.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.

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 154 of file vpRxyzVector.h.

friend class vpThetaUVector
friend

Definition at line 155 of file vpRxyzVector.h.

Member Data Documentation

unsigned int vpRotationVector::_size
protectedinherited