## D-H convention – tutorial 2

This tutorial presents one interesting example of how to deal with specifically oriented joints. In this case, it is necessary to extend a little bit previous definition of DH parameters.

Let’s consider the manipulator which is presented in Fig. 1 below:

After assigning the frame we can get the following relationships:

It can be seen that axis \(^2 x\) must be oriented on the top-down direction according to *x*-axis definition.

In this case if we use the strict interpretation of definition of parameters we would get the following result (this result is wrong):

*Table 1. D-H parameters of a manipulator ( this is wrong!!)*

\(i\) | \(a_i\) | \(\alpha_i\) | \(d_i\) | \(\theta_i\) |

1 | 0 | \(-\frac{\pi}{2}\) | \(l_1\) | \(\theta_1^*\) |

2 | 0 | \(-\frac{\pi}{2}\) | 0 | \(\zeta_2^* = \theta_2^* -\frac{\pi}{2}\) |

3 | 0 | 0 | \(l_3\) | \(\theta_3^*\) |

This is wrong, because \(l_2\) distance is missing. The right table should look like this:

*Table 2. Correct D-H parameters of a manipulator presented in Fig. 1.*

\(i\) | \(a_i\) | \(\alpha_i\) | \(d_i\) | \(\theta_i\) |

1 | 0 | \(-\frac{\pi}{2}\) | \(l_1\) | \(\theta_1^*\) |

2 | 0 | \(-\frac{\pi}{2}\) | 0 | \(\zeta_2^* = \theta_2^* -\frac{\pi}{2}\) |

3 | 0 | 0 | \(l_2+l_3\) | \(\theta_3^*\) |

In this case it was necessary to add previously missing distance \(l_2\).

The individual homogenous transformations matrix in this case are:

\(^0 H_1 = \begin{bmatrix}C_{1} & 0 & -S_{1} & 0\\S_{1} & 0 & C_{1} & 0\\0& -1 & 0 & l_1\\0&0&0&1\end{bmatrix}\) \(^1 H_2 = \begin{bmatrix}C_{2} & 0 & -S_{2} & 0\\S_{2} & 0 & C_{2} & 0\\0& -1 & 0 & 0\\0&0&0&1\end{bmatrix}\)In the matrix \(^1 H_2\) index *2* refers to \(\zeta_2^*\) and not to \(\theta_2^*\).

and the final result is:

\(^0 H_3=^0H_1 \times ^1H_2 \times ^2H_3=\\\begin{bmatrix}C_1 C_2 C_3 + S_1 S_3 & -C_1 C_2 S_3 + S_1 C_3 & -C_1 S_2 & -C_1 S_2(l_2 + l_3)\\S_1 C_2 C_3 – C_1 S_3 & -S_1 C_2 S_3 – C_1 C_3 & -S_1 S_2 & -S_1 S_2(l_2 + l_3)\\-S_2 C_3& S_2 S_3 & -C_2 & -C_2(l_2 + l_3) + l_1\\0&0&0&1\end{bmatrix}\)

In this matrix index \(1\) refers to \(\theta_1^*\), index \(2\) refers to \(\zeta_2^*\) and index \(3\) refers to \(\theta_3^*\).

You can use the methods presented in *D-H tutorial 1* in order to check the correctness of the solution.

Now, let’s see what happens if someone forgets to include the initial offset of the second joint, so when someone assumes, that \(\zeta_2^* = \theta_2^*\). In order to visualize this lets calculate the matrix \(^0 H_3\) when \(\theta_1=0\), \(\zeta_2^ = \theta_2^=0\) and \(\theta_3^=0\). The result is:

\(^0 H_3 = \begin{bmatrix}1 & 0 & 0 & 0\\0 & -1 & 0 & 0\\0& 0 & -1 & l_1 -(l_2+l_3)\\0&0&0&1\end{bmatrix}\)It can be clearly seen, that in this case most of the element are wrong. The manipulator should look like in Fig. 1 and Fig. 2 but instead the matrix shows that it is oriented in a different way. For example according to a Fig. 1 the *x*-position should be \(x=l_2 + l_3\), *y*-position should be \(y=0\) and \(z=l_1\). Only \(y\) element from a matrix is ok. The same analysis can be done to rotation matrix – many elements are wrong.

Meanwhile, when we solve the equation with \(\zeta_2^*=\theta_2^*-\frac{pi}{2}\) how it should be, then we get the following result:

\(^0 H_3 = \begin{bmatrix}0 & 0 & 1 & l_2 + l_3\\0 & -1 & 0 & 0\\1& 0 & 0 & l_1\\0&0&0&1\end{bmatrix}\)Look at the Fig. 1 or 2, everything seems ok now.

Conclusion:**Always remember to include the initial offset**

There is also one thing to explain.

According to resulted parameters, the 3rd joint of the manipulator is in the same place, what the 2nd joint. This is not consistent with a given Fig. 1. Don’t worry. This is OK. Sometimes it happens- it’s just the properties of D-H convention (**what matter in the end is the relation between the world frame and end-effector frame**).