In the process of assembly and production,due to certain errors in geometric parameters,the linkage and joints will inevitably have slight differences,resulting in some errors when the robot operates.In order to reduce the influence of environment on robot motion accuracy,a design scheme of robot motion error compensation algorithm based on improved weight function distance is proposed.The twist angle is added before positioning the robot position to obtain the transformation matrix between the two coordinate systems of the robot.The absolute error of the robot motion positioning is calculated according to the linear calibration.The mathematical model of the robot distance error is established using the improved weight function,and preliminarily compensate the motion error.The deviation of the center point position and attitude of the robot end effector is calculated.The compensation problem is transformed into the robot motion optimization problem,and the objective function of the motion deviation optimization problem is obtained.The final compensation result is obtained through multiple iterations.The experimental results show that the error compensation effect of the proposed method is good,and the motion stability of the robot after center of gravity compensation is good.