## D-H convention – tutorial 3

Sometimes the links of a manipulator have got such a shape that it is difficult to get the final result because equations are becoming complicated. In this case, not many software are able to deal with the problem of designating the parameters of the manipulator. In this tutorial, such a problem is introduced and later the method is proposed how to simplified working with such manipulators.

The problem is to derive the transformation matrix of the following manipulator: Fig 1. The manipulator with 2 revolute degrees of freedom ($$l_2$$ link points beyond the monitor in the 3D dimension).

By using standard D-H convention we can orient axes in the following way:

In the initial configuration the position of the end effector on x-axis is $$l_1$$, and on the y-axis is $$l_2$$, and $$z=l_3$$.

It can be seen that the orientation of axis $$^2 x$$ can be perpendicular to the previous and the current z-axes in many various ways. However, choosing it in the left or right direction would be a mistake, because the $$l_2$$ distance would be missing (please see tutorial 2). It must be chosen as a common normal, so as presented in the picture.

Let’s assume that the base frame and the end effector frame must be oriented as is visualized on the picture. In this case we can find the D-H parameters as:

It can be seen that equations become complicated since there is $$cos(\theta_i + arctg(\frac{l_2}{l_1}))$$ and $$sin(\theta_i + arctg(\frac{l_2}{l_1}))$$ inside the matrix. In order to simplified the calculations we can substitute:
$$\zeta_1=\theta_1^* – arctg(\frac{l_2}{l_1})$$
and
$$\zeta_2=\theta_2^* + arctg(\frac{l_2}{l_1})$$

After doing so, the homogonous transformation matrices become:
$$^0 H_1 = \begin{bmatrix}C_{1} & -S_{1} & 0 & \sqrt{l_1^2+l_2^2} C_1\\S_{1} & C_1 & 0 & \sqrt{l_1^2 + l_2^2} S_1\\0& 0 & 1 & 0\\0&0&0&1\end{bmatrix}$$

$$^1 H_2 = \begin{bmatrix}C_{2} & -S_{2} & 0 & 0\\S_{2} & C_2 & 0 & 0\\0& 0 & 1 & l_3\\0&0&0&1\end{bmatrix}$$

what after multiplication gives:

$$^0 H_2 = \begin{bmatrix}C_{12} & -S_{12} & 0 & \sqrt{l_1^2+l_2^2}C_1\\S_{12} & C_{12} & 0 & \sqrt{l_1^2+l_2^2} S_1\\0& 0 & 1 & l_3\\0&0&0&1\end{bmatrix}$$

It can be also seen, that:
$$\zeta_{12}=\theta_1+atan(\frac{l_2}{l_1})+\theta_2-atan(\frac{l_2}{l_1})=\theta_1+\theta_2$$

while $$x$$ and $$y$$ position can be simplified as follows:

$$\sqrt{l_1^2+l_2^2}cos(\theta_1+atan(\frac{l_2}{l_1}))=\\= \sqrt{l_1^2+l_2^2}\Big(cos(\theta_1)cos(atan(\frac{l_2}{l_1}))-sin(\theta_1)sin(atan(\frac{l_2}{l_1}))\Big)$$

$$sin(atan(\frac{l_2}{l_1}))$$ and $$cos(atan(\frac{l_2}{l_1}))$$ can be calculated directly by looking at the triangle defined below: Fig 3. How to calculate $$cos(atan(\frac{l_2}{l_1}))$$

By looking at the triangle the following equations can be derived:
$$tg(\alpha)=x$$
$$\alpha=atan(x)$$
$$cos(\alpha)=\frac{1}{\sqrt{x^2+1}}$$
so
$$cos(\alpha)=cos(atan(x))=\frac{1}{\sqrt{x^2+1}}$$
and
$$sin(\alpha)=sin(atan(x))=\frac{x}{\sqrt{x^2+1}}$$

In the presented case the value of $$x$$ equals $$x=\frac{l_2}{l_1}$$.

This lead to the following equation on $$x$$-coordinate:

$$\sqrt{l_1^2+l_2^2}cos(\theta_1+atan(\frac{l_2}{l_1}))= \sqrt{l_1^2+l_2^2}\Big(cos(\theta_1)\frac{1}{\sqrt{(\frac{l_2}{l_1})^2+1}}-sin(\theta_1)\frac{(\frac{l_2}{l_1})}{\sqrt{\frac{l_2}{l_1}^2+1}}\Big)=\\ =\sqrt{l_2^2+l_1^2}\Big(\frac{l_1 cos(\theta_1)}{\sqrt{l_2^2+l_1^2}}-\frac{l_2 sin(\theta_1)}{\sqrt{l_2^2+l_1^2}}\Big)=l_1 cos(\theta_1)-l_2 sin(\theta_1)$$

and the result on $$y$$ coordinate is:

$$\sqrt{l_1^2+l_2^2}sin(\theta_1+atan(\frac{l_2}{l_1}))= \sqrt{l_1^2+l_2^2}\Big(sin(\theta_1)\frac{1}{\sqrt{(\frac{l_2}{l_1})^2+1}}+cos(\theta_1)\frac{(\frac{l_2}{l_1})}{\sqrt{\frac{l_2}{l_1}^2+1}}\Big)=\\=\sqrt{l_2^2+l_1^2}\Big(\frac{l_1 sin(\theta_1)}{\sqrt{l_2^2+l_1^2}}+\frac{l_2 cos(\theta_1)}{\sqrt{l_2^2+l_1^2}}\Big)=l_1 sin(\theta_1)+l_2 cos(\theta_1)$$

The final result is:
$$^0 H_2 = \begin{bmatrix}C_{12} & -S_{12} & 0 & l_1 C_1 – l_2 S_1\\S_{12} & C_{12} & 0 & l_1 S_1 + l_2 C_1\\0& 0 & 1 & l_3\\0&0&0&1\end{bmatrix}$$.

As illustrated above to get this result is was necessary to solve equations with arcus function tangled in standard trigonometric functions. This might be complicated in a case a manipulator has got more than 2 DoF.