Visual Servoing Platform  version 3.0.0
vpVelocityTwistMatrix Class Reference

#include <visp3/core/vpVelocityTwistMatrix.h>

+ Inheritance diagram for vpVelocityTwistMatrix:

Public Member Functions

 vpVelocityTwistMatrix ()
 
 vpVelocityTwistMatrix (const vpVelocityTwistMatrix &V)
 
 vpVelocityTwistMatrix (const vpHomogeneousMatrix &M)
 
 vpVelocityTwistMatrix (const vpTranslationVector &t, const vpThetaUVector &thetau)
 
 vpVelocityTwistMatrix (const vpTranslationVector &t, const vpRotationMatrix &R)
 
 vpVelocityTwistMatrix (const double tx, const double ty, const double tz, const double tux, const double tuy, const double tuz)
 
virtual ~vpVelocityTwistMatrix ()
 
vpVelocityTwistMatrix buildFrom (const vpTranslationVector &t, const vpRotationMatrix &R)
 
vpVelocityTwistMatrix buildFrom (const vpTranslationVector &t, const vpThetaUVector &thetau)
 
vpVelocityTwistMatrix buildFrom (const vpHomogeneousMatrix &M)
 
void extract (vpRotationMatrix &R) const
 
void extract (vpTranslationVector &t) const
 
void eye ()
 
vpVelocityTwistMatrix inverse () const
 
void inverse (vpVelocityTwistMatrix &V) const
 
vpVelocityTwistMatrix operator* (const vpVelocityTwistMatrix &V) const
 
vpMatrix operator* (const vpMatrix &M) const
 
vpColVector operator* (const vpColVector &v) const
 
vpVelocityTwistMatrixoperator= (const vpVelocityTwistMatrix &V)
 
int print (std::ostream &s, unsigned int length, char const *intro=0) const
 
void resize (const unsigned int nrows, const unsigned int ncols, const bool flagNullify=true)
 
Deprecated functions
vp_deprecated void init ()
 
vp_deprecated void setIdentity ()
 
Inherited functionalities from vpArray2D
double getMinValue () const
 
double getMaxValue () const
 
unsigned int getRows () const
 
unsigned int getCols () const
 
unsigned int size () const
 
double * operator[] (unsigned int i)
 
double * operator[] (unsigned int i) const
 

Static Public Member Functions

Inherited I/O from vpArray2D with Static Public Member Functions
static bool load (const std::string &filename, vpArray2D< double > &A, const bool binary=false, char *header=NULL)
 
static bool loadYAML (const std::string &filename, vpArray2D< double > &A, char *header=NULL)
 
static bool save (const std::string &filename, const vpArray2D< double > &A, const bool binary=false, const char *header="")
 
static bool saveYAML (const std::string &filename, const vpArray2D< double > &A, const char *header="")
 

Public Attributes

double * data
 

Protected Attributes

unsigned int rowNum
 
unsigned int colNum
 
double ** rowPtrs
 
unsigned int dsize
 

Friends

class vpMatrix
 

Related Functions

(Note that these are not member functions.)

enum  vpGEMMmethod
 

Detailed Description

Implementation of a velocity twist matrix and operations on such kind of matrices.

Class that consider the particular case of twist transformation matrix that allows to transform a velocity skew from one frame to an other.

The vpVelocityTwistMatrix class is derived from vpArray2D<double>.

A twist transformation matrix is a 6x6 matrix that express a velocity in frame a knowing velocity in b. This matrix is defined as:

\[ ^a{\bf V}_b = \left[\begin{array}{cc} ^a{\bf R}_b & [^a{\bf t}_b]_\times \; ^a{\bf R}_b\\ {\bf 0}_{3\times 3} & ^a{\bf R}_b \end{array} \right] \]

where $ ^a{\bf R}_b $ is a rotation matrix and $ ^a{\bf t}_b $ is a translation vector.

The vpVelocityTwistMatrix is derived from vpArray2D.

The code belows shows for example how to convert a velocity skew from camera frame to a fix frame.

#include <visp3/core/vpColVector.h>
#include <visp3/core/vpVelocityTwistMatrix.h>
int main()
{
vpVelocityTwistMatrix fVc; // Twist transformation matrix from fix to camera frame
vpHomogeneousMatrix fMc; // Fix to camera frame transformation
// ... fMc need here to be initialized
fVc.buildFrom(fMc);
vpColVector c_v(6); // Velocity in the camera frame: vx,vy,vz,wx,wy,wz
// ... c_v should here have an initial value
vpColVector f_v(6); // Velocity in the fix frame: vx,vy,vz,wx,wy,wz
// Compute the velocity in the fix frame
f_v = fVc * c_v;
}
Examples:
manServo4PointsDisplay.cpp, manSimu4Dots.cpp, manSimu4Points.cpp, servoAfma4Point2DArtVelocity.cpp, servoAfma6FourPoints2DArtVelocity.cpp, servoAfma6Point2DArtVelocity.cpp, servoBiclopsPoint2DArtVelocity.cpp, servoPioneerPanSegment3D.cpp, servoPioneerPoint2DDepth.cpp, servoPioneerPoint2DDepthWithoutVpServo.cpp, servoPtu46Point2DArtVelocity.cpp, servoSimu4Points.cpp, servoSimuCylinder.cpp, servoSimuFourPoints2DCamVelocity.cpp, servoSimuFourPoints2DCamVelocityDisplay.cpp, servoSimuFourPoints2DPolarCamVelocityDisplay.cpp, servoSimuPoint2DCamVelocity2.cpp, servoSimuPoint2DCamVelocity3.cpp, servoSimuSphere.cpp, servoViper650FourPoints2DArtVelocityInteractionCurrent.cpp, servoViper850FourPoints2DArtVelocityInteractionCurrent.cpp, servoViper850FourPoints2DArtVelocityInteractionDesired.cpp, servoViper850Point2DArtVelocity-jointAvoidance-basic.cpp, servoViper850Point2DArtVelocity-jointAvoidance-gpa.cpp, servoViper850Point2DArtVelocity-jointAvoidance-large.cpp, servoViper850Point2DArtVelocity.cpp, simulateFourPoints2DCartesianCamVelocity.cpp, simulateFourPoints2DPolarCamVelocity.cpp, testMatrix.cpp, testTwistMatrix.cpp, tutorial-simu-pioneer-continuous-gain-adaptive.cpp, tutorial-simu-pioneer-continuous-gain-constant.cpp, tutorial-simu-pioneer-pan.cpp, and tutorial-simu-pioneer.cpp.

Definition at line 105 of file vpVelocityTwistMatrix.h.

Constructor & Destructor Documentation

vpVelocityTwistMatrix::vpVelocityTwistMatrix ( )

Initialize a velocity twist transformation matrix as identity.

Definition at line 91 of file vpVelocityTwistMatrix.cpp.

References eye().

vpVelocityTwistMatrix::vpVelocityTwistMatrix ( const vpVelocityTwistMatrix V)

Initialize a velocity twist transformation matrix from another velocity twist matrix.

Parameters
V: Velocity twist matrix used as initializer.

Definition at line 102 of file vpVelocityTwistMatrix.cpp.

vpVelocityTwistMatrix::vpVelocityTwistMatrix ( const vpHomogeneousMatrix M)

Initialize a velocity twist transformation matrix from an homogeneous matrix $M$ with

\[ {\bf M} = \left[\begin{array}{cc} {\bf R} & {\bf t} \\ {\bf 0}_{1\times 3} & 1 \end{array} \right] \]

Parameters
M: Homogeneous matrix $M$ used to initialize the velocity twist transformation matrix.

Definition at line 118 of file vpVelocityTwistMatrix.cpp.

References buildFrom().

vpVelocityTwistMatrix::vpVelocityTwistMatrix ( const vpTranslationVector t,
const vpThetaUVector thetau 
)

Initialize a velocity twist transformation matrix from a translation vector t and a rotation vector with $\theta u $ parametrization.

Parameters
t: Translation vector.
thetau: $\theta u$ rotation vector.

Definition at line 134 of file vpVelocityTwistMatrix.cpp.

References buildFrom().

vpVelocityTwistMatrix::vpVelocityTwistMatrix ( const vpTranslationVector t,
const vpRotationMatrix R 
)

Initialize a velocity twist transformation matrix from a translation vector t and a rotation matrix M.

Parameters
t: Translation vector.
R: Rotation matrix.

Definition at line 151 of file vpVelocityTwistMatrix.cpp.

References buildFrom().

vpVelocityTwistMatrix::vpVelocityTwistMatrix ( const double  tx,
const double  ty,
const double  tz,
const double  tux,
const double  tuy,
const double  tuz 
)

Initialize a velocity twist transformation matrix from a translation vector ${\bf t}=(t_x, t_y, t_z)^T$ and a rotation vector with $\theta {\bf u}=(\theta u_x, \theta u_y, \theta u_z)^T $ parametrization.

Parameters
tx,ty,tz: Translation vector in meters.
tux,tuy,tuz: $\theta {\bf u}$ rotation vector expressed in radians.

Definition at line 168 of file vpVelocityTwistMatrix.cpp.

References buildFrom().

virtual vpVelocityTwistMatrix::~vpVelocityTwistMatrix ( )
inlinevirtual

Destructor.

Definition at line 126 of file vpVelocityTwistMatrix.h.

Member Function Documentation

vpVelocityTwistMatrix vpVelocityTwistMatrix::buildFrom ( const vpTranslationVector t,
const vpThetaUVector thetau 
)

Initialize a velocity twist transformation matrix from a translation vector t and a rotation vector with $\theta u $ parametrization.

Parameters
t: Translation vector.
thetau: $\theta {\bf u}$ rotation vector.

Definition at line 347 of file vpVelocityTwistMatrix.cpp.

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

vpVelocityTwistMatrix vpVelocityTwistMatrix::buildFrom ( const vpHomogeneousMatrix M)

Initialize a velocity twist transformation matrix from an homogeneous matrix $M$ with

\[ {\bf M} = \left[\begin{array}{cc} {\bf R} & {\bf t} \\ {\bf 0}_{1\times 3} & 1 \end{array} \right] \]

Parameters
M: Homogeneous matrix $M$ used to initialize the twist transformation matrix.

Definition at line 368 of file vpVelocityTwistMatrix.cpp.

References buildFrom(), and vpHomogeneousMatrix::extract().

void vpVelocityTwistMatrix::extract ( vpRotationMatrix R) const

Extract the rotation matrix from the velocity twist matrix.

Definition at line 404 of file vpVelocityTwistMatrix.cpp.

Referenced by extract(), and inverse().

void vpVelocityTwistMatrix::extract ( vpTranslationVector t) const

Extract the translation vector from the velocity twist matrix.

Definition at line 413 of file vpVelocityTwistMatrix.cpp.

References extract(), and vpRotationMatrix::t().

void vpVelocityTwistMatrix::eye ( )

Initialize a 6x6 velocity twist matrix as identity.

Definition at line 78 of file vpVelocityTwistMatrix.cpp.

Referenced by setIdentity(), and vpVelocityTwistMatrix().

double vpArray2D< double >::getMaxValue ( ) const
inherited

Return the array max value.

Examples:
servoMomentImage.cpp.
double vpArray2D< double >::getMinValue ( ) const
inherited

Return the array min value.

Examples:
servoMomentImage.cpp.
vp_deprecated void vpVelocityTwistMatrix::init ( )
inline
Deprecated:
Provided only for compat with previous releases. This function does nothing.

Definition at line 175 of file vpVelocityTwistMatrix.h.

vpVelocityTwistMatrix vpVelocityTwistMatrix::inverse ( ) const

Invert the velocity twist matrix.

Definition at line 382 of file vpVelocityTwistMatrix.cpp.

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

Referenced by inverse().

void vpVelocityTwistMatrix::inverse ( vpVelocityTwistMatrix V) const

Invert the velocity twist matrix.

Definition at line 397 of file vpVelocityTwistMatrix.cpp.

References inverse().

static bool vpArray2D< double >::load ( const std::string &  filename,
vpArray2D< double > &  A,
const bool  binary = false,
char *  header = NULL 
)
inlinestaticinherited

Load a matrix from a file.

Parameters
filename: Absolute file name.
A: Array to be loaded
binary: If true the matrix is loaded from a binary file, else from a text file.
header: Header of the file is loaded in this parameter.
Returns
Returns true if success.
See also
save()

Definition at line 308 of file vpArray2D.h.

References vpException::badValue, and vpArray2D< Type >::resize().

static bool vpArray2D< double >::loadYAML ( const std::string &  filename,
vpArray2D< double > &  A,
char *  header = NULL 
)
inlinestaticinherited

Load an array from a YAML-formatted file.

Parameters
filename: absolute file name.
A: array to be loaded from the file.
header: header of the file is loaded in this parameter.
Returns
Returns true on success.
See also
saveYAML()

Definition at line 392 of file vpArray2D.h.

References vpArray2D< Type >::resize().

vpVelocityTwistMatrix vpVelocityTwistMatrix::operator* ( const vpVelocityTwistMatrix V) const

Operator that allows to multiply a velocity twist transformation matrix by an other velocity twist transformation matrix.

Definition at line 200 of file vpVelocityTwistMatrix.cpp.

References vpArray2D< double >::rowPtrs, and vpArray2D< Type >::rowPtrs.

vpMatrix vpVelocityTwistMatrix::operator* ( const vpMatrix M) const

Operator that allows to multiply a velocity twist transformation matrix by a matrix.

As shown in the example below, this operator can be used to compute the corresponding camera velocity skew from the joint velocities knowing the robot jacobian.

#include <visp3/core/vpConfig.h>
#include <visp3/robot/vpSimulatorCamera.h>
#include <visp3/core/vpColVector.h>
#include <visp3/core/vpVelocityTwistMatrix.h>
int main()
{
vpColVector q_vel(6); // Joint velocity on the 6 joints
// ... q_vel need here to be initialized
vpColVector c_v(6); // Velocity in the camera frame: vx,vy,vz,wx,wy,wz
vpVelocityTwistMatrix cVe; // Velocity skew transformation from camera frame to end-effector
robot.get_cVe(cVe);
vpMatrix eJe; // Robot jacobian
robot.get_eJe(eJe);
// Compute the velocity in the camera frame
c_v = cVe * eJe * q_vel;
return 0;
}
Exceptions
vpException::dimensionErrorIf M is not a 6 rows dimension matrix.

Definition at line 252 of file vpVelocityTwistMatrix.cpp.

References vpException::dimensionError, vpArray2D< Type >::getCols(), vpArray2D< Type >::getRows(), and vpArray2D< double >::rowPtrs.

vpColVector vpVelocityTwistMatrix::operator* ( const vpColVector v) const

Operator that allows to multiply a twist transformation matrix by a 6-dimension column vector.

Parameters
v: Velocity skew vector.
Exceptions
vpException::dimensionErrorIf v is not a 6 dimension column vector.

Definition at line 283 of file vpVelocityTwistMatrix.cpp.

References vpException::dimensionError, vpArray2D< Type >::getRows(), and vpArray2D< double >::rowPtrs.

vpVelocityTwistMatrix & vpVelocityTwistMatrix::operator= ( const vpVelocityTwistMatrix V)

Copy operator that allow to set a velocity twist matrix from an other one.

Parameters
V: Velocity twist matrix to copy.

Definition at line 60 of file vpVelocityTwistMatrix.cpp.

References vpArray2D< double >::rowPtrs, and vpArray2D< Type >::rowPtrs.

double * vpArray2D< double >::operator[] ( unsigned int  i)
inlineinherited

Set element $A_{ij} = x$ using A[i][j] = x.

Definition at line 259 of file vpArray2D.h.

double * vpArray2D< double >::operator[] ( unsigned int  i) const
inlineinherited

Get element $x = A_{ij}$ using x = A[i][j].

Definition at line 261 of file vpArray2D.h.

int vpVelocityTwistMatrix::print ( std::ostream &  s,
unsigned int  length,
char const *  intro = 0 
) const

Pretty print a velocity twist matrix. The data are tabulated. The common widths before and after the decimal point are set with respect to the parameter maxlen.

Parameters
sStream used for the printing.
lengthThe suggested width of each matrix element. The actual width grows in order to accomodate the whole integral part, and shrinks if the whole extent is not needed for all the numbers.
introThe introduction which is printed before the matrix. Can be set to zero (or omitted), in which case the introduction is not printed.
Returns
Returns the common total width for all matrix elements
See also
std::ostream &operator<<(std::ostream &s, const vpArray2D<Type> &A)
Examples:
testTwistMatrix.cpp.

Definition at line 447 of file vpVelocityTwistMatrix.cpp.

References vpArray2D< double >::getCols(), vpArray2D< double >::getRows(), and vpMath::maximum().

void vpVelocityTwistMatrix::resize ( const unsigned int  nrows,
const unsigned int  ncols,
const bool  flagNullify = true 
)
inline

This function is not applicable to a velocity twist matrix that is always a 6-by-6 matrix.

Exceptions
vpException::fatalErrorWhen this function is called.

Definition at line 157 of file vpVelocityTwistMatrix.h.

References vpException::fatalError.

static bool vpArray2D< double >::save ( const std::string &  filename,
const vpArray2D< double > &  A,
const bool  binary = false,
const char *  header = "" 
)
inlinestaticinherited

Save a matrix to a file.

Parameters
filename: Absolute file name.
A: Array to be saved.
binary: If true the matrix is saved in a binary file, else a text file.
header: Optional line that will be saved at the beginning of the file.
Returns
Returns true if success.

Warning : If you save the matrix as in a text file the precision is less than if you save it in a binary file.

See also
load()

Definition at line 468 of file vpArray2D.h.

References vpArray2D< Type >::getCols(), and vpArray2D< Type >::getRows().

static bool vpArray2D< double >::saveYAML ( const std::string &  filename,
const vpArray2D< double > &  A,
const char *  header = "" 
)
inlinestaticinherited

Save an array in a YAML-formatted file.

Parameters
filename: absolute file name.
A: array to be saved in the file.
header: optional lines that will be saved at the beginning of the file. Should be YAML-formatted and will adapt to the indentation if any.
Returns
Returns true if success.

Here is an example of outputs.

vpArray2D::saveYAML("matrix.yml", M, "example: a YAML-formatted header");
vpArray2D::saveYAML("matrixIndent.yml", M, "example:\n - a YAML-formatted header\n - with inner indentation");

Content of matrix.yml:

example: a YAML-formatted header
rows: 3
cols: 4
- [0, 0, 0, 0]
- [0, 0, 0, 0]
- [0, 0, 0, 0]

Content of matrixIndent.yml:

example:
- a YAML-formatted header
- with inner indentation
rows: 3
cols: 4
- [0, 0, 0, 0]
- [0, 0, 0, 0]
- [0, 0, 0, 0]
See also
loadYAML()

Definition at line 560 of file vpArray2D.h.

References vpArray2D< Type >::getCols(), and vpArray2D< Type >::getRows().

void vpVelocityTwistMatrix::setIdentity ( )
Deprecated:
You should rather use eye().

Set the velocity twist transformation matrix to identity.

Definition at line 187 of file vpVelocityTwistMatrix.cpp.

References eye().

Friends And Related Function Documentation

enum vpGEMMmethod
related

Enumeration of the operations applied on matrices in vpGEMM() function.

Operations are :

  • VP_GEMM_A_T to use the transpose matrix of A instead of the matrix A
  • VP_GEMM_B_T to use the transpose matrix of B instead of the matrix B
  • VP_GEMM_C_T to use the transpose matrix of C instead of the matrix C

Definition at line 57 of file vpGEMM.h.

friend class vpMatrix
friend

Definition at line 107 of file vpVelocityTwistMatrix.h.

Member Data Documentation

double * vpArray2D< double >::data
inherited

Address of the first element of the data array.

Examples:
testDisplacement.cpp, testMatrix.cpp, testPoseVector.cpp, and testTranslationVector.cpp.

Definition at line 84 of file vpArray2D.h.

Referenced by vpMatrix::AtA(), vpHomogeneousMatrix::buildFrom(), vpRzyxVector::buildFrom(), vpRzyzVector::buildFrom(), vpRxyzVector::buildFrom(), vpThetaUVector::buildFrom(), vpSubColVector::checkParentStatus(), vpSubRowVector::checkParentStatus(), vpSubMatrix::checkParentStatus(), vpColVector::clear(), vpHomogeneousMatrix::convert(), vpTranslationVector::euclideanNorm(), vpRowVector::euclideanNorm(), vpColVector::euclideanNorm(), vpMatrix::euclideanNorm(), vpMatrix::expm(), vpThetaUVector::extract(), vpSubColVector::init(), vpSubRowVector::init(), vpSubMatrix::init(), vpTranslationVector::operator*(), vpRowVector::operator*(), vpColVector::operator*(), vpHomography::operator*(), vpTranslationVector::operator-(), vpRowVector::operator-(), vpColVector::operator-(), vpTranslationVector::operator/(), vpRowVector::operator/(), vpColVector::operator/(), vpHomography::operator/(), vpHomography::operator/=(), vpSubColVector::operator=(), vpSubRowVector::operator=(), vpTranslationVector::operator=(), vpRowVector::operator=(), vpColVector::operator=(), vpRzyxVector::operator=(), vpRzyzVector::operator=(), vpRxyzVector::operator=(), vpMatrix::operator=(), vpThetaUVector::operator=(), vpColVector::operator[](), vpRowVector::reshape(), vpColVector::reshape(), vpQuaternionVector::set(), vpMatrix::stackRows(), vpRotationVector::t(), vpTranslationVector::t(), vpPoseVector::t(), vpRowVector::t(), vpColVector::t(), vpQuaternionVector::w(), vpQuaternionVector::x(), vpQuaternionVector::y(), vpQuaternionVector::z(), vpSubColVector::~vpSubColVector(), vpSubMatrix::~vpSubMatrix(), and vpSubRowVector::~vpSubRowVector().

unsigned int vpArray2D< double >::rowNum
protectedinherited

Number of rows in the array.

Definition at line 74 of file vpArray2D.h.

Referenced by vpMatrix::AAt(), vpMatrix::AtA(), vpColVector::clear(), vpMatrix::diag(), vpMatrix::eigenValues(), vpMatrix::expm(), vpColVector::extract(), vpMatrix::eye(), vpColVector::infinityNorm(), vpMatrix::infinityNorm(), vpSubColVector::init(), vpSubRowVector::init(), vpSubMatrix::init(), vpMatrix::insert(), vpMatrix::inverseByCholesky(), vpMatrix::inverseByLU(), vpMatrix::inverseByQR(), vpRotationMatrix::operator*(), vpTranslationVector::operator*(), vpHomogeneousMatrix::operator*(), vpColVector::operator*(), vpMatrix::operator*(), vpRotationMatrix::operator*=(), vpTranslationVector::operator*=(), vpColVector::operator*=(), vpMatrix::operator*=(), vpColVector::operator+(), vpColVector::operator+=(), vpMatrix::operator+=(), vpColVector::operator-(), vpColVector::operator-=(), vpMatrix::operator-=(), vpColVector::operator/(), vpMatrix::operator/(), vpTranslationVector::operator/=(), vpColVector::operator/=(), vpMatrix::operator/=(), vpMatrix::operator<<(), vpColVector::operator<<(), vpSubColVector::operator=(), vpSubRowVector::operator=(), vpSubMatrix::operator=(), vpTranslationVector::operator=(), vpRowVector::operator=(), vpColVector::operator=(), vpMatrix::operator=(), vpColVector::reshape(), vpMatrix::setIdentity(), vpMatrix::stack(), vpColVector::stack(), vpMatrix::stackColumns(), vpMatrix::stackRows(), vpMatrix::sum(), vpRotationVector::sumSquare(), vpTranslationVector::sumSquare(), vpColVector::sumSquare(), vpMatrix::sumSquare(), vpTranslationVector::t(), vpPoseVector::t(), vpColVector::t(), vpMatrix::t(), and vpMatrix::transpose().