---
id: wiki-2026-0508-denavit-hartenberg-parameters
title: Denavit-Hartenberg Parameters
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [DH parameters, DH convention, robot kinematics, link parameters]
duplicate_of: none
source_trust_level: A
confidence_score: 0.93
verification_status: applied
tags: [robotics, kinematics, dh-parameters, mathematics, transformation-matrix]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
  language: Python / Robotics
  framework: ROS / PyBullet / MoveIt
---

# Denavit-Hartenberg Parameters

## 매 한 줄
> **"매 robot link 의 4 parameter 의 standard description"**. 매 robot manipulator 의 forward kinematics. 매 (a, α, d, θ) 의 의 매 link 의 transformation. 매 modern variant: 매 modified DH (Craig).

## 매 핵심

### 매 4 parameter (classical Denavit-Hartenberg)
- **a** (link length): 매 z_{i-1} → z_i 의 X-axis 의 distance.
- **α** (link twist): 매 z_{i-1} → z_i 의 angle.
- **d** (link offset): 매 x_{i-1} → x_i 의 z-axis 의 distance.
- **θ** (joint angle): 매 x_{i-1} → x_i 의 z-axis 의 rotation.

### 매 transformation matrix
```
T_i = Rot_z(θ) * Trans_z(d) * Trans_x(a) * Rot_x(α)
```

### 매 forward kinematics
- 매 each link 의 T_i 의 multiply.
- 매 base → end-effector 의 pose.

### 매 modified DH (Craig)
- 매 frame 의 link's proximal end 의 attach.
- 매 less ambiguity.

### 매 응용
1. **Manipulator**: 매 6-DOF arm.
2. **Mobile robot**: 매 articulated.
3. **Surgical robot**: 매 da Vinci.
4. **Animation**: 매 IK.
5. **Drone arm**: 매 aerial manipulation.

## 💻 패턴

### Forward kinematics (Python)
```python
import numpy as np

def dh_matrix(a, alpha, d, theta):
    ca, sa = np.cos(alpha), np.sin(alpha)
    ct, st = np.cos(theta), np.sin(theta)
    return np.array([
        [ct, -st*ca,  st*sa, a*ct],
        [st,  ct*ca, -ct*sa, a*st],
        [0,      sa,     ca,    d],
        [0,       0,      0,    1],
    ])

def forward_kinematics(dh_table, joint_angles):
    """dh_table: [(a, alpha, d, theta_offset), ...]"""
    T = np.eye(4)
    for (a, alpha, d, off), q in zip(dh_table, joint_angles):
        T = T @ dh_matrix(a, alpha, d, off + q)
    return T

# 매 example: PUMA 560
puma = [
    (0,       np.pi/2,  0,    0),
    (0.4318,  0,        0,    0),
    (0.0203, -np.pi/2,  0.15, 0),
    (0,       np.pi/2,  0.4318, 0),
    (0,      -np.pi/2,  0,    0),
    (0,       0,        0,    0),
]
T = forward_kinematics(puma, [0, np.pi/4, -np.pi/4, 0, np.pi/2, 0])
print(T[:3, 3])  # 매 end-effector position
```

### Inverse kinematics (numerical Jacobian)
```python
def jacobian(dh_table, q, eps=1e-6):
    n = len(q)
    p0 = forward_kinematics(dh_table, q)[:3, 3]
    J = np.zeros((3, n))
    for i in range(n):
        q1 = q.copy(); q1[i] += eps
        p1 = forward_kinematics(dh_table, q1)[:3, 3]
        J[:, i] = (p1 - p0) / eps
    return J

def ik_newton(dh_table, target, q0, max_iter=100, tol=1e-4):
    q = q0.copy()
    for _ in range(max_iter):
        p = forward_kinematics(dh_table, q)[:3, 3]
        err = target - p
        if np.linalg.norm(err) < tol: break
        J = jacobian(dh_table, q)
        dq = np.linalg.pinv(J) @ err
        q += dq
    return q
```

### URDF integration
```python
# URDF 의 DH 의 convert
import xml.etree.ElementTree as ET

def urdf_to_dh(urdf_path):
    """매 URDF joint 의 DH-style approx."""
    tree = ET.parse(urdf_path)
    dh = []
    for joint in tree.findall('joint'):
        if joint.attrib['type'] == 'revolute':
            origin = joint.find('origin')
            xyz = [float(x) for x in origin.attrib['xyz'].split()]
            rpy = [float(x) for x in origin.attrib['rpy'].split()]
            # 매 simplification — true DH extraction 의 nontrivial
            dh.append((xyz[0], rpy[0], xyz[2], 0))
    return dh
```

### Workspace visualization
```python
def workspace_sample(dh_table, joint_limits, n=5000):
    points = []
    for _ in range(n):
        q = [np.random.uniform(lo, hi) for lo, hi in joint_limits]
        p = forward_kinematics(dh_table, q)[:3, 3]
        points.append(p)
    return np.array(points)

# 매 plot
import matplotlib.pyplot as plt
pts = workspace_sample(puma, [(-np.pi, np.pi)] * 6)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(pts[:, 0], pts[:, 1], pts[:, 2], s=1)
```

### Modified DH (Craig)
```python
def mdh_matrix(a, alpha, d, theta):
    """매 frame at proximal end."""
    ca, sa = np.cos(alpha), np.sin(alpha)
    ct, st = np.cos(theta), np.sin(theta)
    return np.array([
        [ct,    -st,   0,   a],
        [st*ca,  ct*ca, -sa, -d*sa],
        [st*sa,  ct*sa,  ca,  d*ca],
        [0,      0,     0,    1],
    ])
```

## 매 결정 기준
| 상황 | Approach |
|---|---|
| Standard manipulator | Classical DH |
| Avoiding singularity | Modified DH (Craig) |
| Modern simulation | URDF (rich features) |
| Closed-form IK | Pieper's solution (last 3 axes intersect) |
| Numerical IK | Jacobian-based |
| Beyond serial (parallel) | Stewart platform — DH X |

**기본값**: 매 manipulator 의 DH + 매 forward kinematics + 매 numerical IK + 매 URDF for sim.

## 🔗 Graph
- 부모: [[Robotics]]
- 변형: [[Inverse-Kinematics]]
- Adjacent: [[Degrees-of-Freedom]]

## 🤖 LLM 활용
**언제**: 매 robot manipulator design. 매 kinematics derivation. 매 sim setup.
**언제 X**: 매 parallel mechanism. 매 soft robot.

## ❌ 안티패턴
- **Confuse classical / modified**: 매 transform 의 wrong.
- **Ignore singularity**: 매 wrist 의 gimbal lock.
- **No joint limit**: 매 unreachable.
- **Pure forward 의 trust**: 매 IK 의 non-unique.

## 🧪 검증 / 중복
- Verified (Spong/Hutchinson/Vidyasagar Robot Dynamics).
- 신뢰도 A.

## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-04-20 | Auto-reinforced |
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — DH parameter + 매 forward / IK / URDF / modified DH code |
