ForceTwistMatrix¶
- class ForceTwistMatrix(*args, **kwargs)¶
Bases:
ArrayDouble2D
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:
\[\begin{split}^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] \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 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; }
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 :
\[\begin{split}^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] \end{split}\]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} ); vpForceTwistMatrix sFp(sRp); 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 vpForceTwistMatrix sFp; // Force/torque sensor frame to probe frame transformation vpHomogeneousMatrix sMp; // ... 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; }
Overloaded function.
__init__(self: visp._visp.core.ForceTwistMatrix) -> None
Initialize a force/torque twist transformation matrix to identity.
__init__(self: visp._visp.core.ForceTwistMatrix, F: visp._visp.core.ForceTwistMatrix) -> None
Initialize a force/torque twist transformation matrix from another force/torque twist matrix.
- Parameters:
- F
Force/torque twist matrix used as initializer.
__init__(self: visp._visp.core.ForceTwistMatrix, M: visp._visp.core.HomogeneousMatrix, full: bool = true) -> None
__init__(self: visp._visp.core.ForceTwistMatrix, t: visp._visp.core.TranslationVector, R: visp._visp.core.RotationMatrix) -> None
Initialize a force/torque twist transformation matrix from a translation vector t and a rotation matrix R .
\[\begin{split}{\bf F} = \left[ \begin{array}{cc} {\bf R} & {\bf 0}_{3 \times 3} \\{[{\bf t}]}_{\times} \; {\bf R} & {\bf R} \end{array} \right] \end{split}\]- Parameters:
- t
Translation vector.
- R
Rotation matrix.
__init__(self: visp._visp.core.ForceTwistMatrix, t: visp._visp.core.TranslationVector, thetau: visp._visp.core.ThetaUVector) -> None
Initialize a force/torque twist transformation matrix from a translation vector t and a rotation vector with \(\theta u\) parametrization.
\[\begin{split}{\bf F} = \left[ \begin{array}{cc} {\bf R} & {\bf 0}_{3 \times 3} \\{[{\bf t}]}_{\times} \; {\bf R} & {\bf R} \end{array} \right] \end{split}\]- Parameters:
- t
Translation vector.
- thetau
math:theta u rotation vector used to initialize \(R\) .
__init__(self: visp._visp.core.ForceTwistMatrix, tx: float, ty: float, tz: float, tux: float, tuy: float, tuz: float) -> None
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.
\[\begin{split}{\bf F} = \left[ \begin{array}{cc} {\bf R} & {\bf 0}_{3 \times 3} \\{[{\bf t}]}_{\times} \; {\bf R} & {\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\) .
__init__(self: visp._visp.core.ForceTwistMatrix, R: visp._visp.core.RotationMatrix) -> None
__init__(self: visp._visp.core.ForceTwistMatrix, thetau: visp._visp.core.ThetaUVector) -> None
Methods
Overloaded function.
Overloaded function.
Initialize the force/torque 6 by 6 twist matrix to identity.
Pretty print a force/torque twist matrix.
Overloaded function.
Inherited Methods
Numpy view of the underlying array data.
Overloaded function.
Return the number of elements of the 2D array.
Return the number of rows of the 2D array.
Return the number of columns of the 2D array.
Overloaded function.
Overloaded function.
Operators
__doc__
Overloaded function.
__module__
Overloaded function.
Attributes
__annotations__
- __eq__(*args, **kwargs)¶
Overloaded function.
__eq__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool
__eq__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool
__eq__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool
- __getitem__(*args, **kwargs)¶
Overloaded function.
__getitem__(self: visp._visp.core.ArrayDouble2D, arg0: tuple[int, int]) -> float
__getitem__(self: visp._visp.core.ArrayDouble2D, arg0: int) -> numpy.ndarray[numpy.float64]
__getitem__(self: visp._visp.core.ArrayDouble2D, arg0: slice) -> numpy.ndarray[numpy.float64]
__getitem__(self: visp._visp.core.ArrayDouble2D, arg0: tuple) -> numpy.ndarray[numpy.float64]
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: visp._visp.core.ForceTwistMatrix) -> None
Initialize a force/torque twist transformation matrix to identity.
__init__(self: visp._visp.core.ForceTwistMatrix, F: visp._visp.core.ForceTwistMatrix) -> None
Initialize a force/torque twist transformation matrix from another force/torque twist matrix.
- Parameters:
- F
Force/torque twist matrix used as initializer.
__init__(self: visp._visp.core.ForceTwistMatrix, M: visp._visp.core.HomogeneousMatrix, full: bool = true) -> None
__init__(self: visp._visp.core.ForceTwistMatrix, t: visp._visp.core.TranslationVector, R: visp._visp.core.RotationMatrix) -> None
Initialize a force/torque twist transformation matrix from a translation vector t and a rotation matrix R .
\[\begin{split}{\bf F} = \left[ \begin{array}{cc} {\bf R} & {\bf 0}_{3 \times 3} \\{[{\bf t}]}_{\times} \; {\bf R} & {\bf R} \end{array} \right] \end{split}\]- Parameters:
- t
Translation vector.
- R
Rotation matrix.
__init__(self: visp._visp.core.ForceTwistMatrix, t: visp._visp.core.TranslationVector, thetau: visp._visp.core.ThetaUVector) -> None
Initialize a force/torque twist transformation matrix from a translation vector t and a rotation vector with \(\theta u\) parametrization.
\[\begin{split}{\bf F} = \left[ \begin{array}{cc} {\bf R} & {\bf 0}_{3 \times 3} \\{[{\bf t}]}_{\times} \; {\bf R} & {\bf R} \end{array} \right] \end{split}\]- Parameters:
- t
Translation vector.
- thetau
math:theta u rotation vector used to initialize \(R\) .
__init__(self: visp._visp.core.ForceTwistMatrix, tx: float, ty: float, tz: float, tux: float, tuy: float, tuz: float) -> None
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.
\[\begin{split}{\bf F} = \left[ \begin{array}{cc} {\bf R} & {\bf 0}_{3 \times 3} \\{[{\bf t}]}_{\times} \; {\bf R} & {\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\) .
__init__(self: visp._visp.core.ForceTwistMatrix, R: visp._visp.core.RotationMatrix) -> None
__init__(self: visp._visp.core.ForceTwistMatrix, thetau: visp._visp.core.ThetaUVector) -> None
- __mul__(*args, **kwargs)¶
Overloaded function.
__mul__(self: visp._visp.core.ForceTwistMatrix, F: visp._visp.core.ForceTwistMatrix) -> visp._visp.core.ForceTwistMatrix
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() { vpForceTwistMatrix aFb, bFc; // ... initialize the force/torque twist transformations aFb and bFc // Compute the force/torque transformation from frame a to c vpForceTwistMatrix aFc = aFb * bFc; }
__mul__(self: visp._visp.core.ForceTwistMatrix, M: visp._visp.core.Matrix) -> visp._visp.core.Matrix
Operator that allows to multiply a force/torque skew transformation matrix by a matrix.
__mul__(self: visp._visp.core.ForceTwistMatrix, H: visp._visp.core.ColVector) -> visp._visp.core.ColVector
Operator that allows to multiply a force/torque skew transformation matrix by a column vector.
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 vpRobotViper850 robot; vpColVector sH = robot.getForceTorque(); // Get the force/torque measures // Set the transformation from sensor frame to the probe frame vpHomogeneousMatrix pMs; 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 }
- Parameters:
- H
Force/torque skew vector \({\bf H} = [f_x, f_y, f_z, \tau_x, \tau_y, \tau_z]\) .
- __ne__(*args, **kwargs)¶
Overloaded function.
__ne__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool
__ne__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool
__ne__(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D) -> bool
- __setitem__(*args, **kwargs)¶
Overloaded function.
__setitem__(self: visp._visp.core.ArrayDouble2D, arg0: tuple[int, int], arg1: float) -> None
__setitem__(self: visp._visp.core.ArrayDouble2D, arg0: int, arg1: float) -> None
__setitem__(self: visp._visp.core.ArrayDouble2D, arg0: slice, arg1: float) -> None
__setitem__(self: visp._visp.core.ArrayDouble2D, arg0: tuple[slice, slice], arg1: float) -> None
__setitem__(self: visp._visp.core.ArrayDouble2D, arg0: int, arg1: numpy.ndarray[numpy.float64]) -> None
__setitem__(self: visp._visp.core.ArrayDouble2D, arg0: slice, arg1: numpy.ndarray[numpy.float64]) -> None
- buildFrom(*args, **kwargs)¶
Overloaded function.
buildFrom(self: visp._visp.core.ForceTwistMatrix, t: visp._visp.core.TranslationVector, R: visp._visp.core.RotationMatrix) -> visp._visp.core.ForceTwistMatrix
Build a force/torque twist transformation matrix from a translation vector t and a rotation matrix R .
\[\begin{split}{\bf F} = \left[ \begin{array}{cc} {\bf R} & {\bf 0}_{3 \times 3} \\{[{\bf t}]}_{\times} \; {\bf R} & {\bf R} \end{array} \right] \end{split}\]- Parameters:
- t
Translation vector.
- R
Rotation matrix.
buildFrom(self: visp._visp.core.ForceTwistMatrix, t: visp._visp.core.TranslationVector, thetau: visp._visp.core.ThetaUVector) -> visp._visp.core.ForceTwistMatrix
Initialize a force/torque twist transformation matrix from a translation vector t and a rotation vector with \(\theta u\) parametrization.
\[\begin{split}{\bf F} = \left[ \begin{array}{cc} {\bf R} & {\bf 0}_{3 \times 3} \\{[{\bf t}]}_{\times} \; {\bf R} & {\bf R} \end{array} \right] \end{split}\]- Parameters:
- thetau
math:theta {bf u} rotation vector used to initialise \(\bf R\) .
buildFrom(self: visp._visp.core.ForceTwistMatrix, M: visp._visp.core.HomogeneousMatrix, full: bool = true) -> visp._visp.core.ForceTwistMatrix
Initialize a force/torque 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 force/torque skew transformation:
\[\begin{split}{\bf F} = \left[ \begin{array}{cc} {\bf R} & {\bf 0}_{3 \times 3} \\{[{\bf t}]}_{\times} \; {\bf R} & {\bf R} \end{array} \right] \end{split}\]When set to false, use the block diagonal velocity skew transformation:
\[\begin{split}{\bf F} = \left[ \begin{array}{cc} {\bf R} & {\bf 0}_{3 \times 3} \\{{\bf 0}_{3 \times 3}} & {\bf R} \end{array} \right]\end{split}\]
buildFrom(self: visp._visp.core.ForceTwistMatrix, R: visp._visp.core.RotationMatrix) -> visp._visp.core.ForceTwistMatrix
Build a block diagonal force/torque twist transformation matrix from a rotation matrix R .
\[\begin{split}{\bf F} = \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.
buildFrom(self: visp._visp.core.ForceTwistMatrix, thetau: visp._visp.core.ThetaUVector) -> visp._visp.core.ForceTwistMatrix
Initialize a force/torque block diagonal twist transformation matrix from a rotation vector with \(\theta u\) parametrization.
\[\begin{split}{\bf F} = \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 initialise \(\bf R\) .
- static conv2(*args, **kwargs)¶
Overloaded function.
conv2(M: visp._visp.core.ArrayDouble2D, kernel: visp._visp.core.ArrayDouble2D, mode: str) -> visp._visp.core.ArrayDouble2D
conv2(M: visp._visp.core.ArrayDouble2D, kernel: visp._visp.core.ArrayDouble2D, res: visp._visp.core.ArrayDouble2D, mode: str) -> None
conv2(M: visp._visp.core.ArrayDouble2D, kernel: visp._visp.core.ArrayDouble2D, mode: str) -> visp._visp.core.ArrayDouble2D
conv2(M: visp._visp.core.ArrayDouble2D, kernel: visp._visp.core.ArrayDouble2D, res: visp._visp.core.ArrayDouble2D, mode: str) -> None
- hadamard(self, m: visp._visp.core.ArrayDouble2D) visp._visp.core.ArrayDouble2D ¶
- insert(*args, **kwargs)¶
Overloaded function.
insert(self: visp._visp.core.ArrayDouble2D, A: visp._visp.core.ArrayDouble2D, r: int, c: int) -> None
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._visp.core.ArrayDouble2D, B: visp._visp.core.ArrayDouble2D, C: visp._visp.core.ArrayDouble2D, r: int, c: int) None ¶
- 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.ForceTwistMatrix, s: std::ostream, length: int, intro: str = None) int ¶
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.
Note
See std::ostream &operator <<(ostream &s,const vpMatrix &m)
- 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
- resize(*args, **kwargs)¶
Overloaded function.
resize(self: visp._visp.core.ForceTwistMatrix, 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.
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.
save(filename: str, A: visp._visp.core.ArrayDouble2D, binary: bool = false, header: str = ) -> bool
save(filename: str, A: visp._visp.core.ArrayDouble2D, binary: bool = false, header: str = ) -> bool
save(filename: str, A: visp._visp.core.ArrayDouble2D, binary: bool = false, header: str = ) -> bool
- t(self) visp._visp.core.ArrayDouble2D ¶
-
__hash__ =
None
¶