|
Robotat Linalg
|
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. | |
Robotics algorithms, based on MATLAB Robotics Toolbox of Peter Corke. Includes routines for homogeneous transformations, rotationes matrices and quaternions.
| 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)\).
| 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 |
| 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.
| 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 |
| 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).
| #define _USE_MATH_DEFINES |
Dependencies
| #define M_PI 3.14159265358979323846 |
Enumerates list of id for possible rotation sequences to implement.
| enum rob_frame_id_t |
| enum rob_status_t |
List of possible status or errors.
| float deg2rad | ( | float * | p_theta | ) |
Converts degrees to radians:
\[ \theta \cdot \frac{\pi}{180} \]
| float rad2deg | ( | float * | p_theta | ) |
Converts radians to degrees:
\[ \theta \cdot \frac{180}{\pi} \]
| void rob_angle_units_print | ( | bool | angle_units | ) |
Prints angle units (radians or degrees) to be used.
| 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.
| [in] | p_F | Points to reference frame struct to work with. |
| [in] | p_srcp | Pointss to reference point for the frame to transform from. |
| [out] | p_dstp | Points to reference point with respect to the new frame. |
| [in] | euler_tag | Tag to indicate the rotation sequence to apply, for example: XYZ, ZYZ, etc. |
| 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 \]
| [in] | p_F | Pointer to reference frame struct to work with. |
| [in] | p_srcp | Coordinates vector with reference to original frame. |
| [out] | p_dstp | Coordinates vector to the new frame of reference. |
| 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.
| [in] | p_q | Pointer to quaternion or unit quaternion |
| 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).
| [in] | p_F | Pointer to reference frame structure |
| [in] | p_srcp | Points to original reference point |
| [in] | p_dstp | Points to the new reference point |
| 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.
| [in] | phi | Phi angle |
| [in] | theta | Theta angle |
| [in] | psi | Psi angle |
| [in] | rot_sequence | Enumerate element to indicate the rotation sequence |
| [in] | angle_units | Boolean to indicate radians or degrees |
| [in] | p_R | Points to a rotation matrix |
| [out] | p_uq | Points to a unit quaternion |
| 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.
| [in] | phi | phi angle |
| [in] | theta | theta angle |
| [in] | psi | psi angle |
| [in] | rot_sequence | roll-pitch-yaw sequence enum tag |
| [in] | angle_units | radians or degrees indicator |
| [in,out] | p_R | pointer to reference frame where the rotation matrix is |
| 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).
| [in] | phi | phi angle |
| [in] | theta | theta angle |
| [in] | psi | psi angle |
| [in] | rot_sequence | roll-pitch-yaw sequence enum tag |
| [in] | angle_units | radians or degrees indicator |
| [in,out] | p_F | pointer reference frame where the rotation matrix is |
| 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.
| [in] | id | Frame id enum |
| 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.
| [in] | p_T | Transformation matrix for the reference frame. |
| [in] | p_R | Rotation matrix. |
| [in] | p_v | Coordinates vector. |
| [in] | ref_frame | Enumerate tag for the current reference frame for the transformation. |
| [in] | dst_frame | Enumerate tag for the destination frame for the transformation. |
| [in] | angle_units | Enumerate tag for the units of the angles. |
| void rob_frame_print | ( | rob_frame_t * | p_F | ) |
Prints the data in a rob_frame_t struct for reference frames.
| [in] | p_F | Pointer to reference matrix. |
| 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} \]
| [in] | p_F | Pointer to reference frame struct. |
| [in,out] | p_Tinv | Pointer to output matrix to save the inverse. |
| bool rob_isrot | ( | matf32_t * | p_R | ) |
Check if a matrix is 3x3, according to the requirement for rotation matrices.
| [in] | p_R | Points to matrix to be checked (matf32_t matrix, 3,3). |
| bool rob_istr | ( | matf32_t * | p_T | ) |
Check if a matrix is 4x4, according to the requirement for homogeneous transformation matrices.
| [in] | p_T | Points to matrix to be checked (matf32_t matrix, 4x4). |
| 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.
| [in] | p_v | Points to vector to be checked (matf32_t matrix, 1x3 or 3x1); |
| 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).
| [in] | p_uq | Points to unit quaternion |
| [in] | angle_units | Radians or degrees indicator |
| [in] | rot_sequence | Roll-Pitch-Yaw sequence |
| [in,out] | phi | Phi Angle |
| [in,out] | theta | Theta Angle |
| [in,out] | psi | Psi Angle |
| rob_status_t rob_quat2rot | ( | rob_quat_t * | p_uq, |
| matf32_t * | p_R ) |
Generates a rotation matrix from an unitary quaternion.
| [in] | p_uq | Points to a unit quaternion |
| [in,out] | p_R | Points to a rotation matrix |
| 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).
| [in] | p_uq | Points to unit quaternion |
| [in] | angle_units | Radians or degrees indicator |
| [in] | rot_sequence | Roll-Pitch-Yaw sequence |
| [in,out] | roll | Roll Angle |
| [in,out] | pitch | Pitch Angle |
| [in,out] | yaw | Yaw Angle |
| 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).
| [in] | p_uq | Points to a unit quaternion |
| [in,out] | p_F | Points to a reference frame struct |
| void rob_quat_add | ( | const rob_quat_t * | p_srcq1, |
| const rob_quat_t * | p_srcq2, | ||
| rob_quat_t * | p_dstq ) |
Add two quaternions.
| [in] | p_srcq1 | Pointer to the first quaternion |
| [in] | p_srcq2 | Pointer to the second quaternion |
| [out] | p_dstq | Pointer to the destination 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.
| [in] | p_srcq | Points to quaternion |
| [in] | p_F | Points to reference frame struct |
| [in] | p_srcp | Points to original reference point |
| [in,out] | p_dstp | Points to destination reference point |
| void rob_quat_conj | ( | const rob_quat_t * | p_srcq, |
| rob_quat_t * | p_dstq ) |
Calculates the conjugate of a quaternion.
| [in] | p_srcq | Pointer to a quaternion |
| [out] | p_dstq | Pointer to the quaternion struct to save the conjugate |
| void rob_quat_init | ( | rob_quat_t * | p_q, |
| float * | q_s, | ||
| float * | q_i, | ||
| float * | q_j, | ||
| float * | q_k ) |
Quaternion struct initialization.
| [in,out] | p_q | Pointer to quaternion struct |
| [in] | q_s | Real element of the quaternion |
| [in] | q_i | Imaginary element i of the quaternion |
| [in] | q_j | Imaginary element j of the quaternion |
| [in] | q_k | Imaginary element k of the quaternion |
| rob_status_t rob_quat_inv | ( | const rob_quat_t * | p_srcq, |
| rob_quat_t * | p_dstq ) |
Calculates the inverse of a quaternion.
| [in] | p_srcq | Pointer to a quaternion |
| [out] | p_dstq | Pointer to save the inverse of the quaternion |
| 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.
| [in] | p_q1 | Points to the first quaternion to compare |
| [in] | p_q2 | Points to the second quaternion to compare |
| 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.
| [in] | p_srcq1 | Pointer to the first quaternion |
| [in] | p_srcq2 | Pointer to the second quaternion |
| [out] | p_dstq | Pointer to the destination quaternion |
| void rob_quat_norm | ( | const rob_quat_t * | p_srcq, |
| float * | q_norm ) |
Calculates the norm of a quaternion.
| [in] | p_srcq | Pointer to a quaternion |
| [out] | q_norm | Float to save the norm of the quaternion |
| void rob_quat_print | ( | const rob_quat_t * | p_srcq | ) |
Prints the data of a rob_quat_t struct for quaternions.
| [in] | p_srcq | Pointer to the quaternion to print |
| 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.
| [in] | p_srcq | Pointer to the first quaternion |
| [in] | p_c | Float to multiply with |
| [out] | p_dstq | Pointer to the destination quaternion |
| void rob_quat_sub | ( | const rob_quat_t * | p_srcq1, |
| const rob_quat_t * | p_srcq2, | ||
| rob_quat_t * | p_dstq ) |
Substract two quaternions.
| [in] | p_srcq1 | Pointer to the first quaternion |
| [in] | p_srcq2 | Pointer to the second quaternion |
| [out] | p_dstq | Pointer to the destination quaternion |
| 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.
| [in] | p_p | Points to the point struct to use. |
| [in] | p_data | Points to data float to use |
| [in] | ref_frame | Enum tag to indiate the associated reference frame |
| void rob_refpoint_print | ( | rob_point_t *const | p_p | ) |
Prints the data in a rob_refpoint_t struct for reference points.
| [in] | p_p | Pointer to a given point. |
| 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.
| [in] | p_R | Points to a rotation matrix |
| [in] | angle_units | Boolean to indicate if angles should be calculated in radians or degrees |
| [in,out] | phi | Phi angle |
| [in,out] | theta | Theta angle |
| [in,out] | psi | Psi angle |
| rob_status_t rob_rot2quat | ( | matf32_t * | p_R, |
| rob_quat_t * | p_uq ) |
Generates an unitary quaternion from a rotation matrix.
| [in] | p_R | Points to rotation matrix |
| [out] | p_uq | Points to a unit 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.
| [in] | p_R | Points to rotation matrix |
| [in] | angle_units | Degree or radians indicator |
| [in] | rot_sequence | Roll-Pitch-Yaw sequence indicator |
| [in,out] | roll | Roll Angle |
| [in,out] | pitch | Pitch Angle |
| [in,out] | yaw | Yaw Angle |
| rob_status_t rob_rot2tr | ( | matf32_t * | p_R, |
| rob_frame_t * | p_F ) |
Assigns a rotation matrix to an homogeneous transformation matrix.
| [in] | p_R | Points to a rotation matrix |
| [out] | p_F | Points to a reference frame structure |
| 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} \]
| [in,out] | p_R | Pointer to rotation matrix. |
| [in] | p_theta | Points to the value of degrees by which to rotate the frame. |
| 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} \]
| [in,out] | p_R | Pointer to rotation matrix. |
| [in] | theta | Angle for the rotation (either radians or degrees, which must be indicated when initiation the frame) |
| 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} \]
| [in,out] | p_R | Pointer to rotation matrix |
| [in] | theta | Angle for the rotation (either radians or degrees, which must be indicated when initiation the frame) |
| 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.
| [in] | roll | Roll angle (Z axis) |
| [in] | pitch | Pitch angle (Y axis) |
| [in] | yaw | Yaw angle (X asis) |
| [in] | rot_sequence | Enumerate element to indicate the rotation sequence |
| [in] | angle_units | Boolean to indicate radians or degrees |
| [in] | p_R | Points to a rotation matrix |
| [out] | p_uq | Points to a unit quaternion |
| 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.
| [in] | roll | roll angle (Z axis) |
| [in] | pitch | pitch angle (Y axis) |
| [in] | yaw | yaw angle (X axis) |
| [in] | rot_sequence | roll-pitch-yaw sequence enum tag |
| [in] | angle_units | radians or degrees indicator |
| [in,out] | p_R | pointer to reference frame where the rotation matrix is |
| 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).
| [in] | roll | roll angle (Z axis) |
| [in] | pitch | pitch angle (Y axis) |
| [in] | yaw | yaw angle (X axis) |
| [in] | rot_sequence | roll-pitch-yaw sequence enum tag |
| [in] | angle_units | radians or degrees indicator |
| [in,out] | p_F | pointer reference frame where the rotation matrix is |
| void rob_status_print | ( | rob_status_t | rob_status | ) |
| 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).
| [in] | p_F | Points to a reference frame struct |
| [in] | angle_units | Boolean to indicate if angles should be calculated in radians or degrees |
| [in,out] | phi | Phi angle |
| [in,out] | theta | Theta angle |
| [in,out] | psi | Psi angle |
| 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).
| [in] | p_F | Points to reference frame struct where the homogeneouse transformation matrix is. |
| [in,out] | p_uq | Points to unit quaternion |
| rob_status_t rob_tr2rot | ( | rob_frame_t * | p_F, |
| matf32_t * | p_R ) |
Converts an homogeneous transformation matrix to a rotation matrix.
| [in] | p_F | Points to a reference frame structure |
| [out] | p_R | Points to a rotation matrix |
| 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).
| [in] | p_F | Points to reference frame struct |
| [in] | angle_units | Degree or radians indicator |
| [in] | rot_sequence | Roll-Pitch-Yaw sequence indicator |
| [in,out] | roll | Roll Angle |
| [in,out] | pitch | Pitch Angle |
| [in,out] | yaw | Yaw Angle |
| rob_status_t rob_transl | ( | matf32_t * | p_v, |
| rob_frame_t * | p_F ) |
Set coordinates vector in the homogeneous transformation matrix.
| [in,out] | p_F | Points to the reference frame struct |
| [in] | p_v | Points to the coordinates vector to be implemented |
| 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.
| [in,out] | p_F | Pointer to reference frame struct. |
| [in] | theta | Angle for the rotation (either radians or degrees, which must be indicated when initiatializing the frame) |
| 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.
| [in,out] | p_F | Pointer to reference frame struct. |
| [in] | theta | Angle for the rotation (either radians or degrees, which must be indicated when initializing the frame) |
| 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.
| [in,out] | p_F | Pointer to reference frame struct. |
| [in] | theta | Angle for the rotation (either radians or degrees, which must be indicated when initializing the frame) |
| void rob_unitquat_init | ( | rob_quat_t * | p_uq, |
| float * | q_s, | ||
| float * | q_i, | ||
| float * | q_j, | ||
| float * | q_k ) |
Quaternion struct initialization.
| [in,out] | p_uq | Pointer to quaternion struct |
| [in] | q_s | Real element of the quaternion |
| [in] | q_i | Imaginary element i of the quaternion |
| [in] | q_j | Imaginary element j of the quaternion |
| [in] | q_k | Imaginary element k of the quaternion |
| 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.
| [in] | p_R | Points to rotation matrix |
| [in] | p_v | Points to translation vector |
| [in,out] | p_F | Points to reference frame structure |