A robot with a learning control function for improving the accuracy of the
trajectory of an end effector and a method for controlling the robot. An
acceleration sensor and a vision sensor are attached to the end effector
of the robot. In this state, the motion of the end effector is measured
and a test operation of a motion program is repeatedly executed, whereby
a robot control device learns an optimized motion of the robot. In a
subsequent actual operation, the acceleration sensor and the vision
sensor are not used and the motion of the robot is executed based on the
learned optimized motion. The sensors may be removed during the actual
operation.