We studied an automapping algorithm for an autonomous robot having ultrasonic range sensors. A robot with a working environment map operates smoothly. The robot consisted of an automapping algorithm using ultrasonic range sensors and a path planning algorithm. Ultrasonic range sensors are basic, inexpensive, and compact. We proposed an automapping algorithm introducing a parameter, valid length, for a robot with ultrasonic range sensors. The map was based on an occupancy grid. Computer simulation confirmed the effectiveness of introducing valid length in mapping by an autonomous robot. We discuss proposed distinctions and performance.