categories: robotics, automation & robotics, mechanics
First post in a new series, this time on the matrix/geometry side of robotics rather than the physics side. We're starting with the most basic question you can ask about a robot arm: given where link $$i-1$$ is, where exactly is link $$i$$? The Denavit-Hartenberg (D-H) convention answers that with just four numbers per link, and once you have it, chaining links together to find the end-effector's pose is just matrix multiplication.
Task — the Denavit-Hartenberg transformation matrix
Every rigid link of a robot arm can be located relative to the previous one using just four numbers: $$\theta_i$$ (rotation about $$Z$$), $$d_i$$ (offset along $$Z$$), $$a_i$$ (link length along $$X$$), and $$\alpha_i$$ (twist about $$X$$). The task: derive the single homogeneous transformation matrix $$A_i$$ that carries coordinates from frame $$i-1$$ to frame $$i$$.
Step 1 — chain the four elementary transforms. The D-H convention builds $$A_i$$ as a fixed sequence: rotate about the old $$Z$$ axis, slide along it, slide along the new $$X$$ axis, then twist about that $$X$$ axis: $$A_i = \text{Rot}_{z,\theta_i}\cdot\text{Trans}_{z,d_i}\cdot\text{Trans}_{x,a_i}\cdot\text{Rot}_{x,\alpha_i}$$ Each factor is a simple 4×4 homogeneous matrix (a 3×3 rotation or a pure translation padded with an identity block), and multiplying them left-to-right composes the transforms in that same order.
Step 2 — multiply through to the closed-form result. Carrying out the matrix product gives the standard D-H link transform you'll find in every robotics textbook: $$A_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}$$ Read the matrix in blocks, not as 16 separate numbers: the upper-left 3×3 block is the rotation matrix $$R_i$$ (orientation of frame $$i$$ relative to frame $$i-1$$), the upper-right 3×1 column is the translation vector $$p_i$$ (position of frame $$i$$'s origin), and the bottom row $$[0\ 0\ 0\ 1]$$ is just bookkeeping that makes matrix chaining work — multiplying $$A_1\cdot A_2\cdots A_n$$ gives you the end-effector's full pose directly, without tracking rotation and position separately.
That's the whole trick behind forward kinematics: reduce every link to four numbers, turn each into one matrix, and multiply the chain. Next post: rotating things in 3D without the gimbal-lock mess that Euler angles eventually cause — quaternions. Thank you for reading!
Read more