# How to rotate a Homogeneous Transformation Matrix about multiple axes?

I am working on a forward kinematics problem where I have already calculated the relevant transformation between the fixed base frame and the end effector frame of the robotic arm using Homogeneous Transformation Matrix. The convention I am following is

$$T^{n-1}_{n} = R(z, \theta_n) \cdot Trans(z, d_n) \cdot Trans(x, a_n) \cdot R(x, \alpha_n)$$

My issue starts here. The orientation of the end effector as per the urdf of the arm is different from above calculation. So, I have to make some changes to my transformation, i.e., $$T^{0}_{7}$$ in order to orient it in the same direction as per the urdf.

In order to do that, I have to rotate $$T^{0}_{7}$$ by 180 about Z-axis, followed by 90 about Y-axis.

My code:

(using Eigen C++ library for matrix multiplication)

T0_7 = T0_1*T1_2*T2_3*T3_4*T4_5*T5_6*T6_7;

cout << T0_7 << endl;

T_Z180 <<  -1, 0, 0, 0,
0, -1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1;
T_Y90 << 0, 0, -1, 0,
0, 1, 0, 0,
1, 0, 0, 0,
0, 0, 0, 1;

cout << T0_7*T_Z180*T_Y90 << endl;


My question is - Am I doing final transformation correctly in the above code?

I would really appreciate some help with this.

Your transformation matrix for y and z are correct, but the order of multiplication is important in intrinsic rotations. Here you are first rotating about z axis at 180, so pre-multiply the transformation matrix with your end effector matrix

T1 =T_Z180*T0_7


and now do transformation about the y axis:

Tout = T_Y90*T1


or you can always directly pre-multuply them in order:

Tout = T_Y90*T_Z180*T0_7

• Thanks for your answer. I should have pre-multiply it, since it was intrinsic rotation. Jan 16 at 11:52