# Rotation Matrices Using DH Parameters

I need to find rotation matrices between the frames of references of the vertices of the cube, and the DH parameters. For the rotation between the first to second frame of reference, I got alpha as pi/2 and theta as -pi/2, which makes the rotation matrix as: [0 0 -1; -1 0 0; 0 1 0]. This doesnt match any of the given options.   • I see two frames labeled $O_1$ in your image... I assume the one with axes $x_2$, $y_2$, and $z_2$ is the "second" frame you reference? – Ben Jun 5 '19 at 18:12
• The question in the screen grab is poorly framed. The origins of the frames are not coincident, so it is not possible to have a rotation matrix transform vectors between the frames, it should be a homogeneous transformation matrix (4x4). Why do you need to know DH parameters, it is not part of the question, and they give you a homogeneous transformation matrix not a rotation matrix. This is very confused. – Peter Corke Jun 6 '19 at 17:54

## 1 Answer

I'm not sure where you went wrong, but that's because you haven't explained how you arrived at your DH values or how you converted from DH to rotation matrix.

This question doesn't really need all that, though, because the axes are swapped but otherwise remain colinear. If you were trying to get to/from O3 it'd be a bit harder.

The matrix, any matrix but especially here for rotations, just explains how you recombine elements of an existing vector to get a new vector. In your case, you have:

$$\left[\begin{matrix} x_1 \\ y_1 \\ z_1 \end{matrix}\right] = \left[\mbox{something}\right] \left[\begin{matrix} x_2 \\ y_2 \\ z_2 \end{matrix}\right]$$

And you want the [something] that converts from O2 to O1. Just look at the axes!

In O2, the x-axis points the same way as the z-axis does in O1. None of the other axes point in that direction, so you want all of the $$x_2$$ and none of the $$y_2$$ or $$z_2$$ entries. That is:

$$\left[\begin{matrix} x_1 \\ y_1 \\ z_1 \end{matrix}\right] = \left[\begin{matrix} &\mbox{something} \\ &\mbox{something} \\ 1 & 0 & 0 \end{matrix}\right] \left[\begin{matrix} x_2 \\ y_2 \\ z_2 \end{matrix}\right]$$

If you look at just the multiplication on that bottom row, you get:

$$z_1 = 1*x_2 + 0*y_2 + 0*z_2 \\$$

or, as stated above, $$z_1 = x_2$$. You can see that from the diagram: $$z_1$$ and $$x_2$$ point in the same direction.

By the same way, you can see that $$z_2$$ points in the same direction as $$x_1$$. Since it's for $$x_1$$, you want it to be the first row, and again you want all of $$z_2$$ but none of $$y_2$$ or $$x_2$$, so you get:

$$\left[\begin{matrix} x_1 \\ y_1 \\ z_1 \end{matrix}\right] = \left[\begin{matrix} 0 & 0 & 1 \\ &\mbox{something} \\ 1 & 0 & 0 \end{matrix}\right] \left[\begin{matrix} x_2 \\ y_2 \\ z_2 \end{matrix}\right]$$

And you can again verify this by multiplying the top row out to get:

$$x_1 = 0*x_2 + 0*y_2 + 1*z_2 \\$$

Or $$x_1 = z_2$$. Finally, the y-axes just point in the opposite directions, so you want to invert all of the y-values, again taking none of the x- or z-axis values:

$$\left[\begin{matrix} x_1 \\ y_1 \\ z_1 \end{matrix}\right] = \left[\begin{matrix} 0 & 0 & 1 \\ 0 & -1 & 0 \\ 1 & 0 & 0 \end{matrix}\right] \left[\begin{matrix} x_2 \\ y_2 \\ z_2 \end{matrix}\right]$$

So that's the easy way to solve the problem. If you want help figuring out where you went wrong with the DH route (which is still totally valid but just more work) then please post more information including how you arrived at the DH parameters and how you converted them to a rotation matrix.

• I used the given transformation matrix to obtain the rotation matrix from the alpha and theta values. I edited the question, so the transformation matrix is in it. – Rishabh Jain Jun 7 '19 at 9:27
• I used the right hand rule to find alpha and theta. Both rotations turned out to be about y axis. – Rishabh Jain Jun 7 '19 at 18:50