Local Reactive Obstacle Avoidance
Global planners like A* and RRT are great when you know the whole map ahead of time. Out in the real world, someone steps into the aisle with a pallet jack, and your robot has 50 milliseconds to decide how not to hit them.
Core ideas covered in this module
- Attractive & repulsive potential fields
- Local minima traps
- Dynamic Window Approach (DWA)
Goals that pull, obstacles that push
One of the cleanest mental models for reactive avoidance is the Artificial Potential Field. Picture your robot as a marble rolling on a stretchy rubber sheet.
You poke the sheet down at the goal so everything slopes smoothly toward it (an attractive potential), and you push sharp tents upward under every detected obstacle (repulsive potentials). Compute the downhill slope at your robot's current position, and you immediately get a steering velocity — no full graph search needed.
Where rubber-sheet physics gets trapped
Potential fields are fast and intuitive, which is why people fall in love with them — until their robot parks itself right in front of a couch and shivers in place. When the forward pull of the goal exactly cancels the backward push of an obstacle directly ahead, the net slope hits zero. That dead spot is a local minimum.
To avoid getting stuck while still respecting wheel speed and turning limits, mobile robots commonly use the Dynamic Window Approach (DWA) instead:
- Look only at velocities (linear v, angular ω) the motors can actually reach in the next fraction of a second — that's the 'dynamic window'.
- Simulate short forward arcs (say 1.5 seconds ahead) for dozens of candidate (v, ω) pairs.
- Discard any arc that clips an obstacle, then score the surviving arcs by heading toward the goal, speed, and clearance.
Pairing a global map with a fast local reflex
Notice the natural division of labor here. DWA only looks a couple of seconds ahead, so on its own it can still get fooled by a long dead-end corridor. Meanwhile, A* knows the whole building layout, but takes too long to re-run from scratch every 20 milliseconds when a person walks by.
Almost every practical navigation stack puts them together: a global planner lays down a coarse breadcrumb trail every second or two, and a local reactive controller like DWA or MPPI follows the next local breadcrumb while dodging surprise obstacles at high frequency.
Potential field force balance
F_total(x) = −∇U_att(x) − ∇U_rep(x)
The attractive gradient pulls toward the goal while the repulsive gradient pushes away inside an obstacle's influence radius. Whenever those two vectors cancel to zero away from the goal, the robot stalls in a local minimum.
Why does the Dynamic Window Approach (DWA) restrict its candidate (v, ω) arcs to a small 'window' around the robot's current speed instead of testing any speed up to top speed?
In modern robotics, DWA's sample-rollout idea evolved directly into Model Predictive Path Integral (MPPI) control and learned local planners, which roll out thousands of short trajectories in parallel on a GPU against live depth or LiDAR costmaps.
Hands-On Python Notebook
04 · Potential Fields & Dynamic Window Approach
Simulate artificial potential fields getting caught in a U-shaped trap, then escape using Dynamic Window velocity rollouts.
Try this on your own inside the notebook
- Place a U-shaped obstacle and tune repulsive gain to trigger a local minimum
- Adjust DWA heading vs. clearance weights and compare trajectories
In Google Colab, use File → Save a copy in Drive to keep your own edits and notes. Or download the files directly:
uvx marimo edit --sandbox notebooks/course-3/04_local_reactive_obstacle_avoidance.pyWrap up this module
Saved automatically in your browser profile so you can pick up right where you left off.