## 机器人DH convention

[latexpage]A robot manipulator with $n$ joints will have $n + 1$ links since each joint connects two links. We number the joints from $1$ to $n$, and we number the links from $0$ to $n$, starting from the base. By this convention, joint $i$ connects link $i − 1$ to link $i$.

When joint $i$ is actuated, link $i$ moves. Therefore, link $0$ (the first link) is fixed. Of course, the robot manipulator could itself be mobile. But we will not consider this case for now, since it can be handled easily by slightly extending the techniques presented in the following.

To perform the kinematic analysis, we rigidly attach a coordinate frame
to each link. In particular, we attach $o_ix_iy_iz_i$ to link $i$. The frame $o_0x_0y_0z_0$, which is attached to the robot base, is referred to as the inertial frame.

It is helpful to be systematic in the choice of frames. A commonly used convention for selecting frames of reference in robotic applications is the Denavit-Hartenberg or D-H convention.

In this convention, each homogeneous transformation $A_i$ is represented as a product of four basic transformations.

where the four quantities $\theta_i$, $a_i$, $d_i$, $\alpha_i$ are parameters associated with link $i$ and joint $i$. The four parameters $\theta_i$ means joint angle, $a_i$ means link length, $d_i$ means link offset, $\alpha_i$ means link twist in (3.10).

These names derive from specific aspects of the geometric relationship between two coordinate frames. $a_i$, $d_i$, $\alpha_i$ are constant for a given link, while $\theta_i$ is the joint variable.

In the D-H representation, there are only 4 parameters instead of 6. How is this possible? The answer is that, while frame $i$ is required to be rigidly attached to link $i$, we have considerable freedom in choosing the origin and the coordinate axes of the frame. In fact, it is not even necessary that frame $i$ be placed within the physical link as long as frame $i$ is rigidly attached to link $i$.

Clearly, it is not possible to represent any arbitrary homogeneous transformation using only four parameters. Therefore, we begin by determining just which homogeneous transformations can be expressed in the form (3.10). 总之我们可以总结为the reference frames are laid out as follows:

1. 首先参考地面坐标系是已知的并且是固定的，即$ox_0y_0z_0$
2. 关节$1$对应的link $1$上的坐标系的$z$ axis为关节$1$的旋转轴
3. 有了$z_0$和$z_1$，因为$x_1=z_1\times z_{0}$(注意是从$z_1$到$z_0$，而不是$z_0$到$z_1$，也不是$z_1$到$z_2$)，由此我们就确定了$x_1$（common normal）的方向。最后基于右手坐标系，就可以知道$y_1$.
4. 有了$x_1$、$z_0$和$z_1$，可以算出$\alpha_1$。因为$\alpha_1$是绕着$x_1$的旋转的角度，绕着该轴它将$z_0$转到$z_1$。
5. 有了$x_{0}$和$x_1$的方向，就可以算出第一个参数$\theta_1$，因为$\theta_1$是绕着$z_{0}$旋转的角度，绕着该轴它将$x_{0}$转到$x_1$。如下图：

If there is no unique common normal ($x_n=z_n\times z_{n-1}$ (or away from $z_{n-1}$), then $d$ is a free parameter. The direction of $x_n$ is from $z_{n-1}$ to $z_{n}$.

$a_1$是link length。具体计算是因为$x_1$与$z_{0}$是垂直的，那么首先找到$x_1$和$z_0$的相交点，然后从原点$o_1$沿着$x_1$到交点的距离。

$d_1$是link offset。具体计算就是同样首先找到$x_1$与$z_{0}$的相交点，然后从原点$o_0$沿着$z_0$到交点的距离。如果joint 1是prismatic，那么$d_1$就是变量。

Under these conditions, we claim that there exist unique numbers $\theta_i$, $a_i$, $d_i$, $\alpha_i$ such that