# Module 3.1: Configuration Space (C-Space) Intuition

- Course: [Course 3: Motion Planning & Navigation](https://roboticsconcepts.dev/courses/motion-planning-navigation.md)
- HTML Page: https://roboticsconcepts.dev/courses/motion-planning-navigation/configuration-space-intuition/
- Key Concepts: Workspace vs. Configuration Space, C-space obstacle inflation, Shortest path in joint space

When I first tried to plan a path for a robot arm around a table, I kept drawing arrows around the table in 3D room coordinates and wondering why the elbow still clipped the lamp. You cannot just steer the fingertips — you have to account for the whole body of the robot.

## Why steering the hand isn't enough

Think about carrying a long wooden ladder through a narrow hallway corner. You can't just trace a neat line for the front tip of the ladder and assume the rest will follow cleanly; the back half swings wide and catches the doorframe.

A robot arm or a mobile base has the exact same problem in what we call the Workspace — the physical 2D or 3D room with tables, walls, and coffee mugs. Because the robot has links, wheels, and elbows sticking out, checking whether a whole multi-part shape fits through every point along a path gets messy fast.

## Shrinking the robot to a single point

Here is the mental flip that makes motion planning click: instead of tracking every link in the room, we list the robot's joint angles — say (θ₁, θ₂) for a two-link arm — and treat that pair of numbers as a point in a new map called Configuration Space (or C-space).

- In Workspace, the robot is a complicated multi-link shape moving around simple circles and boxes.
- In C-Space, the entire robot shrinks down to a single dimensionless dot at coordinates (θ₁, θ₂).
- The price we pay for that simplicity is that physical obstacles warp into curved, sometimes surprising forbidden blobs inside C-space.

## Interactive Sandbox: Synchronized Workspace & C-Space Obstacle Mapper

Slide the circular obstacle around the arm's workspace on the left, then click any cell inside the 24×24 (θ₁, θ₂) C-space grid on the right. Notice how a simple round obstacle in the room turns into a curved forbidden island in joint-angle space.

## Reading the obstacle map in joint angles

Try moving the obstacle close to the base joint so Link 1 can hit it. Suddenly a whole vertical stripe across the C-space grid turns red, because once θ₁ aims Link 1 into the obstacle, no value of θ₂ can save you.

Move the obstacle farther out where only Link 2 can reach it, and you get curved diagonal bands instead. Once that C-space map is built, planning a collision-free motion is much simpler: any continuous curve connecting start (θ₁, θ₂) to goal (θ₁*, θ₂*) through the open white cells is guaranteed not to hit anything in the room.

## From Workspace collision to C-space

```text
C_free = { q ∈ C | Robot(q) ∩ Obstacles = ∅ }
```

Every joint vector q maps to a full robot body pose via forward kinematics. The free space C_free is simply the set of joint configurations where no link touches an obstacle.

## Check Your Intuition

**Question:** If an obstacle sits close enough to the shoulder that Link 1 collides with it at θ₁ = 35°, what shape does that collision create on a (θ₁, θ₂) C-space plot?

- [ ] A single isolated dot at (35°, 0°)
- [✓] A full vertical strip around θ₁ = 35° spanning every possible θ₂
- [ ] A horizontal line along θ₂ = 35°

**Explanation:** Link 1's position only depends on θ₁. If Link 1 hits the obstacle at θ₁ = 35°, the arm is in collision regardless of how the elbow θ₂ is bent.

## Where You'll See This in Modern Robotics

Modern arm planners like MoveIt, cuRobo, and MuJoCo-based trajectory optimizers never actually draw a full grid in 7D C-space — instead, they query fast signed-distance collision checks at candidate joint vectors q along a path.

## Companion Python Notebook: 01 · Workspace to C-Space Obstacle Mapping Lab

Sample a 2-link arm across (θ₁, θ₂), check segment-circle collisions, and run BFS directly in configuration space to dodge physical obstacles.

- Open in molab (WASM): https://molab.marimo.io/github/alchemicduncan/robotics-concepts-dev/blob/main/notebooks/course-3/01_configuration_space_intuition.py/wasm
- Open in Google Colab: https://colab.research.google.com/github/alchemicduncan/robotics-concepts-dev/blob/main/notebooks/colab/course-3/01_configuration_space_intuition.ipynb
- Download .py: https://roboticsconcepts.dev/downloads/notebooks/course-3/01_configuration_space_intuition.py
- Download .ipynb: https://roboticsconcepts.dev/downloads/notebooks/colab/course-3/01_configuration_space_intuition.ipynb
- Run locally: `uvx marimo edit --sandbox notebooks/course-3/01_configuration_space_intuition.py`
