To make a welding robot perform weaving and tracking under conditions adapted to a gap length.
The welding of joints A, B is performed by attaching a laser sensor 2 and a welding torch 3 to a robot tip 1. With the joint surface scanned (6A, 6B) with a laser beam 5, the laser sensor 2 periodically detects a welding line position and a gap length. Data with a time stamp of the present position of the sensor is periodically outputted from the robot to the sensor, so that a weld line position is determined as a robot data. With the weaving conditions selected that correspond to the range of a detected gap length g (x), the tip end 4 of the torch draws a locus WV in which tracking and weaving are superimposed. The switching of the weaving conditions is carried out in the timing that prevents disorder in the track.
OKUDA MITSUHIRO