Wally is a wall following robot that uses ultrasonic (ping) sensors to detect objects in its path, much like a bat uses SONAR to "see" things around it. Ultrasonic sensors are like high-frequency microphone/speakers. To determine the distance of an object in front of it, you must send an electrical signal through the sensor as you would a speaker - the sound that comes out is within the audible frequncy range for a human, but close to the limit (somewhere around 24,000Hz) so you can hear a slight ticking noise when it is sending a signal. The sound wave that comes out of the sensor serves to bounce off nearby objects and return to the sensor. So after the signal is sent, the sensor must then wait to see how long the signal takes to return - which provides enough information to calculate the distance of the object detected. There is a company named Maxbotix that sells ultrasonic sensors that do all the calculating for you and output a constant signal proportional to the distance of any detected objects. This means that it is as easy to read with a microcontroller as connecting it to an analog input pin.
Wally uses an Arduino to read 3 of these ultrasonic sensors and determines his position in a room. One main sensor facing forward determines if there is any obstacles in front of him, while two parallel sensors mounted on his right side (facing right) check to see how far away the wall is. By mounting one sensor on each end of his frame, he can accurately determine if he is traveling away from or towards the wall he is following, and then make corrections to straighten his position. He will drive until he finds a wall on his right side to follow. Upon finding a wall, Wally will try to stay exactly 12" away from that wall at all times while driving forward. If he encounters a corner or the end of a wall, he will follow it accordingly.
Check out a video of him in action (navigating my living room and kitchen):