This thesis proposes a method to control multiple robots at the same time by using ultrasonic signals of different periods, so that the robots can follow the operator in line. Use infrared sensors to judge the distance to obstacles to effectively avoid obstacles, then the ultrasonic sensors are used to determine the location of the transmitter and receiver, and use the signals of different periods to make the robot 1 following the operator and the robot 2 follow the robot 1. The experimental results found that the robot can accurately determine the direction of the signal source in the actual environment to achieve to follow the emitter in line and avoid obstacles. This function can be applied to automatic handling robots in warehouses.