The relationship between robot system and vision system has to be determined whenever the relative positions between robot and camera is changed. In order to determine the relationship between robot system and vision system automatically, we use reinforcement learning to train robot controller. According to the relative position between the end-effector and target in the image took by camera, the robot is trained to move the end-effector to the any target area assigned by user in the image took by camera. To lessen the possibility of hazardous action and reduce the time of learning, it is first done off-line in simulation. Then, using data obtained from off-line learning, on-line learning is executed on real robot. After the completion of learning, the knowledge gained is used to control the real robot to move the end-effector to the any target area assigned by user in the image took by camera.