ยท Hankyu Kim ยท Robotics  ยท 2 min read

Analytical Inverse Kinematics

This post demonstrates how to compute the inverse kinematics of a 2-link planar robot arm using the Law of Cosines, providing a step-by-step guide for analytical solutions.

This post demonstrates how to compute the inverse kinematics of a 2-link planar robot arm using the Law of Cosines, providing a step-by-step guide for analytical solutions.

Introduction

In robotics, the inverse kinematics (IK) problem involves determining the joint parameters needed to place the end-effector of a robot arm at a desired position and orientation. For a planar arm with two links, this problem can be solved analytically using the Law of Cosines, offering a clear method to compute joint angles.


Problem Setup

Consider a planar robot arm with two links. Let the first link have length L1 and the second link have length L2. Denote the base joint angle as theta1 and the elbow joint angle as theta2. The end-effector is located at a target position (x, y). The goal is to compute the values of theta1 and theta2 that position the end-effector at the target.


Step 1: Compute the Elbow Angle

Using the Law of Cosines, the elbow angle can be determined as follows:

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}

Solving for theta2:

ฮธ2=arccosโก(x2+y2โˆ’L12โˆ’L222L1L2)\theta_2 = \arccos\left(\frac{x^2 + y^2 - L_1^2 - L_2^2}{2 L_1 L_2}\right)

This provides the elbow angle required to reach the desired end-effector position.


Step 2: Compute the Shoulder Angle

Once theta2 is known, the shoulder angle can be calculated using the geometric relationship:

ฮธ1=arctanโก(yx)โˆ’arctanโก(L2sinโก(ฮธ2)L1+L2cosโก(ฮธ2))\theta_1 = \arctan\left(\frac{y}{x}\right) - \arctan\left(\frac{L_2 \sin(\theta_2)}{L_1 + L_2 \cos(\theta_2)}\right)

This equation accounts for the relative positions of the links and the end-effector.


Example Calculation

Suppose the first link is 5 units long and the second link is 3 units long. The target end-effector position is (6, 4).

Step 1: Compute theta2

ฮธ2=arccosโก(62+42โˆ’52โˆ’322โ‹…5โ‹…3)=arccosโก(0.6)โ‰ˆ53.13โˆ˜\theta_2 = \arccos\left(\frac{6^2 + 4^2 - 5^2 - 3^2}{2 \cdot 5 \cdot 3}\right) = \arccos(0.6) \approx 53.13^\circ

Step 2: Compute theta1

ฮธ1=arctanโก(46)โˆ’arctanโก(3โ‹…sinโก(53.13โˆ˜)5+3โ‹…cosโก(53.13โˆ˜))โ‰ˆ14.22โˆ˜\theta_1 = \arctan\left(\frac{4}{6}\right) - \arctan\left(\frac{3 \cdot \sin(53.13^\circ)}{5 + 3 \cdot \cos(53.13^\circ)}\right) \approx 14.22^\circ

Therefore, the joint angles that position the end-effector at (6, 4) are approximately:

  • Shoulder: 14.22 degrees
  • Elbow: 53.13 degrees

Conclusion

Analytical solutions using the Law of Cosines provide an efficient method for solving the inverse kinematics of a planar 2-link arm. This approach is useful when precise control of the end-effector is required. Understanding this technique is a foundational skill in robotics and is essential for designing and controlling robotic manipulators.

Back to Blog
FABRIK

FABRIK

FABRIK(A Fast Iterative Solver for the Inverse Kinematics Problem) is a heuristic, iterative inverse kinematics solver that avoids complex matrix operations and singularities, providing smooth motion and fast convergence for robotic chains.

Numerical Inverse Kinematics

Numerical Inverse Kinematics

Numerical inverse kinematics can iteratively solve for joint angles to reach a desired end-effector position using gradient descent with the Jacobian pseudo-inverse, suitable for planar manipulators and more complex robotic arms.

DH Parameters

DH Parameters

Denavit-Hartenberg (DH) parameters provide a systematic way to describe robot geometry, linking kinematics, joints, and links for practical robot modeling and control.

Transformation Matrix

Transformation Matrix

The core idea of transformation matrices is that a point represented in one coordinate frame (B) can be expressed in another frame (A) by combining rotation and translation into a single operator.