## Denavit-Hartenberg convention – tutorial 1

Denavit-Hartenberg convention is a technique which allows deriving parameters and variables of a kinematic chain of a manipulator. These parameters and variables can be after that used to get kinematic and dynamic models of a manipulator. Using the D-H convention can simplify the whole process. The notation will be explained on a sample manipulator which is illustrated in Fig. 1.

Fig. 1. Manipulator consists of 1 revolute joint oriented perpendicular to a floor and 2 revolute joints parallel to the floor.

• It can be assumed that the length of links, which are not given, equal 0.
• We can also assume that given distances are in fact distances between rotational/translational axis of joints.

1st STEP – ATTACHING THE COORDINATES FRAMES

The first step is to attach Cartesian coordinate systems to individual joints. Variables and parameters of a manipulator will be designated based on these frames. We will use frames to transform systematically among them using matrix transformations in order to get the final model later.
In this example right-sided Cartesian coordinate frames are used:

Wikipedia – right-hand rule

Common normal generally means that the axis is perpendicular to the previous and current axis.
It is no need to draw y-axis, since its direction is known when we already have x- and z-axes.
Another important part of the convention:

• The x-axis of the 1st coordinate system can be chosen arbitrarily.
• The coordinate system of an end effector also can be chosen arbitrarily and usually is selected based on a gripper geometry.
• The assignment of coordinate systems start from 0, so the final index which is assigned to an end effector equals the number of joints (in case there are no passive joints).

After assigning the frames, the manipulator looks like in Fig. 2. You can also assign $$^1 z$$, $$^2 z$$ and $$^3 z$$ in another direction.

2nd STEP – PARAMETERS AND VARIABLES

In the D-H convention, there are 3 parameters and 1 variable, or 4 parameters (if there is no active motor in a joint for which parameters belong to).

Assigning parameters for the 1st joint is done by treating the coordinate system number 1 as the actual coordinate system and the coordinate with index 0 as the previous coordinate frame. By looking at our example, we can derive the first alpha angle after extending $$^0 z$$ axis until it crosses the $$^1 x$$ axis. After that when we project is on the plane, we get the following relationship:

It is important to look at the [latex]^1 x\)-axis in the direction of increasing the numbers, otherwise, you get result for a left-sided Cartesian coordinate frame. Generally, we cannot mix left- and right-frames since they are characterized by different matrices.

We can see that the angle between $$^0z$$ and $$^1 z$$ is $$-\frac{pi}{2}$$ (rotate $$^0 z$$ axis to cover $$^1 z$$ axis).

by looking at the $$^1 x$$ from above we get:

The distance between $$z-axes$$ is 0 for both figures. Looking at designation methods of alpha and $$a$$ can be seen how important it is to assign all axes properly.

when we extend in mind the $$^0z$$ axis in this way to intersect $$^0x$$ and $$^1x$$ axis we will get the following view (xz-plane):

The same result we also get by looking from yz-plane point of view:

Thus, the distance $$d$$ equals $$d_1$$

So the distance $$d$$ equals $$d_1$$.

When we project previous and current x-axis on $$^0 z$$ we can see that the angle is zero. This is an initial angle.
However, this angle can change because the $$^0 z$$ axis is assigned to let’s say some motor’s shaft. This is why we treat it as a variable.
Remember to always mark the initial angle too if it is different from 0 (you will see in some other tutorial why).
………………..
In the next step we change the index of a frame (now the current coordinate system is a system marked with index 2, and the previous one – the coordinate system marked with index 1) and we repeat the whole procedure once again.
After doing it for the whole robot, we get the following result:
………….

*The variables are marked with a star.

3rd STEP – HOMOGONOUS TRANSFORMATION MATRIX

The homogonous transformation matrix can be designated from the following equation:
$$^0 H_3=^0H_1 \times ^1H_2 \times ^2H_3$$
The matrix $$^0 H_3$$ tell us what is the relation in the sense of rotation and translation between the base of the robot (index 0) and its end effector (index 3).
The individual matrices can be designated immediately by using the general D-H formula:

$$T_i = \begin{bmatrix}cos(\theta_i) & -sin(\theta_i)cos(\alpha_i) & sin(\theta_i)sin(\alpha_i) & a_i cos(\theta_i)\\sin(\theta_i) & cos(\theta_i)cos(\alpha_i) & -cos(\theta_i)sin(\alpha_i) & a_i sin(\theta_i) \\0& sin(\alpha_i) & cos(\alpha_i) & d_i\\0&0&0&1\end{bmatrix}$$ $$T_i = \begin{bmatrix}C_{\theta_i} & -S_{\theta_i}C_{\alpha_i} & S_{\theta_i}S_{\alpha_i} & a_i C_{\theta_i}\\S_{\theta_i} & C_{\theta_i}C_{\alpha_i} & -C_{\theta_i}S_{\alpha_i} & a_i S_{\theta_i} \\0& S_{\alpha_i} & C_{\alpha_i} & d_i\\0&0&0&1\end{bmatrix}$$

where $$C_{\theta_i}=cos(\theta_i)$$, $$C_{\alpha_i}=cos(\alpha_i)$$, $$S_{\theta_i}=sin(\theta_i)$$ and $$S_{\alpha_i}=sin(\alpha_i)$$.

after substituting parameters and variables from the table we get:
$$^0 H_1 = \begin{bmatrix}C_{1} & 0 & -S_{1} & 0\\S_{1} & 0 & C_{1} & 0\\0& -1 & 0 & d_1\\0&0&0&1\end{bmatrix}$$

$$^1 H_2 = \begin{bmatrix}C_{2} & -S_{2} & 0 & a_2 C_2\\S_{2} & C_2 & 0 & a_2 S_2\\0& 0 & 1 & 0\\0&0&0&1\end{bmatrix}$$ $$^2 H_3 = \begin{bmatrix}C_{3} & -S_{3} & 0 & a_3 C_3\\S_{3} & C_3 & 0 & a_3 S_3\\0& 0 & 1 & 0\\0&0&0&1\end{bmatrix}$$

We can see that the matrix for the 2nd and 3rd joint has the same form. It should be like this, because they are situated in the same way.

Once multiplying these matrices we get:
$$^0 H_3=^0H_1 \times ^1H_2 \times ^2H_3=\\\begin{bmatrix}C_{23}C_1 & -S_{23}C_1 & -S_1 & C_1 (a_3 C_{23}+a_2 C_2)\\S_1 C_{23} & -S_{23}S_1 & C_1 & S_1(a_3 C_{23} + a_2 C_2)\\-S_{23}& -C_{23} & 0 & d_1-a_3 S_{23} – a_2 S_2\\0&0&0&1\end{bmatrix}$$
where
$$cos\theta_1=C_1\\sin\theta_1=S_1\\cos(\theta_1+\theta_2)=C_{12}\\sin(\theta_1+\theta_2)=S_{12}$$

4th STEP – THE ANALYSIS OF THE RESULT

It is useful to check if the result is correct, since action which comes after that (kinematic and dynamic modeling, simulation, control, programming) is very time consuming. Thus, we must be sure that we are working on the good model.

1. The first thing is that the matrix should have a block structure.
$$\begin{bmatrix}R&p\\0&1\end{bmatrix}$$
Our matrix from the example has the block structure, so this is ok.
2. The rotation matrix (part of the matrix 1:3,1:3) should have properties of a rotation matrix. These properties are generally defined below: Let’s assumed, that column of the rotation matrix can be written as $$R=[a b c]$$. The following relationships apply:
• $$R^T=R^{-1}$$
• $$det(R)=\pm1$$
• $$R$$ is normalized, so the squares of elements in any row or column must equal $$1$$.
• $$R$$ is orthogonal, so the dot product between any column must equal 0 $$a \cdot b=b \cdot c=c \cdot a=0$$
• The vector product of rotation matrix: $$a \times b=c$$, $$b \times c=a$$ and $$c \times a=b$$.
3. Another thing is to look at the rotation matrix and see if everything is ok. For example, since the 2nd and 3rd joints are situated in the same way, there is a sum of angles in the matrix. Also, the 3rd column is quite simple to quick analysis. The relation between $$^0 x[latex] and [latex]^3 z$$ is $$-sin\theta_1$$. Look at Fig. 2 – this is OK. A similar situation also applies between $$^0 y$$ and $$^3 z$$ $$-cos\theta_1$$, and the relation between $$^0 z$$ and $$^3 z$$ is $$0$$ (so the angle is always $$90 \;deg$$ and we cannot change it in this manipulator).
4. We can easily calculate how the matrix looks like in certain configurations, for example after substituting $$0$$ angles for $$\theta_1$$, $$\theta_2$$ and $$\theta_3$$ we get:
$$^0 H_3 (\theta_1=0, \theta_2=0, \theta_3=0)= \begin{bmatrix}1 & 0 & 0 & a_2 + a_3\\0 & 0 & 1 & 0\\0& -1 & 0 & d_1\\0&0&0&1\end{bmatrix}$$

The translation vector tells us what is the position of the end effector frame in relation to world frame. This configuration is presented in Fig. below. We can see that $$x=a_2 + a_3$$ and $$z=d_1$$ so everything matches values from a matrix.

The analysis of matrix rotation elements, for example:

• x-axis of a base frame and x-axis of an effector are oriented in the same direction. This is why we have $$1$$ on position (1,1) of the rotational matrix;
• $$^0 z$$ and $$^3 y$$ are opposite to each other this is why in position (3,2) we can find $$-1$$;
• The $$^0 x$$ and $$^3 z$$ are perpendicular to each other, this is why we have $$0$$ on position (1,3).

After doing above presented analysis we can assume, that the result is correct. Eventually you can also make a simulation study, which will be presented in some of the other tutorials.