Transformation matrix

The transformation matrix is a much wider concept but for purpose of orientation in 3D space, we will restrict it into a rotation matrix. So transformation matrix transform (wow) any vector from one reference frame in the other:

(1)v(0)=R10v(1)

Rotation matrix rotate any vector about a specific axis and about a set angle (in this example rotation of vector v=[1,1,1]T about 90  in Z-axis):

(2)v=Rz(90)v=[010100001][111]=[111]

It is important to see the difference between the transformation of a vector between references frames and the rotation of a vector. These two are related to each other but not the same.

Assuming that a certain reference system (π1) is associated with the object, and on each of its axes there are versors (see picture below); additionally, there is a fixed reference system associated with the static environment (π0). The transformation matrix from the object-related system (π1) to the global system (π0) will be equal to the notation of 3 versors, associated with the moving system, in the global frame (3).



(3)R10=[i(0),j(0),k(0)]=[ixjxkxiyjykyizjzkz]

Due to the orthogonality of this matrix, its inverse is equal to its transposition:

(4)R10R01=I(R10)1=R01=(R10)T

The transformation matrix defines explicitly the orientation and in a very simple way allows to perform the transformation of vectors from one system to another. It is also quite intuitive. Unfortunately, due to numerical inaccuracies, it quickly happens that the matrix is not normalized (loses orthonormality) and it is necessary to normalize it, which is a rather computationally expensive process.

Euler angles can be easily extracted from the transformation matrix. This can be seen very well when one writes the transformation matrix in 3D space as a complex of 3 basic rotations (rotations about 3 principal axes of the global system). For the rotation scheme Z(0)Y(1)X(2) (used for the drone) it looks as follows:

(5)R10=Rz(yaw)Ry(pitch)Rx(roll)=|Rz(γ)=[cosγsinγ0sinγcosγ0001]Ry(β)=[cosβ0sinβ010sinβ0cosβ]Rx(α)=[1000cosαsinα0sinαcosα]|(6)=[cosγcosβcosγsinβsinαsinγcosαcosγsinβcosα+sinγsinαsinγcosβsinγsinβsinα+cosγcosαsinγsinβcosαcosγsinαsinβcosβsinαcosβcosα]

From matrix (6) Euler angles can be easily extarcted:

   (7)γ=atan2(R21,R11)(8)β=arcsin(R31)(9)α=atan2(R32,R33)

You can see here exactly the problem of determining the Euler angles in the surrounding of the singular point (β±π2). It is worth noting that for different conventions of Euler angles the formulas binding the transformation matrix and these angles (7)-(9) will have a different form, but the numerical value of the matrix (6) will be the same.


Comments

Popular posts from this blog

Hardware - how to start?

LERP, NLERP and SLERP