Robotat Linalg
Loading...
Searching...
No Matches
RobotatRobotics

Robotics algorithms, based on MATLAB Robotics Toolbox of Peter Corke. Includes routines for homogeneous transformations, rotationes matrices and quaternions. More...

Data Structures

struct  rob_frame_t
 Reference frame struct for robot pose calculations. Includes the homogeneous transformation matrix, the corresponding rotation matrix and coordinates vector, the labels or IDs for the frame and the next frame to which the transformation will lead, and the angle units (radians or degrees) to be used. More...
struct  rob_point_t
 Struct for reference points associated with a specific reference frame. Contains the coordinates vector of the points and the label or ID of the associated frame. More...
struct  rob_quat_t
 Quaternion struct to define the scalars of each term of the quaternion. More...

Macros

#define _USE_MATH_DEFINES
#define M_PI   3.14159265358979323846

Enumerations

enum  rob_status_t {
  ROB_MATH_SUCCESS , ROT_SIZE_MISMATCH , TR_SIZE_MISMATCH , VEC_SIZE_MISMATCH ,
  TRANSFORM_FRAMES_MISMATCH , NULL_QUATERNION_ERR
}
 List of possible status or errors. More...
enum  rob_frame_id_t { FRAME_A , FRAME_B , FRAME_C , FRAME_O }
 Enumerates list for reference frames IDs. More frames can be added if needed. More...
enum  rob_angle_sequences_t {
  XYX , XZX , YXY , YZY ,
  ZXZ , ZYZ , XYZ , XZY ,
  YZX , YXZ , ZXY , ZYX
}
 Enumerates list of id for possible rotation sequences to implement. More...

Functions

rob_status_t rob_frame_init (rob_frame_t *p_F, matf32_t *p_T, matf32_t *p_R, matf32_t *p_v, rob_frame_id_t ref_frame, rob_frame_id_t dst_frame, bool angle_units)
 Constructor for the reference frame data structure, defines 4x4 dimensiones, sets the rotation matrix, coordinates vector and creates the homogeneous transformation matrix.
void rob_refpoint_init (rob_point_t *const p_p, matf32_t *p_v, float *p_data, rob_frame_id_t ref_frame)
 Constructor for the reference frame data structure, defines 4x4 dimensiones, sets the rotation matrix, coordinates vector and creates the homogeneous transformation matrix.
rob_status_t rob_transl (matf32_t *p_v, rob_frame_t *p_F)
 Set coordinates vector in the homogeneous transformation matrix.
rob_status_t rob_rotx (matf32_t *p_R, float theta, bool angle_units)
 Generates a rotation matrix in the x axis, defined as follows:
rob_status_t rob_roty (matf32_t *p_R, float theta, bool angle_units)
 Generates rotation in the y axis, defined as follows:
rob_status_t rob_rotz (matf32_t *p_R, float theta, bool angle_units)
 Generates rotation in the z axis, defined as follows:
void rob_trotx (rob_frame_t *p_F, float theta, bool angle_units)
 Generates a rotation matrix around the x axis, using rob_rotx and assigns it to an homogeneous transformation matrix T.
void rob_troty (rob_frame_t *p_F, float theta, bool angle_units)
 Generates a rotation matrix around the y axis, using rob_rotx and assigns it to an homogeneous transformation matrix T.
void rob_trotz (rob_frame_t *p_F, float theta, bool angle_units)
 Generates a rotation matrix around the z axis, using rob_rotx and assigns it to an homogeneous transformation matrix T.
rob_status_t rob_apply_transform (rob_frame_t *p_F, rob_point_t *p_srcp, rob_point_t *p_dstp)
 Applies the homogeneous transformation to calculate the pose. The operation is defined as follows:
void rob_inv_transform (rob_frame_t *const p_F, matf32_t *const p_Tinv)
 Applies inverse of the homogeneous transformation of the pose.
rob_status_t rob_apply_rot_sequence (rob_frame_t *p_F, rob_point_t *p_srcp, rob_point_t *p_dstp, rob_angle_sequences_t angle_sequence, float phi, float theta, float psi, bool angle_units)
 Apply an homogeneous transform based on Euler angles sequences: XYX, XZX, YXY, YZY, ZXZ, ZYZ, or Cardan angles sequences: XYZ, XZY, YXZ, YZX, ZXY, XYZ. All these sequences are available and to select one, it must be introduced in the arguments of the function.
void rob_quat_init (rob_quat_t *p_q, float *q_s, float *q_i, float *q_j, float *q_k)
 Quaternion struct initialization.
void rob_unitquat_init (rob_quat_t *p_uq, float *q_s, float *q_i, float *q_j, float *q_k)
 Quaternion struct initialization.
void rob_quat_add (const rob_quat_t *p_srcq1, const rob_quat_t *p_srcq2, rob_quat_t *p_dstq)
 Add two quaternions.
void rob_quat_sub (const rob_quat_t *p_srcq1, const rob_quat_t *p_srcq2, rob_quat_t *p_dstq)
 Substract two quaternions.
void rob_quat_scale (const rob_quat_t *p_srcq, const float p_c, rob_quat_t *p_dstq)
 Multiplies a quaternion by a scalar.
void rob_quat_mul (const rob_quat_t *p_srcq1, const rob_quat_t *p_srcq2, rob_quat_t *p_dstq)
 Multiplies two quaternions (Hamilton product) of two quaternions.
void rob_quat_conj (const rob_quat_t *p_srcq, rob_quat_t *p_dstq)
 Calculates the conjugate of a quaternion.
void rob_quat_norm (const rob_quat_t *p_srcq, float *q_norm)
 Calculates the norm of a quaternion.
rob_status_t rob_quat_inv (const rob_quat_t *p_srcq, rob_quat_t *p_dstq)
 Calculates the inverse of a quaternion.
rob_status_t rob_quat_apply_transform (rob_quat_t *p_srcq, rob_frame_t *p_F, rob_point_t *p_srcp, rob_point_t *p_dstp)
 Takes a quaternion and makes conversions to then apply it as an homogeneous transformation.
rob_status_t rob_rot2tr (matf32_t *p_R, rob_frame_t *p_F)
 Assigns a rotation matrix to an homogeneous transformation matrix.
rob_status_t rob_tr2rot (rob_frame_t *p_F, matf32_t *p_R)
 Converts an homogeneous transformation matrix to a rotation matrix.
rob_status_t rob_update_transform (rob_frame_t *p_F, matf32_t *p_R, matf32_t *p_v)
 Assigns both a rotation matrix and translation vector to an homogeneous transformation matrix.
rob_status_t rob_rpy2rot (float roll, float pitch, float yaw, rob_angle_sequences_t rot_sequence, bool angle_units, matf32_t *p_R)
 Generates a rotation matrix from Cardan angles, based on their definitions in Craig, Introduction to Robotics.
void rob_rpy2tr (float roll, float pitch, float yaw, rob_angle_sequences_t rot_sequence, bool angle_units, rob_frame_t *p_F)
 Generates an homogeneous transformation from Cardan angles specified in the argument of the function. For that, it first generates a rotation matrix from the Cardan angles, then assigns the rotation matrix to an homogeneous transformation matrix associated to a specific reference frame (the frame must be created beforehand).
rob_status_t rob_eul2rot (float phi, float theta, float psi, rob_angle_sequences_t rot_sequence, bool angle_units, matf32_t *p_R)
 Generates a rotation matrix from Euler angles, based on their definitions in Craig, Introduction to Robotics.
void rob_eul2tr (float phi, float theta, float psi, rob_angle_sequences_t rot_sequence, bool angle_units, rob_frame_t *p_F)
 Generates an homogeneous transformation from Euler angles specified in the argument of the function. For that, it first generates a rotation matrix from the Euler angles, then assigns the rotation matrix to an homogeneous transformation matrix associated to a specific reference frame (the frame must be created beforehand).
rob_status_t rob_rot2quat (matf32_t *p_R, rob_quat_t *p_uq)
 Generates an unitary quaternion from a rotation matrix.
void rob_tr2quat (rob_frame_t *p_F, rob_quat_t *p_uq)
 Generates an unitary quaternion from the homogeneous transformation matrix associated to a specific frame (the frame should be created beforehand). For this, first extracts the rotation matrix from the homogenous transformation matrix (see rob_tr2rot), then converts the rotation matrix to a quaternion (see rob_rot2quat).
rob_status_t rob_rpy2quat (float roll, float pitch, float yaw, rob_angle_sequences_t rot_sequence, bool angle_units, matf32_t *p_R, rob_quat_t *p_uq)
 Generates a unitary quaternion from Cardan angles. For that, first generates a rotation matrix from the Cardan angles (see rob_rpy2rot) and then converts the rotation matrix to a quaternion.
rob_status_t rob_eul2quat (float phi, float theta, float psi, rob_angle_sequences_t rot_sequence, bool angle_units, matf32_t *p_R, rob_quat_t *p_uq)
 Generates a quaternion based on Euler angles. For that, first generates a rotation matrix from the Euler angles, then converts the rotation matrix to a unitary quaternion.
rob_status_t rob_rot2rpy (matf32_t *p_R, bool angle_units, rob_angle_sequences_t rot_sequence, float *roll, float *pitch, float *yaw)
 Generates Cardan angles from a rotation matrix, based on the definitions in Craig, Introduction to Robotics.
void rob_tr2rpy (rob_frame_t *p_F, bool angle_units, rob_angle_sequences_t rot_sequence, float *roll, float *pitch, float *yaw)
 Generates Cardan angles from the homogeneous transformation matrix associated to a reference frame (the frame must be created beforehand). For that, first extracts the rotation matrix from the homogenous transformation matrix (see rob_tr2rot), then converts the rotation matrix to Cardan angles (see rob_rot2rpy).
rob_status_t rob_rot2eul (matf32_t *p_R, bool angle_units, rob_angle_sequences_t rot_sequence, float *phi, float *theta, float *psi)
 Generates Euler angles from a rotation matrix, based on the definitions in Craig, Introduction to Robotics.
void rob_tr2eul (rob_frame_t *p_F, bool angle_units, rob_angle_sequences_t rot_sequence, float *phi, float *theta, float *psi)
 Generates Euler angles from the homogeneous transformation matrix associated to a reference frame (the frame must be created beforehand). For that, first extracts the rotation matrix from the homogenous transformation matrix (see rob_tr2rot), then converts the rotation matrix to Cardan angles (see rob_rot2eul).
rob_status_t rob_quat2rot (rob_quat_t *p_uq, matf32_t *p_R)
 Generates a rotation matrix from an unitary quaternion.
void rob_quat2tr (rob_quat_t *p_uq, rob_frame_t *p_F)
 Generates an homogeneous transformation matrix from an unitary quaternion. For that, first generates a rotation matrix from the quaternion and then assigns the rotation matrix to the homogeneous transformation matrix associated to a reference frame (the frame must exist beforehand).
void rob_quat2rpy (rob_quat_t *p_uq, bool angle_units, rob_angle_sequences_t rot_sequence, float *roll, float *pitch, float *yaw)
 Converts an unitary quaternion to Cardan angles. For that, first generates a rotation matrix from a quaternion (rob_quat2rot), then converts the rotation matrix to Cardan angles (see rob_rot2rpy).
void rob_quat2eul (rob_quat_t *p_uq, bool angle_units, rob_angle_sequences_t rot_sequence, float *phi, float *theta, float *psi)
 Converts an unitary quaternion to Euler angles. For that, first generates a rotation matrix from a quaternion (rob_quat2rot), then converts the rotation matrix to Euler angles (see rob_rot2rpy).
float deg2rad (float *p_theta)
 Converts degrees to radians:
float rad2deg (float *p_theta)
 Converts radians to degrees:
void rob_status_print (rob_status_t rob_status)
 Prints rob_status_t messages.
void rob_frame_print (rob_frame_t *p_F)
 Prints the data in a rob_frame_t struct for reference frames.
void rob_refpoint_print (rob_point_t *const p_p)
 Prints the data in a rob_refpoint_t struct for reference points.
void rob_angle_units_print (bool angle_units)
 Prints angle units (radians or degrees) to be used.
void rob_frame_id_print (rob_frame_id_t id)
 Prints the ID of the reference frame, based on available IDs in rob_frame_id_t.
void rob_quat_print (const rob_quat_t *p_srcq)
 Prints the data of a rob_quat_t struct for quaternions.
bool rob_isrot (matf32_t *p_R)
 Check if a matrix is 3x3, according to the requirement for rotation matrices.
bool rob_istr (matf32_t *p_T)
 Check if a matrix is 4x4, according to the requirement for homogeneous transformation matrices.
bool rob_isvec (matf32_t *p_v)
 Check if a vector has 3 elements, according to the requirement of coordinates vectors to be used in homogeneous transformation matrices.
rob_status_t rob_check_transform_frames (rob_frame_t *p_F, rob_point_t *p_srcp, rob_point_t *p_dstp)
 Checks whether the reference framese to operate are in the correct order, based on their IDs, according to the definnition of the homogeneous transformation (see rob_apply_transform).
bool rob_check_null_quaternion (const rob_quat_t *p_q)
 Checks if a quaternion is zero and returns an rob_status_t message. This is an auxiliary routine meant to prevent division by zero when operating quaterions, for example, is used some other routines of this library.
bool rob_quat_is_equal (rob_quat_t *p_q1, rob_quat_t *p_q2)
 Checks if two quaternions are equal in all their values.

Detailed Description

Robotics algorithms, based on MATLAB Robotics Toolbox of Peter Corke. Includes routines for homogeneous transformations, rotationes matrices and quaternions.

Author
Andrea Pineda
Date
created 19 Jul. 2025, last modified 6 Feb. 2026

Data Structure Documentation

◆ rob_frame_t

struct rob_frame_t

Reference frame struct for robot pose calculations. Includes the homogeneous transformation matrix, the corresponding rotation matrix and coordinates vector, the labels or IDs for the frame and the next frame to which the transformation will lead, and the angle units (radians or degrees) to be used.

An homogeneous transformation matrix is defined as follows:

\[\begin{bmatrix} ^A\textbf{R}_B & \textbf{t} \\ \textbf{0} & 1 \end{bmatrix}, \]

where \(^A\textbf{R}_B\) is the rotation matrix \((3 \times 3)\), \(\textbf{t}\) is the coordinates vector \((3 \times 1)\), and \(\textbf{0}\) is a zeros vector \((1 \times 3)\).

Collaboration diagram for rob_frame_t:
[legend]
Data Fields
bool angle_units

Angle units to be used, choose between RADIANS or DEGREES

rob_frame_id_t dst_frame

Label or ID of the frame to which the transform will lead

matf32_t * p_R

Points to rotation matrix

matf32_t * p_T

Points to homogeneous transformation matrix

matf32_t * p_v

Points to coordinates vector

rob_frame_id_t ref_frame

Label or ID of this reference frame

◆ rob_point_t

struct rob_point_t

Struct for reference points associated with a specific reference frame. Contains the coordinates vector of the points and the label or ID of the associated frame.

The coordinates vector for the reference point is defined as follows:

\[\]

^A\textbf{p} = \begin{bmatrix} \mathrm{x} \ \mathrm{y} \ \mathrm{z} \ 1 \end{bmatrix} \f]

with \( \mathrm{x} \), \( \mathrm{y} \) and \( \mathrm{z} \) being the xyz coordinates, and 1 being an arbitrary value to match the dimensions of the homogeneous transformation matrix.

Collaboration diagram for rob_point_t:
[legend]
Data Fields
matf32_t * p_v

Points to coordinates vector for this reference point

rob_frame_id_t ref_frame

Label or ID for the associated reference frame

◆ rob_quat_t

struct rob_quat_t

Quaternion struct to define the scalars of each term of the quaternion.

A quaternion is a complex number defined as follows:

\[\mathring{q} = s + \textbf{v} \]

where \( \textbf{v} = v_1 \textbf{i} + v_2 \textbf{j} + v_3 \textbf{k} \), with \( v_1 \), \( v_2 \) and \( v_3 \) being scalars accompanied by their respective unitary vectors.

Depending on the notation, in code quaternions are identified as \( \mathrm{q} \) (without the ring or circle above).

Data Fields
float * p_i

Imaginary number i of the quaternion

float * p_j

Imaginary number j of the quaternion

float * p_k

Imaginary number k of the quaternion

float * p_s

Real number s of the quaternion

Macro Definition Documentation

◆ _USE_MATH_DEFINES

#define _USE_MATH_DEFINES

Dependencies

◆ M_PI

#define M_PI   3.14159265358979323846

Enumeration Type Documentation

◆ rob_angle_sequences_t

Enumerates list of id for possible rotation sequences to implement.

Enumerator
XYX 

Euler angles rotation sequence: X-axis -> Y-axis -> X-axis

XZX 

Euler angles rotation sequence: X-axis -> Z-axis -> X-axis

YXY 

Euler angles rotation sequence: Y-axis -> X-axis -> Y-axis

YZY 

Euler angles rotation sequence: Y-axis -> Z-axis -> Y-axis

ZXZ 

Euler angles rotation sequence: Z-axis -> X-axis -> Z-axis

ZYZ 

Euler angles rotation sequence: Z-axis -> Y-axis -> Z-axis

XYZ 

Cardan angles rotation sequence: X-axis -> Y-axis -> Z-axis

XZY 

Cardan angles rotation sequence: X-axis -> Z-axis -> Y-axis

YZX 

Cardan angles rotation sequence: Y-axis -> Z-axis -> X-axis

YXZ 

Cardan angles rotation sequence: Y-axis -> X-axis -> Z-axis

ZXY 

Cardan angles rotation sequence: Z-axis -> X-axis -> Y-axis

ZYX 

Cardan angles rotation sequence: Z-axis -> Y-axis -> X-axis

◆ rob_frame_id_t

Enumerates list for reference frames IDs. More frames can be added if needed.

Enumerator
FRAME_A 

Reference frame A

FRAME_B 

Reference frame B

FRAME_C 

Reference frame C

FRAME_O 

Global reference frame O

◆ rob_status_t

List of possible status or errors.

Enumerator
ROB_MATH_SUCCESS 

Success in the operation

ROT_SIZE_MISMATCH 

Incorrect dimensions for rotation matrix

TR_SIZE_MISMATCH 

Incorrect dimensions for homogeneous transformation matrix

VEC_SIZE_MISMATCH 

Incorrect dimensions for coordinates vector

TRANSFORM_FRAMES_MISMATCH 

Reference frames are not compatible to transform

NULL_QUATERNION_ERR 

Null quaternion detected for operation with division

Function Documentation

◆ deg2rad()

float deg2rad ( float * p_theta)

Converts degrees to radians:

\[ \theta \cdot \frac{\pi}{180} \]

Returns
float

◆ rad2deg()

float rad2deg ( float * p_theta)

Converts radians to degrees:

\[ \theta \cdot \frac{180}{\pi} \]

Returns
float

◆ rob_angle_units_print()

void rob_angle_units_print ( bool angle_units)

Prints angle units (radians or degrees) to be used.

◆ rob_apply_rot_sequence()

rob_status_t rob_apply_rot_sequence ( rob_frame_t * p_F,
rob_point_t * p_srcp,
rob_point_t * p_dstp,
rob_angle_sequences_t angle_sequence,
float phi,
float theta,
float psi,
bool angle_units )

Apply an homogeneous transform based on Euler angles sequences: XYX, XZX, YXY, YZY, ZXZ, ZYZ, or Cardan angles sequences: XYZ, XZY, YXZ, YZX, ZXY, XYZ. All these sequences are available and to select one, it must be introduced in the arguments of the function.

Parameters
[in]p_FPoints to reference frame struct to work with.
[in]p_srcpPointss to reference point for the frame to transform from.
[out]p_dstpPoints to reference point with respect to the new frame.
[in]euler_tagTag to indicate the rotation sequence to apply, for example: XYZ, ZYZ, etc.
Returns
Status check ROB_MATH_SUCCESS : Frame IDs align, operation successful. TRANSFORM_FRAMES_MISMATCH : Frame IDs misalign, cannot apply transformation.
Here is the call graph for this function:

◆ rob_apply_transform()

rob_status_t rob_apply_transform ( rob_frame_t * p_F,
rob_point_t * p_srcp,
rob_point_t * p_dstp )

Applies the homogeneous transformation to calculate the pose. The operation is defined as follows:

\[^Ap = ^AT_B \cdot ^Bp \]

Parameters
[in]p_FPointer to reference frame struct to work with.
[in]p_srcpCoordinates vector with reference to original frame.
[out]p_dstpCoordinates vector to the new frame of reference.
Returns
Status check ROB_MATH_SUCCESS : Frame IDs align, operation successful. TRANSFORM_FRAMES_MISMATCH : Frame IDs misalign, cannot apply transformation.
Here is the call graph for this function:

◆ rob_check_null_quaternion()

bool rob_check_null_quaternion ( const rob_quat_t * p_q)

Checks if a quaternion is zero and returns an rob_status_t message. This is an auxiliary routine meant to prevent division by zero when operating quaterions, for example, is used some other routines of this library.

Parameters
[in]p_qPointer to quaternion or unit quaternion
Returns
None

◆ rob_check_transform_frames()

rob_status_t rob_check_transform_frames ( rob_frame_t * p_F,
rob_point_t * p_srcp,
rob_point_t * p_dstp )

Checks whether the reference framese to operate are in the correct order, based on their IDs, according to the definnition of the homogeneous transformation (see rob_apply_transform).

Parameters
[in]p_FPointer to reference frame structure
[in]p_srcpPoints to original reference point
[in]p_dstpPoints to the new reference point
Returns
None

◆ rob_eul2quat()

rob_status_t rob_eul2quat ( float phi,
float theta,
float psi,
rob_angle_sequences_t rot_sequence,
bool angle_units,
matf32_t * p_R,
rob_quat_t * p_uq )

Generates a quaternion based on Euler angles. For that, first generates a rotation matrix from the Euler angles, then converts the rotation matrix to a unitary quaternion.

Parameters
[in]phiPhi angle
[in]thetaTheta angle
[in]psiPsi angle
[in]rot_sequenceEnumerate element to indicate the rotation sequence
[in]angle_unitsBoolean to indicate radians or degrees
[in]p_RPoints to a rotation matrix
[out]p_uqPoints to a unit quaternion
Returns
None
Here is the call graph for this function:

◆ rob_eul2rot()

rob_status_t rob_eul2rot ( float phi,
float theta,
float psi,
rob_angle_sequences_t rot_sequence,
bool angle_units,
matf32_t * p_R )

Generates a rotation matrix from Euler angles, based on their definitions in Craig, Introduction to Robotics.

Parameters
[in]phiphi angle
[in]thetatheta angle
[in]psipsi angle
[in]rot_sequenceroll-pitch-yaw sequence enum tag
[in]angle_unitsradians or degrees indicator
[in,out]p_Rpointer to reference frame where the rotation matrix is
Returns
None
Here is the call graph for this function:

◆ rob_eul2tr()

void rob_eul2tr ( float phi,
float theta,
float psi,
rob_angle_sequences_t rot_sequence,
bool angle_units,
rob_frame_t * p_F )

Generates an homogeneous transformation from Euler angles specified in the argument of the function. For that, it first generates a rotation matrix from the Euler angles, then assigns the rotation matrix to an homogeneous transformation matrix associated to a specific reference frame (the frame must be created beforehand).

Parameters
[in]phiphi angle
[in]thetatheta angle
[in]psipsi angle
[in]rot_sequenceroll-pitch-yaw sequence enum tag
[in]angle_unitsradians or degrees indicator
[in,out]p_Fpointer reference frame where the rotation matrix is
Returns
None
Here is the call graph for this function:

◆ rob_frame_id_print()

void rob_frame_id_print ( rob_frame_id_t id)

Prints the ID of the reference frame, based on available IDs in rob_frame_id_t.

Parameters
[in]idFrame id enum
Returns
None

◆ rob_frame_init()

rob_status_t rob_frame_init ( rob_frame_t * p_F,
matf32_t * p_T,
matf32_t * p_R,
matf32_t * p_v,
rob_frame_id_t ref_frame,
rob_frame_id_t dst_frame,
bool angle_units )

Constructor for the reference frame data structure, defines 4x4 dimensiones, sets the rotation matrix, coordinates vector and creates the homogeneous transformation matrix.

Parameters
[in]p_TTransformation matrix for the reference frame.
[in]p_RRotation matrix.
[in]p_vCoordinates vector.
[in]ref_frameEnumerate tag for the current reference frame for the transformation.
[in]dst_frameEnumerate tag for the destination frame for the transformation.
[in]angle_unitsEnumerate tag for the units of the angles.
Returns
Execution status
Author
Andrea Pineda
Date
created 19 Jul. 2025, last modified 9 Feb. 2026
Here is the call graph for this function:

◆ rob_frame_print()

void rob_frame_print ( rob_frame_t * p_F)

Prints the data in a rob_frame_t struct for reference frames.

Parameters
[in]p_FPointer to reference matrix.
Returns
None
Here is the call graph for this function:

◆ rob_inv_transform()

void rob_inv_transform ( rob_frame_t *const p_F,
matf32_t *const p_Tinv )

Applies inverse of the homogeneous transformation of the pose.

\[\begin{bmatrix} R^T & -R^T \cdot t \\ 0 & 1 \end{bmatrix} \]

Parameters
[in]p_FPointer to reference frame struct.
[in,out]p_TinvPointer to output matrix to save the inverse.
Returns
None
Here is the call graph for this function:

◆ rob_isrot()

bool rob_isrot ( matf32_t * p_R)

Check if a matrix is 3x3, according to the requirement for rotation matrices.

Parameters
[in]p_RPoints to matrix to be checked (matf32_t matrix, 3,3).
Returns
bool

◆ rob_istr()

bool rob_istr ( matf32_t * p_T)

Check if a matrix is 4x4, according to the requirement for homogeneous transformation matrices.

Parameters
[in]p_TPoints to matrix to be checked (matf32_t matrix, 4x4).
Returns
bool

◆ rob_isvec()

bool rob_isvec ( matf32_t * p_v)

Check if a vector has 3 elements, according to the requirement of coordinates vectors to be used in homogeneous transformation matrices.

Parameters
[in]p_vPoints to vector to be checked (matf32_t matrix, 1x3 or 3x1);
Returns
bool

◆ rob_quat2eul()

void rob_quat2eul ( rob_quat_t * p_uq,
bool angle_units,
rob_angle_sequences_t rot_sequence,
float * phi,
float * theta,
float * psi )

Converts an unitary quaternion to Euler angles. For that, first generates a rotation matrix from a quaternion (rob_quat2rot), then converts the rotation matrix to Euler angles (see rob_rot2rpy).

Parameters
[in]p_uqPoints to unit quaternion
[in]angle_unitsRadians or degrees indicator
[in]rot_sequenceRoll-Pitch-Yaw sequence
[in,out]phiPhi Angle
[in,out]thetaTheta Angle
[in,out]psiPsi Angle
Returns
None
Here is the call graph for this function:

◆ rob_quat2rot()

rob_status_t rob_quat2rot ( rob_quat_t * p_uq,
matf32_t * p_R )

Generates a rotation matrix from an unitary quaternion.

Parameters
[in]p_uqPoints to a unit quaternion
[in,out]p_RPoints to a rotation matrix
Returns
None
Here is the call graph for this function:

◆ rob_quat2rpy()

void rob_quat2rpy ( rob_quat_t * p_uq,
bool angle_units,
rob_angle_sequences_t rot_sequence,
float * roll,
float * pitch,
float * yaw )

Converts an unitary quaternion to Cardan angles. For that, first generates a rotation matrix from a quaternion (rob_quat2rot), then converts the rotation matrix to Cardan angles (see rob_rot2rpy).

Parameters
[in]p_uqPoints to unit quaternion
[in]angle_unitsRadians or degrees indicator
[in]rot_sequenceRoll-Pitch-Yaw sequence
[in,out]rollRoll Angle
[in,out]pitchPitch Angle
[in,out]yawYaw Angle
Returns
None
Here is the call graph for this function:

◆ rob_quat2tr()

void rob_quat2tr ( rob_quat_t * p_uq,
rob_frame_t * p_F )

Generates an homogeneous transformation matrix from an unitary quaternion. For that, first generates a rotation matrix from the quaternion and then assigns the rotation matrix to the homogeneous transformation matrix associated to a reference frame (the frame must exist beforehand).

Parameters
[in]p_uqPoints to a unit quaternion
[in,out]p_FPoints to a reference frame struct
Returns
None
Here is the call graph for this function:

◆ rob_quat_add()

void rob_quat_add ( const rob_quat_t * p_srcq1,
const rob_quat_t * p_srcq2,
rob_quat_t * p_dstq )

Add two quaternions.

Parameters
[in]p_srcq1Pointer to the first quaternion
[in]p_srcq2Pointer to the second quaternion
[out]p_dstqPointer to the destination quaternion
Returns
None

◆ rob_quat_apply_transform()

rob_status_t rob_quat_apply_transform ( rob_quat_t * p_srcq,
rob_frame_t * p_F,
rob_point_t * p_srcp,
rob_point_t * p_dstp )

Takes a quaternion and makes conversions to then apply it as an homogeneous transformation.

Parameters
[in]p_srcqPoints to quaternion
[in]p_FPoints to reference frame struct
[in]p_srcpPoints to original reference point
[in,out]p_dstpPoints to destination reference point
Returns
Status check ROB_MATH_SUCCESS : Frame IDs align, operation successful. TRANSFORM_FRAMES_MISMATCH : Frame IDs misalign, cannot apply transformation.
Here is the call graph for this function:

◆ rob_quat_conj()

void rob_quat_conj ( const rob_quat_t * p_srcq,
rob_quat_t * p_dstq )

Calculates the conjugate of a quaternion.

Parameters
[in]p_srcqPointer to a quaternion
[out]p_dstqPointer to the quaternion struct to save the conjugate
Returns
None

◆ rob_quat_init()

void rob_quat_init ( rob_quat_t * p_q,
float * q_s,
float * q_i,
float * q_j,
float * q_k )

Quaternion struct initialization.

Parameters
[in,out]p_qPointer to quaternion struct
[in]q_sReal element of the quaternion
[in]q_iImaginary element i of the quaternion
[in]q_jImaginary element j of the quaternion
[in]q_kImaginary element k of the quaternion
Returns
None

◆ rob_quat_inv()

rob_status_t rob_quat_inv ( const rob_quat_t * p_srcq,
rob_quat_t * p_dstq )

Calculates the inverse of a quaternion.

Parameters
[in]p_srcqPointer to a quaternion
[out]p_dstqPointer to save the inverse of the quaternion
Returns
None
Here is the call graph for this function:

◆ rob_quat_is_equal()

bool rob_quat_is_equal ( rob_quat_t * p_q1,
rob_quat_t * p_q2 )

Checks if two quaternions are equal in all their values.

Parameters
[in]p_q1Points to the first quaternion to compare
[in]p_q2Points to the second quaternion to compare
Returns
None

◆ rob_quat_mul()

void rob_quat_mul ( const rob_quat_t * p_srcq1,
const rob_quat_t * p_srcq2,
rob_quat_t * p_dstq )

Multiplies two quaternions (Hamilton product) of two quaternions.

Parameters
[in]p_srcq1Pointer to the first quaternion
[in]p_srcq2Pointer to the second quaternion
[out]p_dstqPointer to the destination quaternion
Returns
None

◆ rob_quat_norm()

void rob_quat_norm ( const rob_quat_t * p_srcq,
float * q_norm )

Calculates the norm of a quaternion.

Parameters
[in]p_srcqPointer to a quaternion
[out]q_normFloat to save the norm of the quaternion
Returns
None

◆ rob_quat_print()

void rob_quat_print ( const rob_quat_t * p_srcq)

Prints the data of a rob_quat_t struct for quaternions.

Parameters
[in]p_srcqPointer to the quaternion to print
Returns
None

◆ rob_quat_scale()

void rob_quat_scale ( const rob_quat_t * p_srcq,
const float p_c,
rob_quat_t * p_dstq )

Multiplies a quaternion by a scalar.

Parameters
[in]p_srcqPointer to the first quaternion
[in]p_cFloat to multiply with
[out]p_dstqPointer to the destination quaternion
Returns
None

◆ rob_quat_sub()

void rob_quat_sub ( const rob_quat_t * p_srcq1,
const rob_quat_t * p_srcq2,
rob_quat_t * p_dstq )

Substract two quaternions.

Parameters
[in]p_srcq1Pointer to the first quaternion
[in]p_srcq2Pointer to the second quaternion
[out]p_dstqPointer to the destination quaternion
Returns
None

◆ rob_refpoint_init()

void rob_refpoint_init ( rob_point_t *const p_p,
matf32_t * p_v,
float * p_data,
rob_frame_id_t ref_frame )

Constructor for the reference frame data structure, defines 4x4 dimensiones, sets the rotation matrix, coordinates vector and creates the homogeneous transformation matrix.

Parameters
[in]p_pPoints to the point struct to use.
[in]p_dataPoints to data float to use
[in]ref_frameEnum tag to indiate the associated reference frame
Returns
None
Here is the call graph for this function:

◆ rob_refpoint_print()

void rob_refpoint_print ( rob_point_t *const p_p)

Prints the data in a rob_refpoint_t struct for reference points.

Parameters
[in]p_pPointer to a given point.
Returns
None
Here is the call graph for this function:

◆ rob_rot2eul()

rob_status_t rob_rot2eul ( matf32_t * p_R,
bool angle_units,
rob_angle_sequences_t rot_sequence,
float * phi,
float * theta,
float * psi )

Generates Euler angles from a rotation matrix, based on the definitions in Craig, Introduction to Robotics.

Parameters
[in]p_RPoints to a rotation matrix
[in]angle_unitsBoolean to indicate if angles should be calculated in radians or degrees
[in,out]phiPhi angle
[in,out]thetaTheta angle
[in,out]psiPsi angle
Returns
None
Here is the call graph for this function:

◆ rob_rot2quat()

rob_status_t rob_rot2quat ( matf32_t * p_R,
rob_quat_t * p_uq )

Generates an unitary quaternion from a rotation matrix.

Parameters
[in]p_RPoints to rotation matrix
[out]p_uqPoints to a unit quaternion
Returns
None
Here is the call graph for this function:

◆ rob_rot2rpy()

rob_status_t rob_rot2rpy ( matf32_t * p_R,
bool angle_units,
rob_angle_sequences_t rot_sequence,
float * roll,
float * pitch,
float * yaw )

Generates Cardan angles from a rotation matrix, based on the definitions in Craig, Introduction to Robotics.

Parameters
[in]p_RPoints to rotation matrix
[in]angle_unitsDegree or radians indicator
[in]rot_sequenceRoll-Pitch-Yaw sequence indicator
[in,out]rollRoll Angle
[in,out]pitchPitch Angle
[in,out]yawYaw Angle
Returns
None
Here is the call graph for this function:

◆ rob_rot2tr()

rob_status_t rob_rot2tr ( matf32_t * p_R,
rob_frame_t * p_F )

Assigns a rotation matrix to an homogeneous transformation matrix.

Parameters
[in]p_RPoints to a rotation matrix
[out]p_FPoints to a reference frame structure
Returns
None
Here is the call graph for this function:

◆ rob_rotx()

rob_status_t rob_rotx ( matf32_t * p_R,
float theta,
bool angle_units )

Generates a rotation matrix in the x axis, defined as follows:

\[\textbf{R}_x = \begin{bmatrix} 1 & 0 & 0 \\ 0 & cos(\theta) & -sin(\theta) \\ 0 & sin(\theta) & cos(\theta) \end{bmatrix} \]

Parameters
[in,out]p_RPointer to rotation matrix.
[in]p_thetaPoints to the value of degrees by which to rotate the frame.
Returns
err_status_t
Here is the call graph for this function:

◆ rob_roty()

rob_status_t rob_roty ( matf32_t * p_R,
float theta,
bool angle_units )

Generates rotation in the y axis, defined as follows:

\[\textbf{R}_y = \begin{bmatrix} cos(\theta) & 0 & sin(\theta) \\ 0 & 1 & 0 \\ -sin(\theta) & 0 & cos(\theta) \end{bmatrix} \]

Parameters
[in,out]p_RPointer to rotation matrix.
[in]thetaAngle for the rotation (either radians or degrees, which must be indicated when initiation the frame)
Returns
None
Here is the call graph for this function:

◆ rob_rotz()

rob_status_t rob_rotz ( matf32_t * p_R,
float theta,
bool angle_units )

Generates rotation in the z axis, defined as follows:

\[\textbf{R}_z = \begin{bmatrix} cos(\theta) & -sin(\theta) & 0 \\ sin(\theta) & cos(\theta) & 0 \\ 0 & 0 & 1 \end{bmatrix} \]

Parameters
[in,out]p_RPointer to rotation matrix
[in]thetaAngle for the rotation (either radians or degrees, which must be indicated when initiation the frame)
Returns
None
Here is the call graph for this function:

◆ rob_rpy2quat()

rob_status_t rob_rpy2quat ( float roll,
float pitch,
float yaw,
rob_angle_sequences_t rot_sequence,
bool angle_units,
matf32_t * p_R,
rob_quat_t * p_uq )

Generates a unitary quaternion from Cardan angles. For that, first generates a rotation matrix from the Cardan angles (see rob_rpy2rot) and then converts the rotation matrix to a quaternion.

Parameters
[in]rollRoll angle (Z axis)
[in]pitchPitch angle (Y axis)
[in]yawYaw angle (X asis)
[in]rot_sequenceEnumerate element to indicate the rotation sequence
[in]angle_unitsBoolean to indicate radians or degrees
[in]p_RPoints to a rotation matrix
[out]p_uqPoints to a unit quaternion
Returns
None
Here is the call graph for this function:

◆ rob_rpy2rot()

rob_status_t rob_rpy2rot ( float roll,
float pitch,
float yaw,
rob_angle_sequences_t rot_sequence,
bool angle_units,
matf32_t * p_R )

Generates a rotation matrix from Cardan angles, based on their definitions in Craig, Introduction to Robotics.

Parameters
[in]rollroll angle (Z axis)
[in]pitchpitch angle (Y axis)
[in]yawyaw angle (X axis)
[in]rot_sequenceroll-pitch-yaw sequence enum tag
[in]angle_unitsradians or degrees indicator
[in,out]p_Rpointer to reference frame where the rotation matrix is
Returns
None
Here is the call graph for this function:

◆ rob_rpy2tr()

void rob_rpy2tr ( float roll,
float pitch,
float yaw,
rob_angle_sequences_t rot_sequence,
bool angle_units,
rob_frame_t * p_F )

Generates an homogeneous transformation from Cardan angles specified in the argument of the function. For that, it first generates a rotation matrix from the Cardan angles, then assigns the rotation matrix to an homogeneous transformation matrix associated to a specific reference frame (the frame must be created beforehand).

Parameters
[in]rollroll angle (Z axis)
[in]pitchpitch angle (Y axis)
[in]yawyaw angle (X axis)
[in]rot_sequenceroll-pitch-yaw sequence enum tag
[in]angle_unitsradians or degrees indicator
[in,out]p_Fpointer reference frame where the rotation matrix is
Returns
None
Here is the call graph for this function:

◆ rob_status_print()

void rob_status_print ( rob_status_t rob_status)

Prints rob_status_t messages.

Parameters
[in]rob_statusError status value to print
Returns
None

◆ rob_tr2eul()

void rob_tr2eul ( rob_frame_t * p_F,
bool angle_units,
rob_angle_sequences_t rot_sequence,
float * phi,
float * theta,
float * psi )

Generates Euler angles from the homogeneous transformation matrix associated to a reference frame (the frame must be created beforehand). For that, first extracts the rotation matrix from the homogenous transformation matrix (see rob_tr2rot), then converts the rotation matrix to Cardan angles (see rob_rot2eul).

Parameters
[in]p_FPoints to a reference frame struct
[in]angle_unitsBoolean to indicate if angles should be calculated in radians or degrees
[in,out]phiPhi angle
[in,out]thetaTheta angle
[in,out]psiPsi angle
Returns
None
Here is the call graph for this function:

◆ rob_tr2quat()

void rob_tr2quat ( rob_frame_t * p_F,
rob_quat_t * p_uq )

Generates an unitary quaternion from the homogeneous transformation matrix associated to a specific frame (the frame should be created beforehand). For this, first extracts the rotation matrix from the homogenous transformation matrix (see rob_tr2rot), then converts the rotation matrix to a quaternion (see rob_rot2quat).

Parameters
[in]p_FPoints to reference frame struct where the homogeneouse transformation matrix is.
[in,out]p_uqPoints to unit quaternion
Returns
None
Here is the call graph for this function:

◆ rob_tr2rot()

rob_status_t rob_tr2rot ( rob_frame_t * p_F,
matf32_t * p_R )

Converts an homogeneous transformation matrix to a rotation matrix.

Parameters
[in]p_FPoints to a reference frame structure
[out]p_RPoints to a rotation matrix
Returns
None
Here is the call graph for this function:

◆ rob_tr2rpy()

void rob_tr2rpy ( rob_frame_t * p_F,
bool angle_units,
rob_angle_sequences_t rot_sequence,
float * roll,
float * pitch,
float * yaw )

Generates Cardan angles from the homogeneous transformation matrix associated to a reference frame (the frame must be created beforehand). For that, first extracts the rotation matrix from the homogenous transformation matrix (see rob_tr2rot), then converts the rotation matrix to Cardan angles (see rob_rot2rpy).

Parameters
[in]p_FPoints to reference frame struct
[in]angle_unitsDegree or radians indicator
[in]rot_sequenceRoll-Pitch-Yaw sequence indicator
[in,out]rollRoll Angle
[in,out]pitchPitch Angle
[in,out]yawYaw Angle
Returns
None
Here is the call graph for this function:

◆ rob_transl()

rob_status_t rob_transl ( matf32_t * p_v,
rob_frame_t * p_F )

Set coordinates vector in the homogeneous transformation matrix.

Parameters
[in,out]p_FPoints to the reference frame struct
[in]p_vPoints to the coordinates vector to be implemented
Returns
rob_status_t
Here is the call graph for this function:

◆ rob_trotx()

void rob_trotx ( rob_frame_t * p_F,
float theta,
bool angle_units )

Generates a rotation matrix around the x axis, using rob_rotx and assigns it to an homogeneous transformation matrix T.

Parameters
[in,out]p_FPointer to reference frame struct.
[in]thetaAngle for the rotation (either radians or degrees, which must be indicated when initiatializing the frame)
Returns
None
Here is the call graph for this function:

◆ rob_troty()

void rob_troty ( rob_frame_t * p_F,
float theta,
bool angle_units )

Generates a rotation matrix around the y axis, using rob_rotx and assigns it to an homogeneous transformation matrix T.

Parameters
[in,out]p_FPointer to reference frame struct.
[in]thetaAngle for the rotation (either radians or degrees, which must be indicated when initializing the frame)
Returns
None
Here is the call graph for this function:

◆ rob_trotz()

void rob_trotz ( rob_frame_t * p_F,
float theta,
bool angle_units )

Generates a rotation matrix around the z axis, using rob_rotx and assigns it to an homogeneous transformation matrix T.

Parameters
[in,out]p_FPointer to reference frame struct.
[in]thetaAngle for the rotation (either radians or degrees, which must be indicated when initializing the frame)
Returns
None
Here is the call graph for this function:

◆ rob_unitquat_init()

void rob_unitquat_init ( rob_quat_t * p_uq,
float * q_s,
float * q_i,
float * q_j,
float * q_k )

Quaternion struct initialization.

Parameters
[in,out]p_uqPointer to quaternion struct
[in]q_sReal element of the quaternion
[in]q_iImaginary element i of the quaternion
[in]q_jImaginary element j of the quaternion
[in]q_kImaginary element k of the quaternion
Returns
None
Here is the call graph for this function:

◆ rob_update_transform()

rob_status_t rob_update_transform ( rob_frame_t * p_F,
matf32_t * p_R,
matf32_t * p_v )

Assigns both a rotation matrix and translation vector to an homogeneous transformation matrix.

Parameters
[in]p_RPoints to rotation matrix
[in]p_vPoints to translation vector
[in,out]p_FPoints to reference frame structure
Returns
None
Here is the call graph for this function: