Line Follower

Our first application was the classic line-following program. The 3pi's motion is powered by a PID controller, based on the example in the 3pi User's GuideOpens in new window. Also, we've built in a safety feature so the robot will halt if it no longer detects a line for a brief period of time. This prevents it from running under tables (or off them) or in any general direction not intended for the robot. Although we could have tuned the robot's performance a great deal more by graphing PID and sensor values, we relied on our trusty eyeballs to provide us with feedback as to how well our PID controller was working.

The speed of the robot can be adjusted up or down by using the A or C push buttons. The B button will make the selection and start the program.

As a side note, the following procedure works great for tuning PID controllers.

  1. Start with initial P, I and D gains of 0.0
  2. Gradually increase proportional gain until the robot begins to oscillate
  3. Gradually increase derivative gain until the robot no longer oscillates from the previous proportional gain value
  4. Gradually increase integral gain until the robot starts to oscillate
  5. Dial back the integral gain slightly

Note: we actually didn't make use the integral term in the line-following application, as the robot performed very well without it.

Download Project Tabletop source code (which includes the line-following program) here.