Aiming at the problem of alignment deviation between shaft and hole caused by accumulated error in the assembly process of brake disc shaft hole, a trajectory planning method for compensating accumulated error is proposed. First, the path before the error is planned, and then the second compensation path is planned between the error position and the actual target point, so as to realize the accurate assembly of the brake disc. In this paper, the IRB 1410 robot is taken as the research object, and its kinematic model is established by using the improved D-H parameter method. The joint space quintic B-spline interpolation method was used to carry out trajectory planning, and the improved particle swarm optimization algorithm was introduced to solve the optimization. The optimal time and smooth trajectory were expected to be obtained. Then, using MATLAB software to simulate, compared with the nonoptimized trajectory, not only is the trajectory running time reduced from 8.6 s to 6.7 s but also the maximum joint change angle of each joint is reduced, which proves that the algorithm has optimization effect on trajectory running time and stability. Finally, the accuracy verification experiment of the algorithm is carried out, and the error between simulation and experiment is less than 6%, which shows the effectiveness of the method. This research provides a theoretical basis for improving the responsiveness and stability of brake disc assembly.