Sign In / Join Cloud 360
Engineering • Innovation • Learning
Robotics & Automation Advanced Level 25 min

Planar Robotic Manipulators: Forward & Inverse Kinematics

Denavit-Hartenberg parameters, geometric forward kinematics, Law of Cosines inverse kinematics, and Jacobian velocity mapping.

Prerequisites: Matrix algebra, trigonometry (Law of Cosines, atan2), and vector dot/cross products.

1. Overview & Concept Definition

Mathematical formulation governing the spatial relationship between robotic joint angles ($\theta_1, \theta_2$) and the Cartesian position/velocity ($x, y$) of the end-effector.

2. Engineering & Industrial Significance

Enables robotic arms to reach targeted coordinates in 2D/3D space for pick-and-place, welding, painting, and surgical operations.

3. Physical Working Principle & Transducer Dynamics

Forward Kinematics maps given joint configurations into end-effector Cartesian coordinates using successive homogeneous coordinate frame transformations ($T_0^2 = A_1 A_2$). Inverse Kinematics solves the reverse: given a desired target $(x, y)$, calculate required joint angles. For a 2-DOF planar arm with link lengths $l_1$ and $l_2$, the Law of Cosines yields two geometric solutions (elbow-up and elbow-down configurations). Differential kinematics uses the Jacobian matrix $J(\vec{\theta})$ to relate joint angular velocities to Cartesian velocities.

4. Governing Equations & Mathematical Models

Forward Kinematics: $x = l_1 \cos\theta_1 + l_2 \cos(\theta_1 + \theta_2)$
Forward Kinematics: $y = l_1 \sin\theta_1 + l_2 \sin(\theta_1 + \theta_2)$
Inverse Kinematics (Elbow Angle): $\cos\theta_2 = \frac{x^2 + y^2 - l_1^2 - l_2^2}{2 l_1 l_2}$
Elbow Angle Solution: $\theta_2 = \text{atan2}\left(\pm\sqrt{1 - \cos^2\theta_2},\; \cos\theta_2\right)$
Base Angle Solution: $\theta_1 = \text{atan2}(y, x) - \text{atan2}(l_2 \sin\theta_2,\; l_1 + l_2 \cos\theta_2)$
Jacobian Matrix: $J = \begin{bmatrix} -l_1 \sin\theta_1 - l_2 \sin(\theta_1+\theta_2) & -l_2 \sin(\theta_1+\theta_2) \\ l_1 \cos\theta_1 + l_2 \cos(\theta_1+\theta_2) & l_2 \cos(\theta_1+\theta_2) \end{bmatrix}$

5. Practical Implementation

// C++: Analytical 2-DOF Planar Inverse Kinematics Solver
#include <math.h>

bool solve2DOFIK(float x, float y, float l1, float l2, bool elbowUp, float *theta1, float *theta2) {
    float rSquared = x * x + y * y;
    float cosTheta2 = (rSquared - l1 * l1 - l2 * l2) / (2.0f * l1 * l2);

    // Workspace reachability check
    if (cosTheta2 < -1.0f || cosTheta2 > 1.0f) {
        return false; // Target point is outside reachable workspace envelope
    }

    float sinTheta2 = sqrtf(1.0f - cosTheta2 * cosTheta2);
    if (!elbowUp) sinTheta2 = -sinTheta2;

    *theta2 = atan2f(sinTheta2, cosTheta2);
    float k1 = l1 + l2 * cosTheta2;
    float k2 = l2 * sinTheta2;
    *theta1 = atan2f(y, x) - atan2f(k2, k1);

    return true; // Valid joint solution found
}

6. Common Engineering Pitfalls & Troubleshooting

Frequent Engineering Pitfalls
  • Commanding points outside the reach envelope $(l_1 + l_2)$: Results in `NaN` math errors when taking `sqrt()` or `acos()`. Always check radius constraint $r \le l_1 + l_2$.
  • Ignoring mechanical singularities: When the arm is fully extended or folded, $\det(J) = 0$, requiring infinite joint velocities to move in certain Cartesian directions.
Diagnostic & Troubleshooting Checklist
  • Verify joint angle convention: Most DH models define $\theta_2$ relative to link 1's centerline, whereas hobby servos are often mounted relative to absolute mechanical stops.
  • Use trajectory interpolators (S-curve or cubic polynomial) to prevent abrupt acceleration steps between Cartesian targets.

7. Applications & Physical Constraints

TYPICAL APPLICATIONS
  • SCARA industrial pick-and-place robots
  • Planar laser engraving and 2D drawing plotters
  • Leg trajectory planning in quadruped walking robots
PHYSICAL LIMITATIONS
  • Planar equations ignore orientation constraints ($z$-axis, roll/pitch). A 6-DOF articulated arm requires $4 \times 4$ homogeneous matrices or iterative numerical solvers (e.g. Levenberg-Marquardt).
Pinout & Interface Specs
PIN / SIGNAL FUNCTION / ELECTRICAL SPEC
Joint 1 Base servo / motor with encoder feedback
Joint 2 Elbow servo / motor with encoder feedback
EE End-effector gripper / tool center point (TCP)
Have questions on this topic?

Ask LUNA to calculate component values or explain alternative control methods for Planar Robotic Manipulators: Forward & Inverse Kinematics.