Back to all posts
Tutorial

Part 7: Planning and The Generative Shift

Ensemble AI
June 20, 2026
4 min read

Welcome to Part 7 of "Robotics Zero to Hero." We can now model our robot's geometry, calculate its kinematics, and stabilize its complex dynamics. The next step is autonomy: getting the robot from Point A to Point B without crashing into a wall.

This is the domain of Motion Planning.

The Math: Configuration Space and RRT

When humans plan a path, we look at the 3D world (Task Space). But for a robot with multiple joints, we must plan in Configuration Space (C-Space).

C-Space is an NN-dimensional space where NN is the number of joints. Every single point in C-Space represents a complete posture of the robot. Obstacles in the real world map to complex, warped geometric shapes in C-Space. The goal of motion planning is to find a continuous line through C-Space from the start posture qstart\mathbf{q}_{start} to the goal posture qgoal\mathbf{q}_{goal} that never touches an obstacle.

Rapidly-exploring Random Trees (RRT)

For robots with many degrees of freedom, calculating the exact boundaries of C-Space obstacles is computationally impossible. Instead, we use sampling-based algorithms like RRT.

The RRT algorithm works as follows:

  1. Initialize a tree with qstart\mathbf{q}_{start} as the root.
  2. Generate a random joint configuration, qrand\mathbf{q}_{rand}.
  3. Find the nearest node in the tree, qnear\mathbf{q}_{near}.
  4. Take a small step from qnear\mathbf{q}_{near} toward qrand\mathbf{q}_{rand} to create a new node, qnew\mathbf{q}_{new}.
  5. If the path from qnear\mathbf{q}_{near} to qnew\mathbf{q}_{new} is collision-free, add qnew\mathbf{q}_{new} to the tree.
  6. Repeat until the tree reaches qgoal\mathbf{q}_{goal}.

Python Implementation: A Simple Path Planner

Here is a conceptual framework for an RRT planner in pure Python and NumPy.

Loading Interactive Python Environment...

The Generative Shift: Diffusion Models

While RRT is great for simple navigation, what if the environment is insanely complex, or the robot must perform a nuanced task like grasping an irregularly shaped object? Traditional planners often fail.

Enter modern AI. We are currently witnessing a massive generative shift in robotics, driven by Diffusion Models.

Diffusion models work by taking structured data, slowly corrupting it with Gaussian noise until it is pure static, and training a neural network to reverse that process (denoising). In robotics, the "data" is a trajectory (a sequence of robot joint states over time).

A trajectory is a matrix τRH×D\boldsymbol{\tau} \in \mathbb{R}^{H \times D}, where HH is the time horizon and DD is the number of degrees of freedom. We define a forward diffusion process using a Stochastic Differential Equation (SDE):

dτ=f(τ,t)dt+g(t)dwd\boldsymbol{\tau} = \mathbf{f}(\boldsymbol{\tau}, t)dt + g(t)d\mathbf{w}

During inference (when the robot needs to plan a move), we start with pure random noise and use the reverse SDE to iteratively denoise the trajectory. We can condition this reverse process on the current environment (e.g., an image from the robot's camera) so the denoised trajectory naturally avoids obstacles and reaches the target.

Focus on the Octopus: Imagining Grasping Motions

For our metallic continuum octopus, grasping is a non-linear nightmare. A rigid robot uses a two-fingered gripper to pinch objects. An octopus wraps its entire tentacle around the object, conforming to its shape.

Calculating the kinematics of a conforming wrap is notoriously difficult using traditional RRT. Instead, we capture thousands of demonstrations of the tentacle successfully wrapping around various shapes using teleoperation.

We train a Diffusion Model on these trajectories. Now, when the octopus encounters an entirely new, unseen object, the AI effectively "imagines" how to wrap its tentacle around it by denoising a random trajectory conditioned on the camera feed.

In Part 8, we look at the hardware required to run these heavy AI models directly on the robot.

Ready to automate your operations?

Schedule a consultation with our robotics procurement experts today.

Request Analysis

Ensemble Assistant

Ready

Quick Actions: