VelocityTwistMatrix

class VelocityTwistMatrix(*args, **kwargs)

Bases: ArrayDouble2D

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

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

\[\begin{split}^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] \end{split}\]

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 velocity twist matrix. The following example shows how to proceed setting the translation and rotation matrix transformations:

#include <visp3/core/vpVelocityTwistMatrix.h>

#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif

int main()
{
  vpTranslationVector cte(0.1, 0.2, 0.3);
  vpRotationMatrix cRe( {0,  0, -1,
                        0, -1,  0,
                        -1,  0,  0} );

  vpVelocityTwistMatrix cVe(cte, cRe);
  std::cout << "cVe:\n" << cVe << std::endl;
}

It produces the following printings:

cVe:
0  0  -1  -0.2  0.3  0
0  -1  0  0.1  0  -0.3
-1  0  0  0  -0.1  0.2
0  0  0  0  0  -1
0  0  0  0  -1  0
0  0  0  -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 velocity at point b expressed in frame a knowing its velocity at point b expressed in frame b :

\[\begin{split}^a{\bf V}_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] \end{split}\]

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

#include <visp3/core/vpVelocityTwistMatrix.h>

#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif

int main()
{
  vpRotationMatrix cRe( {0,  0, -1,
                        0, -1,  0,
                        -1,  0,  0} );

  vpVelocityTwistMatrix cVe(cRe);
  std::cout << "cVe:\n" << cVe << std::endl;
}

It produces the following printings:

cVe:
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 below shows how to convert a velocity skew expressed at the origin of the camera frame into the origin of the fix frame using the full velocity twist matrix.

#include <visp3/core/vpColVector.h>
#include <visp3/core/vpVelocityTwistMatrix.h>

#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif

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;
}

Overloaded function.

  1. __init__(self: visp._visp.core.VelocityTwistMatrix) -> None

Initialize a velocity twist transformation matrix as identity.

  1. __init__(self: visp._visp.core.VelocityTwistMatrix, V: visp._visp.core.VelocityTwistMatrix) -> None

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

Parameters:
V

Velocity twist matrix used as initializer.

  1. __init__(self: visp._visp.core.VelocityTwistMatrix, M: visp._visp.core.HomogeneousMatrix, full: bool = true) -> None

  2. __init__(self: visp._visp.core.VelocityTwistMatrix, t: visp._visp.core.TranslationVector, R: visp._visp.core.RotationMatrix) -> None

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

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

Translation vector.

R

Rotation matrix.

  1. __init__(self: visp._visp.core.VelocityTwistMatrix, t: visp._visp.core.TranslationVector, thetau: visp._visp.core.ThetaUVector) -> None

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

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

Translation vector.

thetau

math:theta u rotation vector used to initialize rotation vector \(R\) .

  1. __init__(self: visp._visp.core.VelocityTwistMatrix, tx: float, ty: float, tz: float, tux: float, tuy: float, tuz: float) -> None

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.

\[\begin{split}{\bf V} = \left[\begin{array}{cc} {\bf R} & [{\bf t}]_\times \; {\bf R} \\{\bf 0}_{3\times 3} & {\bf R} \end{array} \right] \end{split}\]
Parameters:
tx

Translation vector in meters.

ty

Translation vector in meters.

tz

Translation vector in meters.

tux

math:theta {bf u} rotation vector expressed in radians used to initialize \(R\) .

tuy

math:theta {bf u} rotation vector expressed in radians used to initialize \(R\) .

tuz

math:theta {bf u} rotation vector expressed in radians used to initialize \(R\) .

  1. __init__(self: visp._visp.core.VelocityTwistMatrix, R: visp._visp.core.RotationMatrix) -> None

  2. __init__(self: visp._visp.core.VelocityTwistMatrix, thetau: visp._visp.core.ThetaUVector) -> None

Methods

__init__

Overloaded function.

buildFrom

Overloaded function.

extract

Overloaded function.

eye

Initialize a 6x6 velocity twist matrix as identity.

inverse

Overloaded function.

print

Pretty print a velocity twist matrix.

resize

Overloaded function.

Inherited Methods

getMaxValue

insertStatic

size

Return the number of elements of the 2D array.

getRows

Return the number of rows of the 2D array.

t

getCols

Return the number of columns of the 2D array.

insert

Overloaded function.

hadamard

conv2

Overloaded function.

numpy

Numpy view of the underlying array data.

save

Overloaded function.

view

Overloaded function.

saveYAML

getMinValue

reshape

Operators

__doc__

__init__

Overloaded function.

__module__

__mul__

Overloaded function.

Attributes

__annotations__

__hash__

__eq__(*args, **kwargs)

Overloaded function.

  1. __eq__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool

  2. __eq__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool

  3. __eq__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool

__getitem__(*args, **kwargs)

Overloaded function.

  1. __getitem__(self: visp._visp.core.ArrayDouble2D, arg0: tuple[int, int]) -> float

  2. __getitem__(self: visp._visp.core.ArrayDouble2D, arg0: int) -> numpy.ndarray[numpy.float64]

  3. __getitem__(self: visp._visp.core.ArrayDouble2D, arg0: slice) -> numpy.ndarray[numpy.float64]

  4. __getitem__(self: visp._visp.core.ArrayDouble2D, arg0: tuple) -> numpy.ndarray[numpy.float64]

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: visp._visp.core.VelocityTwistMatrix) -> None

Initialize a velocity twist transformation matrix as identity.

  1. __init__(self: visp._visp.core.VelocityTwistMatrix, V: visp._visp.core.VelocityTwistMatrix) -> None

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

Parameters:
V

Velocity twist matrix used as initializer.

  1. __init__(self: visp._visp.core.VelocityTwistMatrix, M: visp._visp.core.HomogeneousMatrix, full: bool = true) -> None

  2. __init__(self: visp._visp.core.VelocityTwistMatrix, t: visp._visp.core.TranslationVector, R: visp._visp.core.RotationMatrix) -> None

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

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

Translation vector.

R

Rotation matrix.

  1. __init__(self: visp._visp.core.VelocityTwistMatrix, t: visp._visp.core.TranslationVector, thetau: visp._visp.core.ThetaUVector) -> None

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

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

Translation vector.

thetau

math:theta u rotation vector used to initialize rotation vector \(R\) .

  1. __init__(self: visp._visp.core.VelocityTwistMatrix, tx: float, ty: float, tz: float, tux: float, tuy: float, tuz: float) -> None

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.

\[\begin{split}{\bf V} = \left[\begin{array}{cc} {\bf R} & [{\bf t}]_\times \; {\bf R} \\{\bf 0}_{3\times 3} & {\bf R} \end{array} \right] \end{split}\]
Parameters:
tx

Translation vector in meters.

ty

Translation vector in meters.

tz

Translation vector in meters.

tux

math:theta {bf u} rotation vector expressed in radians used to initialize \(R\) .

tuy

math:theta {bf u} rotation vector expressed in radians used to initialize \(R\) .

tuz

math:theta {bf u} rotation vector expressed in radians used to initialize \(R\) .

  1. __init__(self: visp._visp.core.VelocityTwistMatrix, R: visp._visp.core.RotationMatrix) -> None

  2. __init__(self: visp._visp.core.VelocityTwistMatrix, thetau: visp._visp.core.ThetaUVector) -> None

__mul__(*args, **kwargs)

Overloaded function.

  1. __mul__(self: visp._visp.core.VelocityTwistMatrix, V: visp._visp.core.VelocityTwistMatrix) -> visp._visp.core.VelocityTwistMatrix

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

  1. __mul__(self: visp._visp.core.VelocityTwistMatrix, M: visp._visp.core.Matrix) -> visp._visp.core.Matrix

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/vpColVector.h>
#include <visp3/core/vpConfig.h>
#include <visp3/core/vpVelocityTwistMatrix.h>
#include <visp3/robot/vpSimulatorCamera.h>

#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif

int main()
{
  vpSimulatorCamera robot;

  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;
}
  1. __mul__(self: visp._visp.core.VelocityTwistMatrix, v: visp._visp.core.ColVector) -> visp._visp.core.ColVector

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

Parameters:
v

Velocity skew vector.

__ne__(*args, **kwargs)

Overloaded function.

  1. __ne__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool

  2. __ne__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool

  3. __ne__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool

__setitem__(*args, **kwargs)

Overloaded function.

  1. __setitem__(self: visp._visp.core.ArrayDouble2D, arg0: tuple[int, int], arg1: float) -> None

  2. __setitem__(self: visp._visp.core.ArrayDouble2D, arg0: int, arg1: float) -> None

  3. __setitem__(self: visp._visp.core.ArrayDouble2D, arg0: slice, arg1: float) -> None

  4. __setitem__(self: visp._visp.core.ArrayDouble2D, arg0: tuple[slice, slice], arg1: float) -> None

  5. __setitem__(self: visp._visp.core.ArrayDouble2D, arg0: int, arg1: numpy.ndarray[numpy.float64]) -> None

  6. __setitem__(self: visp._visp.core.ArrayDouble2D, arg0: slice, arg1: numpy.ndarray[numpy.float64]) -> None

buildFrom(*args, **kwargs)

Overloaded function.

  1. buildFrom(self: visp._visp.core.VelocityTwistMatrix, t: visp._visp.core.TranslationVector, R: visp._visp.core.RotationMatrix) -> visp._visp.core.VelocityTwistMatrix

Build a velocity twist transformation matrix from a translation vector t and a rotation matrix R .

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

Translation vector.

R

Rotation matrix.

  1. buildFrom(self: visp._visp.core.VelocityTwistMatrix, t: visp._visp.core.TranslationVector, thetau: visp._visp.core.ThetaUVector) -> visp._visp.core.VelocityTwistMatrix

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

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

Translation vector.

thetau

math:theta {bf u} rotation vector used to create rotation matrix \({\bf R}\) .

  1. buildFrom(self: visp._visp.core.VelocityTwistMatrix, M: visp._visp.core.HomogeneousMatrix, full: bool = true) -> visp._visp.core.VelocityTwistMatrix

Initialize a velocity twist transformation matrix from an homogeneous matrix \(M\) with

\[\begin{split}{\bf M} = \left[\begin{array}{cc} {\bf R} & {\bf t} \\{\bf 0}_{1\times 3} & 1 \end{array} \right] \end{split}\]
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 velocity skew transformation :

    \[\begin{split}{\bf V} = \left[\begin{array}{cc} {\bf R} & [{\bf t}]_\times \; {\bf R} \\{\bf 0}_{3\times 3} & {\bf R} \end{array} \right] \end{split}\]
  • When set to false, use the block diagonal velocity skew transformation:

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

  1. buildFrom(self: visp._visp.core.VelocityTwistMatrix, R: visp._visp.core.RotationMatrix) -> visp._visp.core.VelocityTwistMatrix

Build a velocity twist transformation block diagonal matrix from a rotation matrix R.

\[\begin{split}{\bf V} = \left[\begin{array}{cc} {\bf R} & {\bf 0}_{3\times 3} \\{\bf 0}_{3\times 3} & {\bf R} \end{array} \right] \end{split}\]
Parameters:
R

Rotation matrix.

  1. buildFrom(self: visp._visp.core.VelocityTwistMatrix, thetau: visp._visp.core.ThetaUVector) -> visp._visp.core.VelocityTwistMatrix

Initialize a velocity twist transformation matrix from a rotation vector with \(\theta u\) parametrization.

\[\begin{split}{\bf V} = \left[\begin{array}{cc} {\bf R} & {\bf 0}_{3\times 3} \\{\bf 0}_{3\times 3} & {\bf R} \end{array} \right] \end{split}\]
Parameters:
thetau

math:theta {bf u} rotation vector used to create rotation matrix \({\bf R}\) .

static conv2(*args, **kwargs)

Overloaded function.

  1. conv2(M: visp._visp.core.ArrayDouble2D, kernel: visp._visp.core.ArrayDouble2D, mode: str) -> visp._visp.core.ArrayDouble2D

  2. conv2(M: visp._visp.core.ArrayDouble2D, kernel: visp._visp.core.ArrayDouble2D, res: visp._visp.core.ArrayDouble2D, mode: str) -> None

  3. conv2(M: visp._visp.core.ArrayDouble2D, kernel: visp._visp.core.ArrayDouble2D, mode: str) -> visp._visp.core.ArrayDouble2D

  4. conv2(M: visp._visp.core.ArrayDouble2D, kernel: visp._visp.core.ArrayDouble2D, res: visp._visp.core.ArrayDouble2D, mode: str) -> None

extract(*args, **kwargs)

Overloaded function.

  1. extract(self: visp._visp.core.VelocityTwistMatrix, R: visp._visp.core.RotationMatrix) -> None

Extract the rotation matrix from the velocity twist matrix.

  1. extract(self: visp._visp.core.VelocityTwistMatrix, t: visp._visp.core.TranslationVector) -> None

Extract the translation vector from the velocity twist matrix.

eye(self) None

Initialize a 6x6 velocity twist matrix as identity.

getCols(self) int

Return the number of columns of the 2D array.

Note

See getRows() , size()

getMaxValue(self) float
getMinValue(self) float
getRows(self) int

Return the number of rows of the 2D array.

Note

See getCols() , size()

hadamard(self, m: visp.core.ArrayDouble2D) visp.core.ArrayDouble2D
insert(*args, **kwargs)

Overloaded function.

  1. insert(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D, r: int, c: int) -> None

  2. insert(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D, B: visp._visp.core.ArrayDouble2D, r: int, c: int) -> visp._visp.core.ArrayDouble2D

static insertStatic(A: visp.core.ArrayDouble2D, B: visp.core.ArrayDouble2D, C: visp.core.ArrayDouble2D, r: int, c: int) None
inverse(*args, **kwargs)

Overloaded function.

  1. inverse(self: visp._visp.core.VelocityTwistMatrix) -> visp._visp.core.VelocityTwistMatrix

Invert the velocity twist matrix.

  1. inverse(self: visp._visp.core.VelocityTwistMatrix, V: visp._visp.core.VelocityTwistMatrix) -> None

Invert the velocity twist matrix.

numpy(self) numpy.ndarray[numpy.float64]

Numpy view of the underlying array data. This numpy view can be used to directly modify the array.

print(self: visp._visp.core.VelocityTwistMatrix, s: std::ostream, length: int, intro: str = 0) int

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.

Note

See std::ostream & operator<<(std::ostream &s, const vpArray2D<Type> &A)

Parameters:
s

Stream used for the printing.

length

The 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.

intro

The 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

reshape(self, nrows: int, ncols: int) None
resize(*args, **kwargs)

Overloaded function.

  1. resize(self: visp._visp.core.VelocityTwistMatrix, nrows: int, ncols: int, flagNullify: bool = true) -> None

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

  1. resize(self: visp._visp.core.ArrayDouble2D, nrows: int, ncols: int, flagNullify: bool = true, recopy_: bool = true) -> None

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.

static save(*args, **kwargs)

Overloaded function.

  1. save(filename: str, A: visp._visp.core.ArrayDouble2D, binary: bool = false, header: str = ) -> bool

  2. save(filename: str, A: visp._visp.core.ArrayDouble2D, binary: bool = false, header: str = ) -> bool

  3. save(filename: str, A: visp._visp.core.ArrayDouble2D, binary: bool = false, header: str = ) -> bool

static saveYAML(filename: str, A: visp._visp.core.ArrayDouble2D, header: str =) bool
size(self) int

Return the number of elements of the 2D array.

t(self) visp.core.ArrayDouble2D
static view(*args, **kwargs)

Overloaded function.

  1. view(A: visp._visp.core.ArrayDouble2D) -> visp._visp.core.ArrayDouble2D

  2. view(np_array: numpy.ndarray[numpy.float64]) -> visp._visp.core.ArrayDouble2D

Construct a 2D ViSP array that is a view of a numpy array. When it is modified, the numpy array is also modified. It cannot be resized.

Parameters:
np_array

The numpy array to copy.

__hash__ = None