Me and my friend have ran into trubbels with translating a point in a 3D-space from one cartesian coordinate system to another.
In this case we have 3 coordinate systems called the Base-frame, h-frame and b-frame (see picture below). From the Base-frame we rotate with $\pi$ around the Base-frame x-axis in order to reach the h-frame. This is done with the following transformation matrix:
$ T_{base}^h = \begin{bmatrix} 1,\ \ 0,\ \ 0,\ \ 0\\0,-1,\ \ 0,\ \ 0\\0,\ \ 0,-1,\ \ 0\\0,\ \ 0,\ \ 0,\ \ 1 \end{bmatrix}$
When this has been done we rotate from the h-frame to the b-frame by rotating around the h-frame x-axis with $\frac{\pi}{2}$ with the following matrix:
$ T_{h}^b = \begin{bmatrix} 1,\ \ 0,\ \ 0,\ \ 0 \\ 0,\ \ 0,-1,\ \ 0\\ 0,\ \ 1,\ \ 0,\ \ 0\\0,\ \ 0,\ \ 0,\ \ 1 \end{bmatrix}$
We then want to express a coordinate, expressed in the Base-frame, say $coord_{base} = [1;1;0;1]$, in the b-frame (last 1 just for size). With the knowledge of the frames orientation the point [1;1;0;1] expressed in the Base-frame, should become [1;0;1;1] in the b-frame. To get this point with the help of our matrices, we perform the following calculation
$coord_{b} = T_{base}^h \ \ T_{h}^b \ \ coord_{base}$
this, however, yields the point [1;0;-1], and not [1;0;1] as expected. Why? Are we multiplying in the wrong order? Creating the rotation matrices in the wrong order? Are we missing something obvious here?
Picture of frames and their rotation
Grateful for all help we can get!
To expand a bit on greg’s comment, yes, you’ve got the matrices in the wrong order. Think about it this way: After transforming $\mathbf x_{base}$ into the $h$-frame, you have $T_{base}^h\mathbf x_{base}$. You then transform this into the $b$-frame, you multiply this by the next transformation matrix, getting $T_h^b(T_{base}^h\mathbf x_{base})$.
More generally, if you’re representing points as column vectors, then you left-multiply by the transformation matrix and the transformation cascade grows leftward; if you’re using row vectors, you right-multiply by the matrix and the cascade grows rightward.