pro's and con's of range sensors
During the February 2010 RSSC meeting, a small discussion on the pro's and con's of range sensors, particularly IR and ultrasonic, was held. This article gives a short overview of that discussion:
The group discusses range sensors. IR range sensors have a narrow beam but usually do not go very far (+- 5 feet). Ultrasonic sensors can go up to 30 feet (and some go farther) but have a much wider beam.
Ultrasonic sensors work well when it faces an obstacle dead-on. But when the angle becomes higher (approx greater than 40 degrees), the readings will show a greater distance then the actual distance. This can be aggrevated by bouncing off multiple surfaces.
IR range sensors have other types of problems. The beam is much narrower. This is generally good, but is prone to missing narrow objects like table legs. Your robot will have to take a lot of readings when scanning an IR range sensor. The more readings per revolution, the better the chance of picking up narrow objects.
Range sensors usually have an output vs distance response similar like in the following graph. The response is never linear and worse, for short distances can yield the same output as for further distances. On the graph, an object at distance D1 and another at distance D3 will yield the same output. You need to find out the point D2. Do not trust any readings that go lower than this. Then linearize the output with equation (K/d + offset). You find the value of K by taking many readings of objects at known distances.
A narrow-beam range sensor has another disadvantage: when mounting fixed sensors that like straight-ahead, it is more likely to miss objects that fall right outside the narrow beam. In the following diagram, only object 3 gets detected.
When you can not mount a scanning range sensor, at least orient them at crossing angles. Eventually, any object in the robot's path will be detected.
Here are some articles and tutorials:
tutorial: choosing an ultrasonic sensor
tutorial: sonar sensors
tutorial: Sharp IR range sensor
tutorial: The IR range sensor: Introduction
here is a video demonstrating an ultrasonic range sensor: