-
Notifications
You must be signed in to change notification settings - Fork 32
Math
ichumuh edited this page Nov 17, 2022
·
6 revisions
Giskard uses homogeneous transformation matrices to represent transforms.
The 4x4 matrix
In code please use r_T_t
to refer to such matrices.
Rotation matrices are also represented as 4x4 matrices, where the translation component is 0.
In code please use r_R_t
.
Points are represented as 4d vectors:
In code please use r_P_t
.
Vectors are represented as 4d vectors:
In code please use r_V_t
.
Using this representation, you can easily combine transforms, vectors and rotations by only making sure that the inner frame names math, e.g.
a_T_c = np.dot(a_T_b, b_T_c)
from giskardpy.utils.math import inverse_frame
c_T_a = inverse_frame(a_T_c)
# for rotation matrices, the inverse is equal to the transpose
a_R_c = np.dot(a_T_b, b_R_c)
c_R_a = a_R_c.T
# the one at the end of the point makes the translation component of a the transformation matrix has an influence
a_P_c = np.dot(a_T_b, b_P_c)
# the 0 at the end of vectors makes the translation component of a transformation matrix have no influence
a_V_c = np.dot(a_T_b, b_V_c)
# when subtracting points, the result is a vector. With this notation, the 1's at the end get subtracting to automatically produce a 0.
a_V_error = a_P_p2 - a_P_p1
# adding vectors to points will keep the 1 at the end. (Adding two points makes no geometric sense.)
a_P_p3 = a_P_p1 + a_V_error