Both the deviation position and the heading deviation of the AGV are generated by its deviation from the ideal guiding trajectory during the working process. in this paper, the method of inertial guidance and QR code are applied to correct this deviation of AGV. The position deviation and heading deviation are pretreated by performing Butterworth filtering and attitude calculation on the output of the inertial device. AGV accurately locates the four corners of QR code in the field of view and corrects the output of inertial devices to realize motion correction. The experimental results show that the posture deviation can be effectively eliminated before reaching to the next QR code positioning module. The positioning accuracy is less than 0.5 mm at a speed of 0.6 m/s.