RoboDK API - Documentation
Mat Class Reference

TheMatclass represents a 4x4 pose matrix. The main purpose of this object is to represent a pose in the 3D space (position and orientation). In other words, a pose is a 4x4 matrix that represents the position and orientation of one reference frame with respect to another one, in the 3D space. Poses are commonly used in robotics to place objects, reference frames and targets with respect to each other.
\( transl(x,y,z) rotx(r) roty(p) rotz(w) = \\ \begin{bmatrix} n_x & o_x & a_x & x \\ n_y & o_y & a_y & y \\ n_z & o_z & a_z & z \\ 0 & 0 & 0 & 1 \end{bmatrix} \).More...

#include <robodk_api.h>

Inheritance diagram for Mat:

Public Member Functions

Mat()
Create the identity matrix.
Mat(bool valid)
Create a valid or an invalid matrix.
Mat(const QMatrix4x4 &matrix)
Create a copy of the matrix.
Mat(constMat&matrix)
Create a copy of the matrix.More...
Mat(double nx, double ox, double ax, double tx, double ny, double oy, double ay, double ty, double nz, double oz, double az, double tz)
Matrix class constructor for a 4x4 homogeneous matrix given N, O, A & T vectorsMore...
Mat(const double values[16])
创建一个给定一个dimensiona homogeneoux矩阵l 16-value array (doubles)More...
Mat(const float values[16])
创建一个给定一个dimensiona homogeneoux矩阵l 16-value array (floats)More...
operator QString() const
To String operator (use with qDebug() <<tJoints;.
void setVX(double x, double y, double z)
Set the X vector values (N vector)
void setVY(double x, double y, double z)
Set the Y vector values (O vector)
void setVZ(double x, double y, double z)
Set the Z vector values (A vector)
void setPos(double x, double y, double z)
Set the position (T position) in mm.
void setVX(double xyz[3])
Set the X vector values (N vector)
void setVY(double xyz[3])
Set the Y vector values (O vector)
void setVZ(double xyz[3])
Set the Z vector values (A vector)
void setPos(double xyz[3])
Set the position (T position) in mm.
void VX(tXYZxyz) const
Get the X vector (N vector)
void VY(tXYZxyz) const
Get the Y vector (O vector)
void VZ(tXYZxyz) const
Get the Z vector (A vector)
void Pos(tXYZxyz) const
Get the position (T position), in mm.
void Set(int r, int c, double value)
Set a matrix value.More...
double Get(int r, int c) const
Get a matrix value.More...
Mat inv() const
Invert the pose (homogeneous matrix assumed)
bool isHomogeneous() const
Returns true if the matrix is homogeneous, otherwise it returns false.
bool MakeHomogeneous()
Forces 4x4 matrix to be homogeneous (vx,vy,vz must be unitary vectors and respect: vx x vy = vz). Returns True if the matrix was not homogeneous and it was be modified to make it homogeneous.
void ToXYZRPW(tXYZWPRxyzwpr) const
Calculates the equivalent position and euler angles ([x,y,z,r,p,w] vector) of the given pose Note: transl(x,y,z)*rotz(w*pi/180)*roty(p*pi/180)*rotx(r*pi/180) See also:FromXYZRPW()More...
QString ToString(const QString &separator=", ", int precision=3, bool xyzwpr_only=false) const
Retrieve a string representation of the pose.More...
bool FromString(const QString &str)
Set the matrix given a XYZRPW string array (6-values)
void FromXYZRPW(tXYZWPRxyzwpr)
Calculates the pose from the position and euler angles ([x,y,z,r,p,w] vector) The result is the same as:
H = transl(x,y,z)*rotz(w*pi/180)*roty(p*pi/180)*rotx(r*pi/180)More...
const double * ValuesD() const
Get a pointer to the 16-digit double array.
const float * ValuesF() const
Get a pointer to the 16-digit array as an array of floats.
const double * Values() const
Get a pointer to the 16-digit array (doubles or floats if ROBODK_API_FLOATS is defined).
void Values(double values[16]) const
4 x4矩阵的16个值复制到做uble array.
void Values(float values[16]) const
4 x4矩阵的16个值复制到做uble array.
bool Valid() const
Check if the matrix is valid.

Static Public Member Functions

staticMat XYZRPW_2_Mat(double x, double y, double z, double r, double p, double w)
Calculates the pose from the position and euler angles ([x,y,z,r,p,w] vector) The result is the same as:
H = transl(x,y,z)*rotz(w*pi/180)*roty(p*pi/180)*rotx(r*pi/180)More...
staticMat XYZRPW_2_Mat(tXYZWPRxyzwpr)
staticMat transl(double x, double y, double z)
Return a translation matrix.More...
staticMat rotx(double rx)
Return the X-axis rotation matrix.More...
staticMat roty(double ry)
Return a Y-axis rotation matrixMore...
staticMat rotz(double rz)
Return a Z-axis rotation matrix.More...

Private Attributes

bool _valid
Flags if a matrix is not valid.
double _ddata16[16]
Copy of the data as a double array.

Detailed Description

TheMatclass represents a 4x4 pose matrix. The main purpose of this object is to represent a pose in the 3D space (position and orientation). In other words, a pose is a 4x4 matrix that represents the position and orientation of one reference frame with respect to another one, in the 3D space. Poses are commonly used in robotics to place objects, reference frames and targets with respect to each other.
\( transl(x,y,z) rotx(r) roty(p) rotz(w) = \\ \begin{bmatrix} n_x & o_x & a_x & x \\ n_y & o_y & a_y & y \\ n_z & o_z & a_z & z \\ 0 & 0 & 0 & 1 \end{bmatrix} \).

Definition at line506of filerobodk_api.h.

Constructor & Destructor Documentation

Mat()[1/4]

Mat ( constMat& matrix )

Create a copy of the matrix.

Parameters
matrix

Definition at line202of filerobodk_api.cpp.

Mat()[2/4]

Mat ( double nx,
double ox,
double ax,
double tx,
double ny,
double oy,
double ay,
double ty,
double nz,
double oz,
double az,
double tz
)

Matrix class constructor for a 4x4 homogeneous matrix given N, O, A & T vectors

Parameters
nx Matrix[0,0]
ox Matrix[0,1]
ax Matrix[0,2]
tx Matrix[0,3]
ny Matrix[1,0]
oy Matrix[1,1]
ay Matrix[1,2]
ty Matrix[1,3]
nz Matrix[2,0]
oz Matrix[2,1]
az Matrix[2,2]
tz Matrix[2,3]
Returns
\( \begin{bmatrix} n_x & o_x & a_x & x \\ n_y & o_y & a_y & y \\ n_z & o_z & a_z & z \\ 0 & 0 & 0 & 1 \end{bmatrix} \)

Definition at line207of filerobodk_api.cpp.

Mat()[3/4]

Mat ( const double values[16] )

创建一个给定一个dimensiona homogeneoux矩阵l 16-value array (doubles)

Parameters
values [nx,ny,nz,0, ox,oy,oz,0, ax,ay,az,0, tx,ty,tz,1]
Returns
\( \begin{bmatrix} n_x & o_x & a_x & x \\ n_y & o_y & a_y & y \\ n_z & o_z & a_z & z \\ 0 & 0 & 0 & 1 \end{bmatrix} \)

Definition at line212of filerobodk_api.cpp.

Mat()[4/4]

Mat ( const float values[16] )

创建一个给定一个dimensiona homogeneoux矩阵l 16-value array (floats)

Parameters
values [nx,ny,nz,0, ox,oy,oz,0, ax,ay,az,0, tx,ty,tz,1]
Returns
\( transl(x,y,z) rotx(r) roty(p) rotz(w) = \\ \begin{bmatrix} n_x & o_x & a_x & x \\ n_y & o_y & a_y & y \\ n_z & o_z & a_z & z \\ 0 & 0 & 0 & 1 \end{bmatrix} \)

Definition at line217of filerobodk_api.cpp.

Member Function Documentation

FromXYZRPW()

void FromXYZRPW ( tXYZWPR xyzwpr )

Calculates the pose from the position and euler angles ([x,y,z,r,p,w] vector) The result is the same as:
H = transl(x,y,z)*rotz(w*pi/180)*roty(p*pi/180)*rotx(r*pi/180)

Returns
Homogeneous matrix (4x4)

Definition at line480of filerobodk_api.cpp.

Get()

double Get ( int r,
int c
) const

Get a matrix value.

Parameters
r row
c column
Returns
value

Definition at line302of filerobodk_api.cpp.

rotx()

Matrotx ( double rx )
static

Return the X-axis rotation matrix.

Parameters
rx Rotation around X axis (in radians).
Returns
\( rotx(\theta) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & c_\theta & -s_\theta & 0 \\ 0 & s_\theta & c_\theta & 0 \\ 0 & 0 & 0 & 1 \\ \end{bmatrix} \)

Definition at line534of filerobodk_api.cpp.

roty()

Matroty ( double ry )
static

Return a Y-axis rotation matrix

Parameters
ry Rotation around Y axis (in radians)
Returns
\( roty(\theta) = \begin{bmatrix} c_\theta & 0 & s_\theta & 0 \\ 0 & 1 & 0 & 0 \\ -s_\theta & 0 & c_\theta & 0 \\ 0 & 0 & 0 & 1 \\ \end{bmatrix} \)

Definition at line540of filerobodk_api.cpp.

rotz()

Matrotz ( double rz )
static

Return a Z-axis rotation matrix.

Parameters
rz Rotation around Z axis (in radians)
Returns
\( rotz(\theta) = \begin{bmatrix} c_\theta & -s_\theta & 0 & 0 \\ s_\theta & c_\theta & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{bmatrix} \)

Definition at line546of filerobodk_api.cpp.

设置()

void Set ( int r,
int c,
double value
)

Set a matrix value.

Parameters
r row
c column
value value

Definition at line293of filerobodk_api.cpp.

ToString()

QString ToString ( const QString & separator=", ",
int precision=3,
bool xyzwpr_only=false
) const

Retrieve a string representation of the pose.

Parameters
separator String separator
precision Number of decimals
xyzwpr_only if set to true (default) the pose will be represented as XYZWPR 6-dimensional array using ToXYZRPW, if set to false, it will include information about the pose
Returns

Definition at line408of filerobodk_api.cpp.

ToXYZRPW()

void ToXYZRPW ( tXYZWPR xyzwpr ) const

Calculates the equivalent position and euler angles ([x,y,z,r,p,w] vector) of the given pose Note: transl(x,y,z)*rotz(w*pi/180)*roty(p*pi/180)*rotx(r*pi/180) See also:FromXYZRPW()

Returns
XYZWPR translation and rotation in mm and degrees

Definition at line382of filerobodk_api.cpp.

transl()

Mattransl ( double x,
double y,
double z
)
static

Return a translation matrix.

Parameters
x translation along X (mm)
y translation along Y (mm)
z translation along Z (mm)
Returns
\( rotx(\theta) = \begin{bmatrix} 1 & 0 & 0 & x \\ 0 & 1 & 0 & y \\ 0 & 0 & 1 & z \\ 0 & 0 & 0 & 1 \\ \end{bmatrix} \)

Definition at line527of filerobodk_api.cpp.

XYZRPW_2_Mat()

MatXYZRPW_2_Mat ( double x,
double y,
double z,
double r,
double p,
double w
)
static

Calculates the pose from the position and euler angles ([x,y,z,r,p,w] vector) The result is the same as:
H = transl(x,y,z)*rotz(w*pi/180)*roty(p*pi/180)*rotx(r*pi/180)

Returns
Homogeneous matrix (4x4)

Definition at line464of filerobodk_api.cpp.


The documentation for this class was generated from the following files: