MyRoboPathOpen Robotics Lab
Robotics Mathematics & Kinematics18 min readUpdated 2026-03-30All Levels

Robot Kinematics Explained: Forward, Inverse & Differential Kinematics

The Mathematical Blueprint for Robotic Arms, Joint Space Transformations, Jacobians & Differential Drive Navigation

MyRoboPath Spatial Robotics Lab
Kinematics & Manipulation Core Team
Robot Kinematics Explained: Forward, Inverse & Differential Kinematics
Spatial Pose Representation
4x4 Matrix SE(3)
Combines 3x3 rotation and 3x1 translation
Arm Redundancy
7+ DOF
Allows reaching poses with infinite self-motion configurations
Singularity Threshold
det(J) ≈ 0
Loss of rank causing infinite joint velocities
Mobile Kinematic Model
Non-holonomic
Cannot move sideways instantaneously without turning

Core Engineering Takeaways

  • •Kinematics describes the relationship between robot joint positions, velocities, and end-effector spatial positions without considering masses or forces.
  • •Forward Kinematics (FK) is deterministic and computationally simple: given joint angles (θ1, θ2, ...), it calculates the unique end-effector pose (x, y, z, roll, pitch, yaw).
  • •Inverse Kinematics (IK) is complex and non-linear: given a target spatial pose, it calculates the required joint angles. A robot may have multiple valid solutions, zero solutions (out of reach), or infinite solutions (redundant robots).
  • •Homogeneous transformation matrices combine 3D rotation and 3D translation into a single 4x4 matrix, allowing multi-link kinematics through simple matrix multiplication.
  • •The Jacobian matrix maps joint angular velocities to end-effector Cartesian velocities (v = J(q) · q_dot).
  • •Singularities occur when the Jacobian matrix loses rank (det(J) = 0). At a singularity, the robot loses the ability to move in one Cartesian direction and requires infinite joint velocity to escape.
  • •For differential drive mobile robots, wheel angular velocities translate to linear speed v and angular turn rate ω via wheel radius r and track width L.
Prerequisites
  • Linear algebra (vectors, matrices, matrix multiplication, determinants)
  • Trigonometry (sine, cosine, tangent, arctan2, law of cosines)

1. What is Kinematics? Geometry Without Forces

Robotics mechanics is divided into two disciplines:

  1. 1
    Kinematics: The study of motion purely in terms of geometry, displacement, velocity, and acceleration, completely ignoring the masses, inertias, and forces that cause that motion.
  2. 2
    Dynamics: The study of the forces, torques, and motor currents required to physically create those kinematic accelerations (using Newton-Euler or Lagrangian mechanics).

Before you can calculate how much motor torque is required to lift a payload, you must first know where the robot's links are physically located in 3D space. That geometric mapping is Kinematics.

2. Degrees of Freedom (DOF) & Coordinate Frames

What is a Degree of Freedom (DOF)?

The number of Degrees of Freedom is the minimum number of independent coordinates required to completely specify the configuration or pose of a mechanical system.

  • A rigid object floating in free 3D space has 6 DOF:
  • 3 Position coordinates: Translation along XX, YY, and ZZ.
  • 3 Orientation coordinates: Rotation around XX (Roll), YY (Pitch), and ZZ (Yaw).

Joints as Constraints

Robotic joints connect rigid links while restricting specific relative motions:

  • Revolute Joint (R): 1 DOF rotational motion around a single axis (most common in arm joints).
  • Prismatic Joint (P): 1 DOF linear sliding motion along an axis (e.g., linear gantry, telescope slide).
  • Spherical Joint (S): 3 DOF rotational motion (ball-and-socket, like human shoulders).

Grubler's Criterion for Mobility

For a spatial mechanism with NN total rigid bodies (including the fixed base) and jj joints, where joint ii provides fif_i degrees of freedom:

M=6(N−1−j)+∑i=1jfiM = 6(N - 1 - j) + \sum_{i=1}^j f_i

A standard 6-axis industrial robot arm (e.g., KUKA, FANUC, Universal Robots UR5) has 6 revolute joints: N=7,j=6,fi=1N=7, j=6, f_i=1.

M=6(7−1−6)+6(1)=0+6=6 DOFM = 6(7 - 1 - 6) + 6(1) = 0 + 6 = 6\text{ DOF}

Having 6 DOF enables the end-effector to reach any arbitrary (x,y,z)(x, y, z) position within its reach envelope at any arbitrary (roll,pitch,yaw)(\text{roll}, \text{pitch}, \text{yaw}) orientation.

3. Homogeneous Transformations: SE(3) Matrix Math

To track an end-effector through space, robotics relies on attaching coordinate frames to each link. A point pB\mathbf{p}^B defined in Frame B is transformed into Frame A using a Homogeneous Transformation Matrix TBA∈SE(3)\mathbf{T}_B^A \in SE(3):

TBA=[R3×3d3×1 01×31]=[r11r12r13dx r21r22r23dy r31r32r33dz 0001]\mathbf{T}_B^A = \begin{bmatrix} \mathbf{R}_{3\times 3} & \mathbf{d}_{3\times 1} \ \mathbf{0}_{1\times 3} & 1 \end{bmatrix} = \begin{bmatrix} r_{11} & r_{12} & r_{13} & d_x \ r_{21} & r_{22} & r_{23} & d_y \ r_{31} & r_{32} & r_{33} & d_z \ 0 & 0 & 0 & 1 \end{bmatrix}
  • R3×3\mathbf{R}_{3\times 3} is an orthonormal rotation matrix describing the orientation of Frame B relative to Frame A.
  • d3×1=[dx,dy,dz]T\mathbf{d}_{3\times 1} = [d_x, d_y, d_z]^T is the translation vector representing the origin of Frame B relative to Frame A.

Chaining Transformations

The beauty of homogeneous transformations is that serial kinematic chains are solved through simple matrix multiplication:

Ttoolbase=T10⋅T21⋅T32⋅T43⋅T54⋅T65\mathbf{T}_{\text{tool}}^{\text{base}} = \mathbf{T}_1^0 \cdot \mathbf{T}_2^1 \cdot \mathbf{T}_3^2 \cdot \mathbf{T}_4^3 \cdot \mathbf{T}_5^4 \cdot \mathbf{T}_6^5

4. Forward Kinematics (FK) & Denavit-Hartenberg (DH) Convention

Forward Kinematics Definition

Input: Joint coordinates q=[θ1,θ2,…,θn]T\mathbf{q} = [\theta_1, \theta_2, \dots, \theta_n]^T Output: End-effector position and orientation [x,y,z,ϕ,θ,ψ]T[x, y, z, \phi, \theta, \psi]^T in the global base frame.

Forward kinematics always has exactly one unique solution. If your joint angles are known, the physical arm can only exist in one single location.

The 2-DOF Planar Arm Analytical Derivation

Consider a simple 2-link planar arm with link lengths L1L_1 and L2L_2 rotating on a horizontal plane:

  • Joint 1 rotates by angle θ1\theta_1 relative to the XX-axis.
  • Joint 2 rotates by angle θ2\theta_2 relative to Link 1.

Using basic trigonometry:

x=L1cos⁡(θ1)+L2cos⁡(θ1+θ2)x = L_1 \cos(\theta_1) + L_2 \cos(\theta_1 + \theta_2)
y=L1sin⁡(θ1)+L2sin⁡(θ1+θ2)y = L_1 \sin(\theta_1) + L_2 \sin(\theta_1 + \theta_2)
ϕ=θ1+θ2(End-effector orientation)\phi = \theta_1 + \theta_2 \quad (\text{End-effector orientation})

The Denavit-Hartenberg (DH) Standard

For 3D serial manipulators with twisted axes, Jacques Denavit and Richard Hartenberg introduced the standard 4-parameter convention to represent any joint transformation:

  1. 1
    aia_i (Link Length): Distance between Zi−1Z_{i-1} and ZiZ_i measured along XiX_i.
  2. 2
    αi\alpha_i (Link Twist): Angle between Zi−1Z_{i-1} and ZiZ_i measured about XiX_i.
  3. 3
    did_i (Link Offset): Distance from origin Oi−1O_{i-1} to the intersection of XiX_i with Zi−1Z_{i-1} along Zi−1Z_{i-1}. (Variable for prismatic joints).
  4. 4
    θi\theta_i (Joint Angle): Angle between Xi−1X_{i-1} and XiX_i measured about Zi−1Z_{i-1}. (Variable for revolute joints).

5. Inverse Kinematics (IK): Analytic vs Numerical Solutions

Inverse Kinematics Definition

Input: Desired end-effector Cartesian target pose [x,y,z,roll,pitch,yaw][x, y, z, \text{roll}, \text{pitch}, \text{yaw}] Output: Required joint angles q=[θ1,θ2,…,θn]T\mathbf{q} = [\theta_1, \theta_2, \dots, \theta_n]^T.

Inverse Kinematics is significantly harder than Forward Kinematics because:

  • Non-linear equations: Involves coupled trigonometric systems.
  • Multiple solutions: A human arm can touch a table with elbow up or elbow down.
  • Out-of-workspace singularities: If the target is beyond L1+L2L_1 + L_2, no solution exists.

Analytic (Closed-Form) IK for a 2-DOF Arm

For our 2-link planar arm, we can solve for θ1\theta_1 and θ2\theta_2 using the Law of Cosines:

D=x2+y2−L12−L222L1L2=cos⁡(θ2)D = \frac{x^2 + y^2 - L_1^2 - L_2^2}{2 L_1 L_2} = \cos(\theta_2)
θ2=atan2(±1−D2,  D)\theta_2 = \text{atan2}\left(\pm \sqrt{1 - D^2},\; D\right)
  • The +…+ \sqrt{\dots} yields the Elbow-Down configuration.
  • The −…- \sqrt{\dots} yields the Elbow-Up configuration.

Once θ2\theta_2 is selected:

θ1=atan2(y,x)−atan2(L2sin⁡(θ2),  L1+L2cos⁡(θ2))\theta_1 = \text{atan2}(y, x) - \text{atan2}\left(L_2 \sin(\theta_2),\; L_1 + L_2 \cos(\theta_2)\right)

Analytic Inverse Kinematics (Law of Cosines for 2-Link Arm)

cos⁡(θ2)=x2+y2−L12−L222L1L2\cos(\theta_2) = \frac{x^2 + y^2 - L_1^2 - L_2^2}{2 L_1 L_2}
In Simple Words: The elbow angle θ2 is derived directly from target distance squared minus the sum of link lengths squared, normalized by link products.
Variables Breakdown:
x,yx, y
Cartesian coordinates of target end-effector positionUnit: meters
L1,L2L_1, L_2
Lengths of Link 1 and Link 2Unit: meters
θ2\theta_2
Relative joint angle of the second jointUnit: radians
Worked Example:

Target (x=0.3, y=0.4), L1=0.3m, L2=0.3m: x^2+y^2 = 0.25. D = (0.25 - 0.09 - 0.09) / (2*0.09) = 0.07 / 0.18 = 0.3889. θ2 = acos(0.3889) ≈ 1.17 rad (67.1°).

6. Differential Kinematics: The Jacobian Matrix & Singularities

Mapping Velocities with the Geometric Jacobian

While basic kinematics relates positions, control algorithms need to relate velocities. The Jacobian matrix J(q)\mathbf{J}(\mathbf{q}) is a multidimensional derivative matrix that maps joint angular velocities q˙\dot{\mathbf{q}} to the Cartesian linear velocity v\mathbf{v} and angular velocity ω\boldsymbol{\omega} of the end-effector:

[v ω]=J(q)q˙\begin{bmatrix} \mathbf{v} \ \boldsymbol{\omega} \end{bmatrix} = \mathbf{J}(\mathbf{q}) \dot{\mathbf{q}}

For our 2-DOF planar arm:

J(q)=[∂x∂θ1∂x∂θ2\[6pt]∂y∂θ1∂y∂θ2]=[−L1sin⁡θ1−L2sin⁡(θ1+θ2)−L2sin⁡(θ1+θ2)\[6pt]L1cos⁡θ1+L2cos⁡(θ1+θ2)L2cos⁡(θ1+θ2)]\mathbf{J}(\mathbf{q}) = \begin{bmatrix} \frac{\partial x}{\partial \theta_1} & \frac{\partial x}{\partial \theta_2} \[6pt] \frac{\partial y}{\partial \theta_1} & \frac{\partial y}{\partial \theta_2} \end{bmatrix} = \begin{bmatrix} -L_1 \sin\theta_1 - L_2 \sin(\theta_1+\theta_2) & -L_2 \sin(\theta_1+\theta_2) \[6pt] L_1 \cos\theta_1 + L_2 \cos(\theta_1+\theta_2) & L_2 \cos(\theta_1+\theta_2) \end{bmatrix}

Kinematic Singularities: The Arm's Danger Zones

A singularity occurs at joint configurations where the Jacobian matrix loses rank (i.e., its determinant becomes zero: det⁡(J)=0\det(\mathbf{J}) = 0).

For our 2-DOF arm:

det⁡(J)=L1L2sin⁡(θ2)=0  ⟹  θ2=0∘ or 180∘\det(\mathbf{J}) = L_1 L_2 \sin(\theta_2) = 0 \implies \theta_2 = 0^\circ \text{ or } 180^\circ
  • Boundary Singularity (θ2=0∘\theta_2 = 0^\circ): The arm is stretched completely straight. It is physically impossible to create instantaneous velocity pointing outward along the arm, no matter how fast the motors spin.
  • Folded Singularity (θ2=180∘\theta_2 = 180^\circ): The arm is folded flat back onto itself.

If a Cartesian trajectory planner tries to drive an arm through a singularity using standard inverse kinematics q˙=J−1v\dot{\mathbf{q}} = \mathbf{J}^{-1} \mathbf{v}, J−1\mathbf{J}^{-1} approaches infinity, commanding impossible motor speeds and triggering emergency safety stops.

7. Mobile Robot Kinematics: Differential Drive Wheel Equations

Unlike robotic arms attached to concrete pedestals, mobile wheeled robots navigate across a 2D floor. The most ubiquitous chassis in service robotics (vacuum robots, warehouse AGVs, TurtleBot) is the Differential Drive system.

The Differential Drive Kinematic Model

The robot consists of two driven wheels of radius rr separated by track width LL, plus one or two passive caster wheels for balance.

  • vRv_R: Tangential linear velocity of right wheel =r⋅ωR= r \cdot \omega_R
  • vLv_L: Tangential linear velocity of left wheel =r⋅ωL= r \cdot \omega_L

The robot's forward linear velocity vv and angular yaw rate ω\omega around its center of rotation are:

v=vR+vL2=r2(ωR+ωL)v = \frac{v_R + v_L}{2} = \frac{r}{2}(\omega_R + \omega_L)
ω=vR−vLL=rL(ωR−ωL)\omega = \frac{v_R - v_L}{L} = \frac{r}{L}(\omega_R - \omega_L)

Dead Reckoning Odometry Update

In your robot's high-rate odometry thread running at sample period Δt\Delta t:

Δs=v⋅Δt\Delta s = v \cdot \Delta t
Δθ=ω⋅Δt\Delta \theta = \omega \cdot \Delta t
xk+1=xk+Δs⋅cos⁡(θk+Δθ2)x_{k+1} = x_k + \Delta s \cdot \cos\left(\theta_k + \frac{\Delta \theta}{2}\right)
yk+1=yk+Δs⋅sin⁡(θk+Δθ2)y_{k+1} = y_k + \Delta s \cdot \sin\left(\theta_k + \frac{\Delta \theta}{2}\right)
θk+1=θk+Δθ\theta_{k+1} = \theta_k + \Delta \theta
diff_drive_kinematics.py
python
import math

class DifferentialDriveKinematics:
    def __init__(self, wheel_radius_m: float, track_width_m: float):
        self.r = wheel_radius_m
        self.L = track_width_m
        self.x = 0.0
        self.y = 0.0
        self.theta = 0.0 # Radians

    def forward_kinematics(self, w_left_rad_s: float, w_right_rad_s: float) -> tuple[float, float]:
        """Compute robot linear velocity v (m/s) and angular velocity w (rad/s)."""
        v_l = self.r * w_left_rad_s
        v_r = self.r * w_right_rad_s
        v = (v_r + v_l) / 2.0
        w = (v_r - v_l) / self.L
        return v, w

    def inverse_kinematics(self, target_v: float, target_w: float) -> tuple[float, float]:
        """Convert target v and w into required wheel angular velocities (rad/s)."""
        w_left = (target_v - (target_w * self.L / 2.0)) / self.r
        w_right = (target_v + (target_w * self.L / 2.0)) / self.r
        return w_left, w_right

    def update_odometry(self, w_l: float, w_r: float, dt: float):
        """Integrate wheel encoder velocities to estimate position pose (x, y, theta)."""
        v, w = self.forward_kinematics(w_l, w_r)
        delta_s = v * dt
        delta_theta = w * dt

        # Runge-Kutta 2nd order integration
        self.x += delta_s * math.cos(self.theta + delta_theta / 2.0)
        self.y += delta_s * math.sin(self.theta + delta_theta / 2.0)
        self.theta = (self.theta + delta_theta + math.pi) % (2 * math.pi) - math.pi
Frequently Asked Questions

Common Questions & Troubleshooting

Q:What is the difference between holonomic and non-holonomic robots?

A holonomic robot (such as an omnidirectional chassis with Mecanum wheels) has controllable degrees of freedom equal to its total spatial degrees of freedom—it can drive sideways instantaneously without rotating. A non-holonomic robot (like a car or differential drive vacuum) cannot translate instantaneously in the lateral direction without first turning its heading.

Q:Why do industrial robots have 6 degrees of freedom instead of 7 or 8?

6 DOF is the exact mathematical minimum required to position an end-effector at any 3D Cartesian point (X, Y, Z) and point it in any orientation (Roll, Pitch, Yaw). Adding a 7th joint creates kinematic redundancy, which allows obstacle avoidance and joint limit mitigation, but significantly complicates inverse kinematics.

Q:How do trajectory generators avoid singularities?

Modern trajectory planners utilize Damped Least Squares (Levenberg-Marquardt) inversion instead of pure pseudo-inversion. As the manipulator approaches a singularity (det(J) -> 0), the algorithm introduces a damping factor λ that sacrifices slight Cartesian path accuracy to keep joint speeds within physical motor capabilities.