Skip to main content

Chapter 01: Robot Kinematics

Overview​

This chapter introduces the mathematical foundations of robot kinematicsβ€”the study of motion without considering forces. You'll learn how to describe robot position, orientation, and motion using coordinate transformations and mathematical models.

Learning Objectives​

  • Understand coordinate systems and transformations
  • Master forward kinematics calculations
  • Learn rotation representations (Euler angles, quaternions)
  • Apply homogeneous transformations
  • Model robot joint configurations

Core Concepts​

1. Coordinate Systems and Frames​

Frame Definition:

A coordinate frame consists of:

  • Origin: Reference point (O)
  • Axes: Three orthogonal vectors (X, Y, Z)
  • Orientation: How axes are oriented in space

Frame Representation:

World Frame (W)          Robot Base Frame (B)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Z β”‚ β”‚ Z β”‚
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ └──X β”‚ β”‚ └──X β”‚
β”‚ β•± β”‚ β”‚ β•± β”‚
β”‚ Y β”‚ β”‚ Y β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Transformation Matrix:

T = \begin{bmatrix}
R & t \\
0 & 1
\end{bmatrix}

Where:

  • R = 3Γ—3 rotation matrix
  • t = 3Γ—1 translation vector

2. Rotation Representations​

Comparison of Rotation Methods:

MethodParametersAdvantagesDisadvantages
Euler Angles3 (roll, pitch, yaw)Intuitive, compactGimbal lock
Rotation Matrix9 (3Γ—3 matrix)No singularitiesRedundant
Quaternions4 (w, x, y, z)No gimbal lock, efficientLess intuitive
Axis-Angle4 (axis + angle)Minimal representationSingular at 0Β°

Euler Angles to Rotation Matrix:

import numpy as np

def euler_to_rotation_matrix(roll, pitch, yaw):
"""
Convert Euler angles (ZYX convention) to rotation matrix
"""
# Individual rotation matrices
R_x = np.array([
[1, 0, 0],
[0, np.cos(roll), -np.sin(roll)],
[0, np.sin(roll), np.cos(roll)]
])

R_y = np.array([
[np.cos(pitch), 0, np.sin(pitch)],
[0, 1, 0],
[-np.sin(pitch), 0, np.cos(pitch)]
])

R_z = np.array([
[np.cos(yaw), -np.sin(yaw), 0],
[np.sin(yaw), np.cos(yaw), 0],
[0, 0, 1]
])

# Combined rotation (ZYX order)
R = R_z @ R_y @ R_x
return R

# Example
rotation = euler_to_rotation_matrix(
roll=np.pi/6, # 30 degrees
pitch=np.pi/4, # 45 degrees
yaw=np.pi/3 # 60 degrees
)

3. Forward Kinematics​

Forward Kinematics Process:

Joint Angles (θ₁, ΞΈβ‚‚, ..., ΞΈβ‚™)
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Transformation β”‚
β”‚ Chain β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
End-Effector Pose
(x, y, z, roll, pitch, yaw)

2-DOF Robot Arm Example:

import numpy as np
import matplotlib.pyplot as plt

class TwoDOFRobot:
def __init__(self, L1=1.0, L2=1.0):
self.L1 = L1 # Link 1 length
self.L2 = L2 # Link 2 length

def forward_kinematics(self, theta1, theta2):
"""
Calculate end-effector position from joint angles
"""
# Joint 1 position
x1 = self.L1 * np.cos(theta1)
y1 = self.L1 * np.sin(theta1)

# End-effector position
x2 = x1 + self.L2 * np.cos(theta1 + theta2)
y2 = y1 + self.L2 * np.sin(theta1 + theta2)

return (x2, y2), (x1, y1)

def visualize(self, theta1, theta2):
"""
Visualize robot configuration
"""
end_effector, joint1 = self.forward_kinematics(theta1, theta2)

plt.figure(figsize=(8, 8))
plt.plot([0, joint1[0]], [0, joint1[1]], 'b-', linewidth=3, label='Link 1')
plt.plot([joint1[0], end_effector[0]],
[joint1[1], end_effector[1]], 'r-', linewidth=3, label='Link 2')
plt.plot(0, 0, 'ko', markersize=10, label='Base')
plt.plot(joint1[0], joint1[1], 'go', markersize=8, label='Joint 1')
plt.plot(end_effector[0], end_effector[1], 'ro', markersize=8, label='End-Effector')
plt.grid(True)
plt.axis('equal')
plt.legend()
plt.title(f'Robot Configuration: θ₁={np.degrees(theta1):.1f}Β°, ΞΈβ‚‚={np.degrees(theta2):.1f}Β°')
plt.show()

# Example usage
robot = TwoDOFRobot(L1=1.0, L2=0.8)
robot.visualize(theta1=np.pi/4, theta2=np.pi/6)

4. Denavit-Hartenberg (DH) Parameters​

DH Parameter Convention:

ParameterSymbolDescription
Link LengthaDistance along X axis
Link TwistΞ±Rotation about X axis
Link OffsetdDistance along Z axis
Joint AngleΞΈRotation about Z axis

DH Transformation Matrix:

T_i^{i-1} = \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}

Example: 3-DOF Robot DH Table:

JointaΞ±dΞΈ
1090Β°d₁θ₁
2aβ‚‚00ΞΈβ‚‚
3a₃00θ₃

Technical Deep Dive​

Homogeneous Transformations​

Transformation Chain:

def compute_forward_kinematics(dh_params, joint_angles):
"""
Compute end-effector pose using DH parameters
"""
T = np.eye(4) # Identity matrix

for i, (a, alpha, d, theta) in enumerate(dh_params):
# Update theta with joint angle
theta = theta + joint_angles[i] if i < len(joint_angles) else theta

# Compute transformation matrix
T_i = np.array([
[np.cos(theta), -np.sin(theta)*np.cos(alpha),
np.sin(theta)*np.sin(alpha), a*np.cos(theta)],
[np.sin(theta), np.cos(theta)*np.cos(alpha),
-np.cos(theta)*np.sin(alpha), a*np.sin(theta)],
[0, np.sin(alpha), np.cos(alpha), d],
[0, 0, 0, 1]
])

# Chain transformations
T = T @ T_i

return T

# Extract position and orientation
position = T[:3, 3]
rotation = T[:3, :3]

Real-World Application​

Case Study: Industrial Robot Arm

A 6-DOF industrial robot arm uses forward kinematics for precise positioning:

Robot Specifications:

ParameterValue
DOF6
Reach1.5 m
Payload10 kg
RepeatabilityΒ±0.1 mm
Speed2 m/s

Workspace Visualization:

        Top View
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ β”‚
β”‚ Workspace β”‚
β”‚ ● β”‚ ← Robot Base
β”‚ β•± β•² β”‚
β”‚ β•± β•² β”‚
β”‚ β•± β•² β”‚
β”‚ β•± β•² β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Performance:

  • Position accuracy: 0.1 mm
  • Orientation accuracy: 0.01Β°
  • Cycle time: 2 seconds

Hands-On Exercise​

Exercise: Implement Forward Kinematics

Create a forward kinematics solver for a 3-DOF robot:

class ThreeDOFRobot:
def __init__(self):
self.dh_params = [
(0, np.pi/2, 0.3, 0), # Joint 1
(0.5, 0, 0, 0), # Joint 2
(0.4, 0, 0, 0) # Joint 3
]

def forward_kinematics(self, joint_angles):
"""
TODO: Implement forward kinematics
Returns: (position, orientation)
"""
# Your code here
pass

def visualize_workspace(self, num_samples=1000):
"""
Visualize robot workspace
"""
# Sample joint angles
# Compute end-effector positions
# Plot workspace
pass

Task:

  1. Implement forward kinematics
  2. Visualize workspace
  3. Identify reachable vs unreachable regions
  4. Calculate workspace volume

Summary​

Key takeaways:

  • Coordinate frames enable spatial reasoning
  • Rotation can be represented multiple ways
  • Forward kinematics maps joint space to task space
  • DH parameters provide systematic modeling
  • Homogeneous transformations chain robot links

Next: Chapter 2: Forward Kinematics

References​

  1. Spong, M. W., et al. (2020). Robot Modeling and Control. Wiley.
  2. Craig, J. J. (2005). Introduction to Robotics: Mechanics and Control. Pearson.
  3. Siciliano, B., et al. (2009). Robotics: Modelling, Planning and Control. Springer.