A workpiece taking-out apparatus performs snap with a camera of a
three-dimensional visual sensor in a robot position for snap and captures
an image in a personal computer. The workpiece taking-out apparatus
detects workpieces to find a line of sight of the camera for each
workpiece, decides an area for height measurement by a range finder to
save height data in the area, and finds an intersection of line of sight
data of the camera and height distribution for each detected workpiece to
find a posture of the workpiece from the height data around it. Then, the
workpiece taking-out apparatus decides a workpiece to be taken out this
time from the position and the posture and decides a measurement position
of the three-dimensional visual sensor close to the workpiece. In the
measurement position, the workpiece taking-out apparatus performs main
measurement by the three-dimensional visual sensor to decide a robot
position for taking out a workpiece through check of the possibility of
interference and execute taking-out of the workpiece in the robot
position for taking out a workpiece through check of the possibility of
interference again.