A robot controller is disclosed in which a specific target position is
predetermined in order to define approaching and leaving paths for a
robot hand, and a plurality of different path patterns are stored in a
path pattern storage means as the approaching and leaving paths along
which the robot hand approaches and leaves the predetermined specific
target position. Next, based on a workpiece position detected by a visual
sensor, one of the path patterns stored in the path pattern storage means
is selected, and the selected path pattern is modified so that the target
position of the robot hand is coincident with the actual workpiece
position. The modified path pattern is defined as revised approaching and
leaving paths and the robot hand is moved along the revised approaching
and leaving paths.