Sonic Rangers are a type of sensor that uses sound to detect objects. Most sonic rangers use ultrasonic (frequencies above human hearing) sound to 'ping' at an object, and to detect the echo back. They use the time delay from the ping to the echo to calculate the distance the sound has travelled, and so half that distance is the range to the object.
These sonic rangers actually tell the controller the distance (digitally), but they need to be configured for each controller, and the specific environment.