thebotslam

Coding your bot

How do I keep my bot from driving into walls and obstacles?

Carry a rangefinder (RNG-1) and point it ahead with rangefinder.bearing = chassis.heading: rangefinder.range tells you how far the first wall, block or bot is, up to 30 m. Turn away when it gets close. A GPS helps too: if you're at full throttle but your position hardly changes, you're pushing against something, so back off.

Read the full answer, step by step