Visual Servoing Platform  version 3.6.1 under development (2024-11-21)
vpForceTwistMatrix Class Reference

#include <visp3/core/vpForceTwistMatrix.h>

+ Inheritance diagram for vpForceTwistMatrix:

Public Member Functions

 vpForceTwistMatrix ()
 
 vpForceTwistMatrix (const vpForceTwistMatrix &F)
 
VP_EXPLICIT vpForceTwistMatrix (const vpHomogeneousMatrix &M, bool full=true)
 
 vpForceTwistMatrix (const vpTranslationVector &t, const vpRotationMatrix &R)
 
 vpForceTwistMatrix (const vpTranslationVector &t, const vpThetaUVector &thetau)
 
 vpForceTwistMatrix (double tx, double ty, double tz, double tux, double tuy, double tuz)
 
VP_EXPLICIT vpForceTwistMatrix (const vpRotationMatrix &R)
 
VP_EXPLICIT vpForceTwistMatrix (const vpThetaUVector &thetau)
 
vpForceTwistMatrixbuildFrom (const vpTranslationVector &t, const vpRotationMatrix &R)
 
vpForceTwistMatrixbuildFrom (const vpTranslationVector &t, const vpThetaUVector &thetau)
 
vpForceTwistMatrixbuildFrom (const vpHomogeneousMatrix &M, bool full=true)
 
vpForceTwistMatrixbuildFrom (const vpRotationMatrix &R)
 
vpForceTwistMatrixbuildFrom (const vpThetaUVector &thetau)
 
void eye ()
 
vpForceTwistMatrix operator* (const vpForceTwistMatrix &F) const
 
vpMatrix operator* (const vpMatrix &M) const
 
vpColVector operator* (const vpColVector &H) const
 
vpForceTwistMatrixoperator= (const vpForceTwistMatrix &H)
 
int print (std::ostream &s, unsigned int length, char const *intro=nullptr) const
 
void resize (unsigned int nrows, unsigned int ncols, bool flagNullify=true)
 
Inherited functionalities from vpArray2D
unsigned int getCols () const
 
double getMaxValue () const
 
double getMinValue () const
 
unsigned int getRows () const
 
unsigned int size () const
 
void resize (unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
 
void reshape (unsigned int nrows, unsigned int ncols)
 
void insert (const vpArray2D< double > &A, unsigned int r, unsigned int c)
 
bool operator== (const vpArray2D< double > &A) const
 
bool operator!= (const vpArray2D< double > &A) const
 
double * operator[] (unsigned int i)
 
double * operator[] (unsigned int i) const
 
vpArray2D< double > hadamard (const vpArray2D< double > &m) const
 
vpArray2D< double > t () const
 

Public Attributes

double * data
 

Related Functions

(Note that these are not member functions.)

enum  vpGEMMmethod
 
bool operator== (const vpArray2D< double > &A) const
 
bool operator== (const vpArray2D< float > &A) const
 
bool operator!= (const vpArray2D< double > &A) const
 
void vpGEMM (const vpArray2D< double > &A, const vpArray2D< double > &B, const double &alpha, const vpArray2D< double > &C, const double &beta, vpArray2D< double > &D, const unsigned int &ops=0)
 

Inherited I/O from vpArray2D with Static Public Member Functions

vpArray2D< double > insert (const vpArray2D< double > &A, const vpArray2D< double > &B, unsigned int r, unsigned int c)
 
static void insert (const vpArray2D< double > &A, const vpArray2D< double > &B, vpArray2D< double > &C, unsigned int r, unsigned int c)
 
unsigned int rowNum
 
unsigned int colNum
 
double ** rowPtrs
 
unsigned int dsize
 
static bool load (const std::string &filename, vpArray2D< double > &A, bool binary=false, char *header=nullptr)
 
static bool loadYAML (const std::string &filename, vpArray2D< double > &A, char *header=nullptr)
 
static bool save (const std::string &filename, const vpArray2D< double > &A, bool binary=false, const char *header="")
 
static bool saveYAML (const std::string &filename, const vpArray2D< double > &A, const char *header="")
 
static vpArray2D< double > conv2 (const vpArray2D< double > &M, const vpArray2D< double > &kernel, const std::string &mode)
 
static void conv2 (const vpArray2D< double > &M, const vpArray2D< double > &kernel, vpArray2D< double > &res, const std::string &mode)
 

Detailed Description

This class derived from vpArray2D<double> implements the 6 by 6 matrix which transforms force/torque from one frame to another. This matrix is also called force/torque twist transformation matrix.

The full force/torque twist transformation matrix allows to compute the force/torque at point a expressed in frame a knowing its force/torque at point b expressed in frame b. This matrix is defined as:

\[ ^a{\bf F}_b = \left[ \begin{array}{cc} ^a{\bf R}_b & {\bf 0}_{3\times 3}\\ {[^a{\bf t}_b]}_{\times} \; ^a{\bf R}_b & ^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.

There are different ways to initialize such a full force/torque twist matrix. The following example shows how to proceed setting the translation and rotation matrix transformations:

#include <visp3/core/vpForceTwistMatrix.h>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
int main()
{
vpTranslationVector stp(0.1, 0.2, 0.3);
vpRotationMatrix sRp( {0, 0, -1,
0, -1, 0,
-1, 0, 0} );
vpForceTwistMatrix sFp(stp, sRp);
std::cout << "sFp:\n" << sFp << std::endl;
}
Implementation of a rotation matrix and operations on such kind of matrices.
Class that consider the case of a translation vector.

It produces the following printings:

sFp:
0 0 -1 0 0 0
0 -1 0 0 0 0
-1 0 0 0 0 0
-0.2 0.3 0 0 0 -1
0.1 0 -0.3 0 -1 0
0 -0.1 0.2 -1 0 0

When the point where the velocity is expressed doesn't change, the matrix becomes block diagonal. It allows than to compute the force/torque at point b expressed in frame a knowing its force/torque at point b expressed in frame b :

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

To initialize such a force/torque twist matrix where translation is not taken into account you can proceed like in the following code:

#include <visp3/core/vpForceTwistMatrix.h>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
int main()
{
vpRotationMatrix sRp( {0, 0, -1,
0, -1, 0,
-1, 0, 0} );
std::cout << "sFp:\n" << sFp << std::endl;
}

It produces the following printings:

sFp:
0 0 -1 0 0 0
0 -1 0 0 0 0
-1 0 0 0 0 0
0 0 0 0 0 -1
0 0 0 0 -1 0
0 0 0 -1 0 0

The code belows shows for example how to convert a force/torque skew from probe frame to a sensor frame.

#include <visp3/core/vpColVector.h>
#include <visp3/core/vpForceTwistMatrix.h>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
int main()
{
// Twist transformation matrix from sensor to probe frame
// Force/torque sensor frame to probe frame transformation
// ... sMp need here to be initialized
sFp.buildFrom(sMp);
// Force/torque skew in the probe frame: fx,fy,fz,tx,ty,tz
vpColVector p_H(6);
// ... p_H should here have an initial value
// Force/torque skew in the sensor frame: fx,fy,fz,tx,ty,tz
vpColVector s_H(6);
// Compute the value of the force/torque in the sensor frame
s_H = sFp * p_H;
}
Implementation of column vector and the associated operations.
Definition: vpColVector.h:191
vpForceTwistMatrix & buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)
Implementation of an homogeneous matrix and operations on such kind of matrices.
Examples
perfMatrixMultiplication.cpp, and testVirtuoseHapticBox.cpp.

Definition at line 181 of file vpForceTwistMatrix.h.

Constructor & Destructor Documentation

◆ vpForceTwistMatrix() [1/8]

vpForceTwistMatrix::vpForceTwistMatrix ( )

Initialize a force/torque twist transformation matrix to identity.

Definition at line 89 of file vpForceTwistMatrix.cpp.

References eye().

◆ vpForceTwistMatrix() [2/8]

vpForceTwistMatrix::vpForceTwistMatrix ( const vpForceTwistMatrix F)

Initialize a force/torque twist transformation matrix from another force/torque twist matrix.

Parameters
F: Force/torque twist matrix used as initializer.

Definition at line 98 of file vpForceTwistMatrix.cpp.

◆ vpForceTwistMatrix() [3/8]

vpForceTwistMatrix::vpForceTwistMatrix ( const vpHomogeneousMatrix M,
bool  full = true 
)

Initialize a force/torque 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 $\bf M$ used to initialize the twist transformation matrix.
full: Boolean used to indicate which matrix should be filled.
  • When set to true, use the complete force/torque skew transformation:

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

  • When set to false, use the block diagonal velocity skew transformation:

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

Definition at line 129 of file vpForceTwistMatrix.cpp.

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

◆ vpForceTwistMatrix() [4/8]

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

Initialize a force/torque twist transformation matrix from a translation vector t and a rotation matrix R.

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

Parameters
t: Translation vector.
R: Rotation matrix.

Definition at line 202 of file vpForceTwistMatrix.cpp.

References buildFrom(), and vpArray2D< double >::t().

◆ vpForceTwistMatrix() [5/8]

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

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

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

Parameters
t: Translation vector.
thetau: $\theta u$ rotation vector used to initialize $R$.

Definition at line 158 of file vpForceTwistMatrix.cpp.

References buildFrom(), and vpArray2D< double >::t().

◆ vpForceTwistMatrix() [6/8]

vpForceTwistMatrix::vpForceTwistMatrix ( double  tx,
double  ty,
double  tz,
double  tux,
double  tuy,
double  tuz 
)

Initialize a force/torque 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.

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

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

Definition at line 247 of file vpForceTwistMatrix.cpp.

References buildFrom().

◆ vpForceTwistMatrix() [7/8]

vpForceTwistMatrix::vpForceTwistMatrix ( const vpRotationMatrix R)

Initialize a force/torque block diagonal twist transformation matrix from a rotation matrix R.

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

Parameters
R: Rotation matrix.

Definition at line 225 of file vpForceTwistMatrix.cpp.

References buildFrom().

◆ vpForceTwistMatrix() [8/8]

vpForceTwistMatrix::vpForceTwistMatrix ( const vpThetaUVector thetau)

Initialize a force/torque block diagonal twist transformation matrix from a rotation vector with $\theta u $ parametrization.

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

Parameters
thetau: $\theta u$ rotation vector used to initialize $R$.

Definition at line 181 of file vpForceTwistMatrix.cpp.

References buildFrom().

Member Function Documentation

◆ buildFrom() [1/5]

vpForceTwistMatrix & vpForceTwistMatrix::buildFrom ( const vpHomogeneousMatrix M,
bool  full = true 
)

Initialize a force/torque 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.
full: Boolean used to indicate which matrix should be filled.
  • When set to true, use the complete force/torque skew transformation:

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

  • When set to false, use the block diagonal velocity skew transformation:

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

Definition at line 529 of file vpForceTwistMatrix.cpp.

References buildFrom(), vpHomogeneousMatrix::getRotationMatrix(), and vpHomogeneousMatrix::getTranslationVector().

◆ buildFrom() [2/5]

vpForceTwistMatrix & vpForceTwistMatrix::buildFrom ( const vpRotationMatrix R)

Build a block diagonal force/torque twist transformation matrix from a rotation matrix R.

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

Parameters
R: Rotation matrix.

Definition at line 441 of file vpForceTwistMatrix.cpp.

◆ buildFrom() [3/5]

vpForceTwistMatrix & vpForceTwistMatrix::buildFrom ( const vpThetaUVector thetau)

Initialize a force/torque block diagonal twist transformation matrix from a rotation vector with $\theta u $ parametrization.

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

Parameters
thetau: $\theta {\bf u}$ rotation vector used to initialise $\bf R $.

Definition at line 496 of file vpForceTwistMatrix.cpp.

References buildFrom().

◆ buildFrom() [4/5]

vpForceTwistMatrix & vpForceTwistMatrix::buildFrom ( const vpTranslationVector t,
const vpRotationMatrix R 
)

Build a force/torque twist transformation matrix from a translation vector t and a rotation matrix R.

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

Parameters
t: Translation vector.
R: Rotation matrix.

Definition at line 410 of file vpForceTwistMatrix.cpp.

References vpArray2D< double >::t().

Referenced by buildFrom(), and vpForceTwistMatrix().

◆ buildFrom() [5/5]

vpForceTwistMatrix & vpForceTwistMatrix::buildFrom ( const vpTranslationVector tv,
const vpThetaUVector thetau 
)

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

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

Parameters
tv: Translation vector.
thetau: $\theta {\bf u}$ rotation vector used to initialise $\bf R $.

Definition at line 473 of file vpForceTwistMatrix.cpp.

References buildFrom().

◆ conv2() [1/2]

vpArray2D< double > vpArray2D< double >::conv2 ( const vpArray2D< Type > &  M,
const vpArray2D< Type > &  kernel,
const std::string &  mode 
)
staticinherited

Perform a 2D convolution similar to Matlab conv2 function: $ M \star kernel $.

Parameters
M: First matrix.
kernel: Second matrix.
mode: Convolution mode: "full" (default), "same", "valid".
Convolution mode: full, same, valid (image credit: Theano doc).
Note
This is a very basic implementation that does not use FFT.

Definition at line 1053 of file vpArray2D.h.

◆ conv2() [2/2]

void vpArray2D< double >::conv2 ( const vpArray2D< Type > &  M,
const vpArray2D< Type > &  kernel,
vpArray2D< Type > &  res,
const std::string &  mode 
)
staticinherited

Perform a 2D convolution similar to Matlab conv2 function: $ M \star kernel $.

Parameters
M: First array.
kernel: Second array.
res: Result.
mode: Convolution mode: "full" (default), "same", "valid".
Convolution mode: full, same, valid (image credit: Theano doc).
Note
This is a very basic implementation that does not use FFT.

Definition at line 1067 of file vpArray2D.h.

◆ eye()

void vpForceTwistMatrix::eye ( )

Initialize the force/torque 6 by 6 twist matrix to identity.

Definition at line 71 of file vpForceTwistMatrix.cpp.

Referenced by vpForceTwistMatrix().

◆ getCols()

◆ getMaxValue()

double vpArray2D< double >::getMaxValue
inherited

Return the array max value.

Examples
servoMomentImage.cpp.

Definition at line 339 of file vpArray2D.h.

◆ getMinValue()

double vpArray2D< double >::getMinValue
inherited

Return the array min value.

Examples
servoMomentImage.cpp.

Definition at line 341 of file vpArray2D.h.

◆ getRows()

◆ hadamard()

vpArray2D< double > vpArray2D< double >::hadamard ( const vpArray2D< Type > &  m) const
inherited

Compute the Hadamard product (element wise matrix multiplication).

Parameters
m: Second matrix;
Returns
m1.hadamard(m2) The Hadamard product : $ m1 \circ m2 = (m1 \circ m2)_{i,j} = (m1)_{i,j} (m2)_{i,j} $

Definition at line 641 of file vpArray2D.h.

◆ insert() [1/2]

vpArray2D< double > vpArray2D< double >::insert ( const vpArray2D< Type > &  A,
const vpArray2D< Type > &  B,
unsigned int  r,
unsigned int  c 
)
inherited

Insert array B in array A at the given position.

Parameters
A: Main array.
B: Array to insert.
r: Index of the row where to add the array.
c: Index of the column where to add the array.
Returns
Array with B insert in A.
Warning
Throw exception if the sizes of the arrays do not allow the insertion.

Definition at line 1081 of file vpArray2D.h.

◆ insert() [2/2]

void vpArray2D< double >::insert ( const vpArray2D< Type > &  A,
unsigned int  r,
unsigned int  c 
)
inlineinherited

Insert array A at the given position in the current array.

Warning
Throw vpException::dimensionError if the dimensions of the matrices do not allow the operation.
Parameters
A: The array to insert.
r: The index of the row to begin to insert data.
c: The index of the column to begin to insert data.

Definition at line 497 of file vpArray2D.h.

◆ load()

static bool vpArray2D< double >::load ( const std::string &  filename,
vpArray2D< Type > &  A,
bool  binary = false,
char *  header = nullptr 
)
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 669 of file vpArray2D.h.

◆ loadYAML()

static bool vpArray2D< double >::loadYAML ( const std::string &  filename,
vpArray2D< Type > &  A,
char *  header = nullptr 
)
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()
Examples
servoFlirPtuIBVS.cpp, servoFrankaIBVS.cpp, servoFrankaPBVS.cpp, servoUniversalRobotsIBVS.cpp, servoUniversalRobotsPBVS.cpp, tutorial-flir-ptu-ibvs.cpp, tutorial-hsv-segmentation-pcl-viewer.cpp, tutorial-hsv-segmentation-pcl.cpp, and tutorial-hsv-segmentation.cpp.

Definition at line 783 of file vpArray2D.h.

◆ operator!=()

bool operator!= ( const vpArray2D< Type > &  A) const
inherited

Not equal to comparison operator of a 2D array.

Definition at line 523 of file vpArray2D.h.

◆ operator*() [1/3]

vpColVector vpForceTwistMatrix::operator* ( const vpColVector H) const

Operator that allows to multiply a force/torque skew transformation matrix by a column vector.

Parameters
H: Force/torque skew vector ${\bf H} = [f_x, f_y, f_z, \tau_x, \tau_y, \tau_z] $.

For example, this operator can be used to convert a force/torque skew from sensor frame into the probe frame :

\[{^p}{\bf H}_{p} = {^p}{\bf F}_s \; {^s}{\bf H}_s\]

The example below shows how to handle that transformation.

#include <visp3/core/vpColVector.h>
#include <visp3/core/vpForceTwistMatrix.h>
#include <visp3/robot/vpRobotViper850.h>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
int main()
{
#ifdef VISP_HAVE_VIPER850
vpColVector sH = robot.getForceTorque(); // Get the force/torque measures
// Set the transformation from sensor frame to the probe frame
pMs[2][3] = -0.262; // tz only
// Set the force/torque twist transformation
vpForceTwistMatrix pFs(pMs); // Twist transformation matrix from probe to sensor frame
// Compute the resulting force/torque in the probe frame
vpColVector pH(6); // Force/torque in the probe frame
pH = pFs * sH;
#endif
}
Control of Irisa's Viper S850 robot named Viper850.
Exceptions
vpException::dimensionErrorIf $ \bf H $is not a 6 dimension vector.

Definition at line 369 of file vpForceTwistMatrix.cpp.

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

◆ operator*() [2/3]

vpForceTwistMatrix vpForceTwistMatrix::operator* ( const vpForceTwistMatrix F) const

Operator that allows to multiply a force/torque twist transformation matrix by an other force/torque skew transformation matrix.

#include <visp3/core/vpForceTwistMatrix.h>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
int main()
{
// ... initialize the force/torque twist transformations aFb and bFc
// Compute the force/torque transformation from frame a to c
vpForceTwistMatrix aFc = aFb * bFc;
}

Definition at line 277 of file vpForceTwistMatrix.cpp.

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

◆ operator*() [3/3]

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

Operator that allows to multiply a force/torque skew transformation matrix by a matrix.

Exceptions
vpException::dimensionError: If $\bf M$ is not a 6 rows dimension matrix.

Definition at line 300 of file vpForceTwistMatrix.cpp.

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

◆ operator=()

BEGIN_VISP_NAMESPACE vpForceTwistMatrix & vpForceTwistMatrix::operator= ( const vpForceTwistMatrix M)

Copy operator.

Parameters
M: Force/torque twist matrix to copy.

Definition at line 57 of file vpForceTwistMatrix.cpp.

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

◆ operator==()

bool vpArray2D< double >::operator== ( const vpArray2D< Type > &  A) const
inherited

Equal to comparison operator of a 2D array.

Definition at line 519 of file vpArray2D.h.

◆ operator[]() [1/2]

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

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

Definition at line 605 of file vpArray2D.h.

◆ operator[]() [2/2]

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

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

Definition at line 607 of file vpArray2D.h.

◆ print()

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

Pretty print a force/torque 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 accommodate 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 <<(ostream &s,const vpMatrix &m)

Definition at line 560 of file vpForceTwistMatrix.cpp.

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

◆ reshape()

void vpArray2D< double >::reshape ( unsigned int  nrows,
unsigned int  ncols 
)
inlineinherited
Examples
testMatrixInitialization.cpp.

Definition at line 456 of file vpArray2D.h.

◆ resize() [1/2]

void vpForceTwistMatrix::resize ( unsigned int  nrows,
unsigned int  ncols,
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 225 of file vpForceTwistMatrix.h.

References vpException::fatalError.

◆ resize() [2/2]

void vpArray2D< double >::resize ( unsigned int  nrows,
unsigned int  ncols,
bool  flagNullify = true,
bool  recopy_ = true 
)
inlineinherited

Set the size of the array and initialize all the values to zero.

Parameters
nrows: number of rows.
ncols: number of column.
flagNullify: if true, then the array is re-initialized to 0 after resize. If false, the initial values from the common part of the array (common part between old and new version of the array) are kept. Default value is true.
recopy_: if true, will perform an explicit recopy of the old data.
Examples
catchArray2D.cpp, catchJsonArrayConversion.cpp, catchParticleFilter.cpp, perfMatrixMultiplication.cpp, perfMatrixTranspose.cpp, testMatrix.cpp, testMatrixDeterminant.cpp, testMatrixInverse.cpp, testMatrixPseudoInverse.cpp, and testSvd.cpp.

Definition at line 362 of file vpArray2D.h.

◆ save()

static bool vpArray2D< double >::save ( const std::string &  filename,
const vpArray2D< Type > &  A,
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 874 of file vpArray2D.h.

◆ saveYAML()

static bool vpArray2D< double >::saveYAML ( const std::string &  filename,
const vpArray2D< Type > &  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");
static bool saveYAML(const std::string &filename, const vpArray2D< Type > &A, const char *header="")
Definition: vpArray2D.h:972

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]
double * data
Address of the first element of the data array.
Definition: vpArray2D.h:148

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 972 of file vpArray2D.h.

◆ size()

◆ t()

vpArray2D< double > vpArray2D< double >::t
inherited

Compute the transpose of the array.

Returns
vpArray2D<Type> C = A^T

Definition at line 648 of file vpArray2D.h.

Friends And Related Function Documentation

◆ insert()

void vpArray2D< double >::insert ( const vpArray2D< Type > &  A,
const vpArray2D< Type > &  B,
vpArray2D< Type > &  C,
unsigned int  r,
unsigned int  c 
)
related

Insert array B in array A at the given position.

Parameters
A: Main array.
B: Array to insert.
C: Result array.
r: Index of the row where to insert array B.
c: Index of the column where to insert array B.
Warning
Throw exception if the sizes of the arrays do not allow the insertion.

Definition at line 1096 of file vpArray2D.h.

◆ operator!=()

bool operator!= ( const vpArray2D< double > &  A) const
related

Definition at line 1351 of file vpArray2D.h.

◆ operator==() [1/2]

bool operator== ( const vpArray2D< double > &  A) const
related

Definition at line 1313 of file vpArray2D.h.

◆ operator==() [2/2]

bool operator== ( const vpArray2D< float > &  A) const
related

Definition at line 1332 of file vpArray2D.h.

◆ vpGEMM()

void vpGEMM ( const vpArray2D< double > &  A,
const vpArray2D< double > &  B,
const double &  alpha,
const vpArray2D< double > &  C,
const double &  beta,
vpArray2D< double > &  D,
const unsigned int &  ops = 0 
)
related

This function performs generalized matrix multiplication: D = alpha*op(A)*op(B) + beta*op(C), where op(X) is X or X^T. Operation on A, B and C matrices is described by enumeration vpGEMMmethod().

For example, to compute D = alpha*A^T*B^T+beta*C we need to call :

vpGEMM(A, B, alpha, C, beta, D, VP_GEMM_A_T + VP_GEMM_B_T);
void vpGEMM(const vpArray2D< double > &A, const vpArray2D< double > &B, const double &alpha, const vpArray2D< double > &C, const double &beta, vpArray2D< double > &D, const unsigned int &ops=0)
Definition: vpGEMM.h:414

If C is not used, vpGEMM must be called using an empty array null. Thus to compute D = alpha*A^T*B, we have to call:

vpGEMM(A, B, alpha, null, 0, D, VP_GEMM_B_T);
Exceptions
vpException::incorrectMatrixSizeErrorif the sizes of the matrices do not allow the operations.
Parameters
A: An array that could be a vpMatrix.
B: An array that could be a vpMatrix.
alpha: A scalar.
C: An array that could be a vpMatrix.
beta: A scalar.
D: The resulting array that could be a vpMatrix.
ops: A scalar describing operation applied on the matrices. Possible values are the one defined in vpGEMMmethod(): VP_GEMM_A_T, VP_GEMM_B_T, VP_GEMM_C_T.

Definition at line 414 of file vpGEMM.h.

◆ vpGEMMmethod

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 53 of file vpGEMM.h.

Member Data Documentation

◆ colNum

unsigned int vpArray2D< double >::colNum
protectedinherited

Number of columns in the array.

Definition at line 1103 of file vpArray2D.h.

◆ data

◆ dsize

unsigned int vpArray2D< double >::dsize
protectedinherited

Current array size (rowNum * colNum)

Definition at line 1107 of file vpArray2D.h.

◆ rowNum

unsigned int vpArray2D< double >::rowNum
protectedinherited

Number of rows in the array.

Definition at line 1101 of file vpArray2D.h.

◆ rowPtrs

double ** vpArray2D< double >::rowPtrs
protectedinherited

Address of the first element of each rows.

Definition at line 1105 of file vpArray2D.h.