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 <robodktypes.h>
Public Member Functions |
|
Mat() | |
Create the identity matrix.More... |
|
Mat(bool valid) | |
Create a valid or an invalid matrix.More... |
|
Mat(const QMatrix4x4 &matrix) | |
Create a copy of the matrix.More... |
|
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]) | |
Create a homogeneoux matrix given a one dimensional 16-value array (doubles)More... |
|
Mat(const float values[16]) | |
Create a homogeneoux matrix given a one dimensional 16-value array (floats)More... |
|
Mat(double x, double y, double z) | |
Create a translation matrix.More... |
|
operator QString() const | |
To String operator (use with qDebug() <<tJoints;.More... |
|
void | setVX(double x, double y, double z) |
Set the X vector values (N vector)More... |
|
void | setVY(double x, double y, double z) |
Set the Y vector values (O vector)More... |
|
void | setVZ(double x, double y, double z) |
设置Z值向量(矢量)More... |
|
void | setPos(double x, double y, double z) |
Set the position (T position) in mm.More... |
|
void | setVX(double xyz[3]) |
Set the X vector values (N vector)More... |
|
void | setVY(double xyz[3]) |
Set the Y vector values (O vector)More... |
|
void | setVZ(double xyz[3]) |
设置Z值向量(矢量)More... |
|
void | setPos(double xyz[3]) |
Set the position (T position) in mm.More... |
|
void | setValues(double pose[16]) |
Set the pose values.More... |
|
void | VX(tXYZ xyz) const |
Get the X vector (N vector)More... |
|
void | VY(tXYZ xyz) const |
Get the Y vector (O vector)More... |
|
void | VZ(tXYZ xyz) const |
Get the Z vector (A vector)More... |
|
void | Pos(tXYZ xyz) const |
Get the position (T position), in mm.More... |
|
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)More... |
|
bool | isHomogeneous() const |
Returns true if the matrix is homogeneous, otherwise it returns false.More... |
|
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.More... |
|
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()More... |
|
QString | ToString(const QString &separator=", ", int precision=3, bool xyzrpw_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)More... |
|
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)More... |
|
const double * | ValuesD() const |
Get a pointer to the 16-digit double array.More... |
|
const float * | ValuesF() const |
Get a pointer to the 16-digit array as an array of floats.More... |
|
const double * | Values() const |
Get a pointer to the 16-digit array (doubles or floats if ROBODK_API_FLOATS is defined).More... |
|
void | Values(double values[16]) const |
有限公司py the 16-values of the 4x4 matrix to a double array.More... |
|
void | Values(float values[16]) const |
有限公司py the 16-values of the 4x4 matrix to a double array.More... |
|
bool | Valid() const |
Check if the matrix is valid.More... |
|
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(tXYZWPR xyzwpr) |
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 |
|
double | _valid |
Flags if a matrix is not valid.More... |
|
double | _ddata16[16] |
有限公司py of the data as a double array.More... |
|
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 line361of filerobodktypes.h.
Mat | ( | ) |
Create the identity matrix.
Definition at line158of filerobodktypes.cpp.
Mat | ( | bool | valid | ) |
Create a valid or an invalid matrix.
Definition at line162of filerobodktypes.cpp.
Mat | ( | const QMatrix4x4 & | matrix | ) |
Create a copy of the matrix.
Definition at line167of filerobodktypes.cpp.
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
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] |
Definition at line176of filerobodktypes.cpp.
Mat | ( | const double | values[16] | ) |
Create a homogeneoux matrix given a one dimensional 16-value array (doubles)
values | [nx,ny,nz,0, ox,oy,oz,0, ax,ay,az,0, tx,ty,tz,1]
|
Definition at line181of filerobodktypes.cpp.
Mat | ( | const float | values[16] | ) |
Create a homogeneoux matrix given a one dimensional 16-value array (floats)
values | [nx,ny,nz,0, ox,oy,oz,0, ax,ay,az,0, tx,ty,tz,1]
|
Definition at line186of filerobodktypes.cpp.
Mat | ( | double | x, |
double | y, | ||
double | z | ||
) |
Create a translation matrix.
x | translation along X (mm) |
y | translation along Y (mm) |
z | translation along Z (mm) |
Definition at line192of filerobodktypes.cpp.
~Mat | ( | ) |
Definition at line199of filerobodktypes.cpp.
bool FromString | ( | const QString & | str | ) |
Set the matrix given a XYZRPW string array (6-values)
Definition at line440of filerobodktypes.cpp.
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)
Definition at line475of filerobodktypes.cpp.
double Get | ( | int | r, |
int | c | ||
) | const |
Get a matrix value.
r | row |
c | column |
Definition at line299of filerobodktypes.cpp.
Matinv | ( | ) | const |
Invert the pose (homogeneous matrix assumed)
Definition at line305of filerobodktypes.cpp.
bool isHomogeneous | ( | ) | const |
Returns true if the matrix is homogeneous, otherwise it returns false.
Definition at line310of filerobodktypes.cpp.
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.
Definition at line351of filerobodktypes.cpp.
|
inline |
To String operator (use with qDebug() <<tJoints;.
Definition at line437of filerobodktypes.h.
void Pos | ( | tXYZ | xyz | ) | const |
Get the position (T position), in mm.
Definition at line218of filerobodktypes.cpp.
|
static |
Return the X-axis rotation matrix.
rx | 周围旋转X axis (in radians). |
Definition at line529of filerobodktypes.cpp.
|
static |
Return a Y-axis rotation matrix
ry | 周围旋转Y axis (in radians) |
Definition at line535of filerobodktypes.cpp.
|
static |
Return a Z-axis rotation matrix.
rz | 周围旋转Z axis (in radians) |
Definition at line541of filerobodktypes.cpp.
void Set | ( | int | r, |
int | c, | ||
double | value | ||
) |
Set a matrix value.
r | row |
c | column |
value | value |
Definition at line290of filerobodktypes.cpp.
void setPos | ( | double | x, |
double | y, | ||
double | z | ||
) |
Set the position (T position) in mm.
Definition at line239of filerobodktypes.cpp.
void setPos | ( | double | xyz[3] | ) |
Set the position (T position) in mm.
Definition at line260of filerobodktypes.cpp.
void setValues | ( | double | pose[16] | ) |
Set the pose values.
Definition at line267of filerobodktypes.cpp.
void setVX | ( | double | x, |
double | y, | ||
double | z | ||
) |
Set the X vector values (N vector)
Definition at line224of filerobodktypes.cpp.
void setVX | ( | double | xyz[3] | ) |
Set the X vector values (N vector)
Definition at line245of filerobodktypes.cpp.
void setVY | ( | double | x, |
double | y, | ||
double | z | ||
) |
Set the Y vector values (O vector)
Definition at line229of filerobodktypes.cpp.
void setVY | ( | double | xyz[3] | ) |
Set the Y vector values (O vector)
Definition at line250of filerobodktypes.cpp.
void setVZ | ( | double | x, |
double | y, | ||
double | z | ||
) |
设置Z值向量(矢量)
Definition at line234of filerobodktypes.cpp.
void setVZ | ( | double | xyz[3] | ) |
设置Z值向量(矢量)
Definition at line255of filerobodktypes.cpp.
QString ToString | ( | const QString & | separator=", " , |
int | precision=3 , |
||
bool | xyzrpw_only=false |
||
) | const |
Retrieve a string representation of the pose.
separator | String separator |
precision | Number of decimals |
in_xyzwpr | if set to true (default), the pose will be represented as XYZWPR 6-dimensional array using ToXYZRPW |
Definition at line405of filerobodktypes.cpp.
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()
Definition at line380of filerobodktypes.cpp.
|
static |
Return a translation matrix.
x | translation along X (mm) |
y | translation along Y (mm) |
z | translation along Z (mm) |
Definition at line522of filerobodktypes.cpp.
bool Valid | ( | ) | const |
Check if the matrix is valid.
Definition at line518of filerobodktypes.cpp.
const double * Values | ( | ) | const |
Get a pointer to the 16-digit array (doubles or floats if ROBODK_API_FLOATS is defined).
Definition at line500of filerobodktypes.cpp.
void Values | ( | double | values[16] | ) | const |
有限公司py the 16-values of the 4x4 matrix to a double array.
Definition at line508of filerobodktypes.cpp.
void Values | ( | float | values[16] | ) | const |
有限公司py the 16-values of the 4x4 matrix to a double array.
Definition at line513of filerobodktypes.cpp.
const双*礼乐祭祀 | ( | ) | const |
Get a pointer to the 16-digit double array.
Definition at line484of filerobodktypes.cpp.
const float * ValuesF | ( | ) | const |
Get a pointer to the 16-digit array as an array of floats.
Definition at line491of filerobodktypes.cpp.
void VX | ( | tXYZ | xyz | ) | const |
Get the X vector (N vector)
Definition at line203of filerobodktypes.cpp.
void VY | ( | tXYZ | xyz | ) | const |
Get the Y vector (O vector)
Definition at line208of filerobodktypes.cpp.
void VZ | ( | tXYZ | xyz | ) | const |
Get the Z vector (A vector)
Definition at line213of filerobodktypes.cpp.
|
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)
Definition at line459of filerobodktypes.cpp.
|
static |
Definition at line471of filerobodktypes.cpp.
|
private |
有限公司py of the data as a double array.
Definition at line622of filerobodktypes.h.
|
private |
Flags if a matrix is not valid.
Definition at line617of filerobodktypes.h.