Artificial potential fields

The goal pulls the robot in, each obstacle pushes it away, and the robot slides down the sum of the two. Drag things around and watch the wheel speeds change.

robot
goal (attracts)
obstacle (repels)
F attractive
F repulsive
F total

Drag the robot, goal or obstacles. Double-click empty space to add an obstacle, double-click an obstacle to remove it. Colour bands are equipotential lines; the robot moves downhill.

Field parameters

Differential drive, live

Vdes = k·Flinear
ωdes = k·Fangular
VL = Vdes − Bωdes/2
VR = Vdes + Bωdes/2
|F| total
Flinear (along heading)
Fangular (heading error, rad)
Vdes
ωdes
VLeft
VRight

Model used

Uatt = ½ katt dgoal²
|Frep| = krep (ρ0/d − 1)(ρ0/d) for d < ρ0, else 0
F = −∇(Uatt + Urep)
d = gap between robot body and obstacle surface