Back to all posts
Tutorial

Part 3: Solving the "Where Am I?" Problem (IK)

Ensemble AI
June 20, 2026
3 min read

Welcome to Part 3 of "Robotics Zero to Hero." So far, we've learned how to map joint angles to an end-effector position using Forward Kinematics (FK). But in the real world, a robot is usually given a goal: "Grab that cup at coordinates (X, Y, Z)."

To achieve this, the robot must figure out the specific joint angles required to reach that target. This is the Inverse Kinematics (IK) problem.

The Math: Inverse Kinematics and the Jacobian

For simple robots (like a 2-link planar arm), we can find an exact analytical solution using trigonometry. However, for complex robots with 6+ degrees of freedom—like our continuum octopus tentacle—analytical solutions are often impossible. Instead, we use numerical methods.

We want to find joint variables q\mathbf{q} such that our forward kinematics function FK(q)FK(\mathbf{q}) equals the target pose xtarget\mathbf{x}_{target}. This is a root-finding problem:

xtargetFK(q)=0\mathbf{x}_{target} - FK(\mathbf{q}) = \mathbf{0}

The Jacobian Matrix

To solve this iteratively, we rely on the Jacobian Matrix, J(q)J(\mathbf{q}). The Jacobian relates the velocity of the joints q˙\mathbf{\dot{q}} to the velocity of the end-effector x˙\mathbf{\dot{x}}:

x˙=J(q)q˙\mathbf{\dot{x}} = J(\mathbf{q}) \mathbf{\dot{q}}

If we want the end-effector to move a small step toward the target (Δx\Delta \mathbf{x}), we can calculate the required small change in joint angles (Δq\Delta \mathbf{q}):

Δq=J(q)1Δx\Delta \mathbf{q} = J(\mathbf{q})^{-1} \Delta \mathbf{x}

Because the Jacobian is rarely square or invertible, we often use the Moore-Penrose Pseudoinverse JJ^\dagger, or alternative methods like the Jacobian Transpose JTJ^T, which behaves like a gradient descent step toward the target.

Python Implementation: Numerical IK Solver

Instead of manually calculating the Jacobian, a robust way to solve IK in software is by framing it as a nonlinear optimization problem. We want to minimize the distance between the current tip position and the target.

Here is a Python snippet using scipy.optimize to solve an IK problem.

Loading Interactive Python Environment...

Focus on the Octopus: Reachability Analysis

For a rigid robot, IK tells us the joint angles. For the metallic continuum octopus robot, IK is exponentially harder. A tentacle has theoretically infinite degrees of freedom.

Because it is highly redundant (hyper-redundant), there are infinitely many ways a tentacle can configure itself to reach a specific point. We resolve this redundancy by adding secondary constraints to our cost function—such as minimizing the total bending energy, avoiding obstacles, or ensuring the "suction cups" face a specific direction.

Before deploying our control algorithms, we perform Reachability Analysis: running our IK solver millions of times across a 3D grid to map out the exact volume of space the tentacle can physically reach without violating its mechanical bending limits.

In Part 4, we will introduce forces, mass, and acceleration as we transition from Kinematics to Dynamics.

Ready to automate your operations?

Schedule a consultation with our robotics procurement experts today.

Request Analysis

Ensemble Assistant

Ready

Quick Actions: