I am trying to express a vector defined in global coordinates in different frames using homogeneous transformation matrices.

There are in total 3 frames. Frame 1 lies in the origin and is fixed to the world. Frame 2 is fixed to a floating body, with 6 degrees of freedom. Frame 3 is attached to the same floating body and has only a pure translation with respect to Frame 2.

The vector $R_0$ is the vector that I'm trying to express in Frame 2 to obtain $R_2$. For this I have constructed two homogeneous transformation matrices:

$H_{01} = \begin{bmatrix}R_{01} & T_{01}\\\mathbf{0} & 1\end{bmatrix}$ and $H_{01} = \begin{bmatrix}I & T_{12}\\\mathbf{0} & 1\end{bmatrix}$.

With these transformation matrices i should be able to transform a vector expressed in frame 0 to frame 2. I did this doing the following:

$R_2 = (H_{01}H_{12})^{-1}R_0$

Then I plotted the frames and vector to come to the conclusion that its not quite right whenever I put in a rotation matrix $R_{01}$. To illustrate my situation some images:

If I put $R_{01}$ is equal to anyhting but the identity matrix my vector does not end up in the red dot (the fixed point expressed in world coordinates).


From what i can see, the vector that I am obtaining looks correct but is now plotted in global space and not in the frame from which is should be plotted. So basically my question becomes: how can I rotate $R_2$ back in order to plot the vector such that it ends up in the reference point?

R01 with only a rotation around the z-axis of 15 degrees

top view

R01 is the Identity matrix and now my vector ends up in the desired location

top view of the situation with R01 = I


I would suggest you to clarify your notations and not use capital letter for vectors but only for matrices, calling a vector $\mathbf{R}_*$ and the rotation matrix $\mathbf{R}_{*@}$ can lead to confusions, even for you. More over your index notation are not consistent.

That being said it seems that your math are right (provided that the index you wrote are the one I guessed). So your trouble is most likely in plotting, if you express you original vector in the reference frame you get the red dot, if you want to check the resulting vector "$\mathbf{R}_2$" you need to pre-multiply it by the two transformations (in order to be in your third frame).

Note that you can rewrite the inverse of a transformation matrix in a more efficient way ${}_0\mathbf{T}^1 = \begin{bmatrix} {}_0\mathbf{R}^1& {}_0\mathbf{p}^1\\ 0 & 1 \end{bmatrix}$ and ${{}_0\mathbf{T}^1}^{-1} = \begin{bmatrix} {{}_0\mathbf{R}^1}^{T} & -{{}_0\mathbf{R}^1}^{T} {}_0\mathbf{p}^1\\ 0 & 1 \end{bmatrix}$

  • $\begingroup$ Thanks alot, I managed to solve it by pre-multiplying R2 with the rotation matrix from frame 0 to 2 R02. The inverse was indeed computed by the way you described. Little correction though: the first row second element should be -R01^T p01 $\endgroup$ – jim Nov 6 '17 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.