The following is some advice provided me by David Anderson of the Dallas Personal Robotics Group (DPRG), which is what he called a "build sequence". It's basically a plan of action that will help anyone focus on getting their robot going, step by step.
Here's David's advice (edited slightly for context):
- Build or buy a two-wheel differential drive platform. Get a development system working and write enough code that you can set the motors' PWM at various constant velocities. Don't worry about encoders or PID or behaviors.
- Run the robot. Does it run in a straight line, or veer left or right? Can you make it run in a straight line by adjusting the two motors to different speeds? What is the slowest it can run? On a hard surface? On carpet? What is the slowest it can run and maintain a straight line? Can it climb over things? Like a doorway threshold or a book? What about with one wheel on carpet and one on a hard surface? It is good to know what problems encoders and PID are intended to solve.
- Build or buy a bumper and get a bumper behavior working. This is the "sensor of last resort" that will save and protect your robot when all other sensors fail or misread. The classic bump-and-run algorithm is a good place to start. If bump is on the right, stop, back up, turn left a bit, go forward a bit, release control. Same if bump is on left. If bump is in center, it's not so obvious what to do, so it invites creativity.
- Run the robot. A lot. The robot should be able to survive on its own in any environment. Watch it and see how it does. Does it get stuck and require human intervention? How could it recover from the situation on its own? What information does it need to know it's stuck? What should its response be? How can you solve the stuck-in-a-corner condition of the bump and run algorithm?
- Once you are confident the robot can survive on its own, start thinking about other sensors. Photo sensors, (basically just a cadmium sulfide cell as half of a voltage divider connected to an A/D input), in a pair pointing forward, angled slightly left and right, is an easy sensor/behavior to get working, and the results are quite satisfying. Turn toward the brighter side, perhaps with a deadzone in the center. The robot can seek toward bright lights, which change with its position, so it can apparently navigate a space quite intelligently. Or seek away from bright lights (turn away from brighter side). This plus the bumper should give you a robot you can play with, in any space.
- Run the robot. A lot.
- Now start looking at avoidance sensors. There are lots of ways to do this and more than one technique will probably be required for robust behaviors. I like IR proximity sensors with a wide FOV [Field of View], again in left/right pairs. The behavior is pretty simple: just turn away from a detection. But lidar, sonar, IR rangers, ping sensors, all are good things to experiment with. And as mentioned, robust behavior will probably require some combination of sensors.
- At this point you should have a robot that can be turned loose in any space, mostly not hit things, recover when it does, and navigate intelligently around the space based on the the room lighting.
Hope this is useful.
- [#1] A Differential Drive robot is one that has two wheels equally spaced from the center of the robot, usually with one or two casters to keep the robot from tipping over. If the left and right motors turn in opposite directions the robot will spin in place.
- [#2] Pulse Width Modulation (PWM) is a way to control the speed of a DC motor that rather than altering the voltage (say, from 0 to 6 volts on a motor rated 6 volts), we instead send high speed 6 volt square wave pulses to the motor and vary how much of the pulse is at 0 volts and how much is at 6 volts. This is called the duty cycle. By increasing the duty cycle we increase the amount of energy going to the motor and therefore its speed. This is the most common way of controlling the speed of a DC motor.
- [#3] Analog/Digital or A/D Converter is a device that can convert an analog (a varying voltage) signal into a number. Likewise, a D/A Converter can convert a number into a varying voltage.
- [#4] Infrared sensors use an LED to emit light in the infrared range and then a corresponding receiving device (like a phototransistor) that is sensitive to infrared light. Digital IR sensors return either a 0 or a 1 if they detect any light being returned within the range of the sensor, whereas analog IR sensors return a range of values corresponding to the distance to the reflecting object. The color of the object therefore has an impact on whether the sensor will detect it, as well as on the range.