After the reconfiguration of the modular robot, the inverse kinematics of robot and the relationship between robot system and vision system have to be determined. In this research, it is attempted to save the problem from users by training robot controller to move the end-effector to the center of the image took by camera with reinforcement learning. However, reinforcement learning is time-consuming and a hierarchical method is applied to reduce the time of learning. Also, to lessen the possibility of hazardous action during learning, it is done in simulation. After the completion of learning, the knowledge gained is used to control the real robot. The method is feasible for different relative positions between robot and camera.