It's QUITE COOL how the old Roombas find their way back to their charging dock without a camera or GPS or anything like that. The dock has an infrared LED and the robot has an infrared receiver (which is one "well actually" away from being an LED itself) and all the robot knows is, is this light getting brighter or dimmer as I'm turning these wheels in different ways.
And how do it know when it bumps into something? The front bumper compresses and puts a little bit of plastic in between two infrared LEDs.
And how do it know when it's about to fall down the stairs? It shines infrared downwards out of one LED and it bounces off the floor and up into another LED.
And how do it know how to follow a wall? It bounce the infrared off the wall
And how do it know to stay out of the forbidden room? Someone put down a little box with C cells in and an infrared LED and it sees that particular frequency of pulses and it turn around and go somewhere else vroom
It's just following the lights