Valve train is one of important mechanisms in internal combustion engine. The experiment is an important method to study the valve train. In the design of valve train experiment, the Permanent-Magnet Synchronous Motor (PMSM) is used as the driving force to drive the camshaft. PID controller based on compensation with repetitive control is designed to control the PMSM. It can eliminate all periodic errors in closed-loop control. And it has a virtue of nonparametric dependence on its control performance by combining with two control methods. An example has been given and simulation has been made. The simulation result shows that the controller apparently improves the position tracking precision and reduces the tracking error of servo system. So the PID control system based on compensation with repetitive control has a much higher accuracy than the PID control system has. It is fit for high-accuracy control of valve train.