thebotslam

Coding your bot

How do I make my bot turn to a heading and drive somewhere?

Set chassis.forward (throttle, −1 to 1) and chassis.turn (turn rate, −1 to 1, positive turns left). The chassis only drives the way it faces, so to go somewhere you turn toward it and drive. Steer by the difference between the bearing you want and chassis.heading, wrapped into −180..180 and divided by 45.

Read the full answer, step by step