A robot uses an infrared sensor including an infrared light source which produces pulses of infrared light. Optics focus reflections of the infrared light pulses from different portions of the environment of the robot to different detectors in a 2D array of detectors. The detectors produce an indication of the distance to the closest object in an associated portion of the environment. The robot can use the indications to determine features in the environment. The robot can be controlled to avoid these features.