Nonlinear error compensation based on the optimization of swing cutter trajectory for five-axis machining

In order to solve the problem of deviation between actual and theoretical machining paths due to the presence of rotation axis in five-axis machining, an interpolation algorithm based on the optimization of swing cutter trajectory and the method of corresponding nonlinear error compensation are proposed. Taking A-C dual rotary table five-axis machine tool as an example, the forward and reverse kinematic model of the machine tool is established according to the kinematic chain of the machine tool. Based on the linear interpolation of rotary axis, the generation mechanism of nonlinear error is analyzed, the modeling methods of cutter center point, and cutter axis vector trajectory are proposed respectively, and the parameterized model of swing cutter trajectory is formed. The formula for the nonlinear error is obtained from the two-dimensional cutter center point trajectory. According to the established model of swing cutter trajectory, the synchronous optimization method of cutter center point trajectory and cutter axis vector trajectory is proposed, and the nonlinear error compensation mechanism is established. First, pre-interpolation is performed on the given cutter location data to obtain a model of the swing cutter trajectory for each interpolated segment. Then, the magnitude of the nonlinear error is calculated based on the parameters of the actual interpolation points during formal interpolation, and the nonlinear error is compensated for the interpolation points where the error exceeds [ε]\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$[\varepsilon ]$$\end{document}. In the VERICUT simulation, the maximum machining error was reduced from 50 to 5 μm by this paper method. In actual machining, the surface roughness of the free-form surface was reduced from 10.5 μm before compensation to 1.8 μm. The experimental results show that the proposed method can effectively reduce the impact of nonlinear errors on processing, and is of high practical value for improving the accuracy of cutter position and the quality of complex free-form machining in five-axis machining.


Introduction
Five-axis CNC machine tools have high-speed, high-precision and complex free-form machining capabilities, widely used in the processing of impellers, blades, engine rotors and crankshafts and other precision devices [1] . Five-axis CNC machine tools have two more rotary axis compared to three-axis CNC machines, with higher machining freedom and more flexible tool orientation, but also due to the rotary motion of the tool brings a new principle error --nonlinear error. With the rapid development of the economy, nonlinear error have become critical research in the field of five-axis machining technology in order to better meet the needs of advanced manufacturing.
Although five-axis CNC machines are more flexible in tool attitude changes, there is a nonlinear relationship between the position coordinates of the rotary axis and the tool attitude. This makes the actual machining trajectory deviate from the ideal linear machining trajectory, which results in unavoidable nonlinear errors [2] . For this reason, many researchers in related fields have conducted a lot of research on the reduction of nonlinear error, among which the most important methods to reduce nonlinear error are improved interpolation algorithms, linear encryption of cutter location points, cutter location correction method and real-time error compensation. Sang [3] proposed a simplified calculation model for the deviation between ideal cutter trajectory and actual cutter trajectory caused by nonlinear motion of rotary and translational axis, and an improved interpolation algorithm considering geometric deviation and motion constraints, which improves the accuracy and efficiency of machining to a certain extent.
Ma [4] considered the nonlinear error of different rotation axes, derived the calculation formula for the change of rotation axis motion angle, and then constructed the feasible domain of high precision tool without interference with nonlinear error as a constraint, which is of great significance to improve the machining quality.
Liang [5] proposed a new strategy to control the nonlinear error problem in five-axis CNC machining by modifying the tool orientation to reduce the nonlinear error based on the machine tool kinematics and machining trajectory without increasing the cutter location data points, but this method cannot guarantee that the nonlinear error are reduced to within the allowed range of high precision machining requirements. Liu [6] proposed a new nonlinear error compensation method to establish a nonlinear error compensation model to obtain a cutter location that satisfies the machining accuracy, which in turn improves the geometric accuracy of the machined part. Tutunea Fatan [7] proposed a method for accurate error determination different from the conventional string differential method, describing the exact interpolation position law of the tool between two cutter contact points, but did not give a specific method for error compensation. Srijuntongsiri [8] proposed a theory that if the tool trajectory is fixed, the expected trajectory in five-axis machining depends only on the machine type and configuration. Tajima [9] investigated a new real-time trajectory generation technique for controlling tool tip and tool attitude errors. Wang [10] reduced the error by densifying the cutter location data. This method is effective in reducing the error, but it leads to multiplying the number of machining program entries. Zhu [11] used the method of modifying the G-code to compensate the geometric deviation of the tool trajectory, but it is not accurate enough for modeling the tool trajectory. Fu [12] established a new mathematical model of geometric errors and solved the optimal NC code using particle swarm algorithm, which in turn ensured the machining quality and machining efficiency. Zhong [13] used a multi-body system to model the geometric errors of a large five-axis machining center, and the errors were calculated and compensated by the least squares method to enable the machined parts to meet the design require-ments. Makhanov [14] proposed an interpolation algorithm based on uniform distribution in angular space to improve machining accuracy by constructing a uniform grid around tool contacts with large angular variations, and did not optimize the machining method from the perspective of non-linearty errors compensation. Wu [15] proposed a machining cutter location point preprocessing method based on NURBS curve fitting technique, which reduces the amount of CNC code and improves the machining efficiency of five-axis CNC machine tool while satisfying the error requirements. Fan [16] proposes a tool axis vector plane interpolation algorithm that can largely reduce the nonlinear error caused by linear interpolation of rotary axis, but it lacks verification of overall free-form surface machining and cannot illustrate the generality of the algorithm. Yang [17] analyzes the position where the deviation angle of the tool axis obtains the maximum value during the motion of the rotation axis, and proposes a method to limit the angle of the tool axis between adjacent cutter location point to control the nonlinear error.

The kinematic model of machine tool
The kinematic model of a CNC machine tool is a mathematical model. It is used to describe the relative motion relationship between the workpiece and the tool and the interrelationship of the motion of the individual motion subsets in CNC machine tool machining [18] .  Fig. 1. The machine tool is composed of X, Y, Z three translational axis and A, C two rotation axis, the rotation axis A is a fixed axis, and the machine bed fixed connection, rotary axis C for the dynamic axis, its axis direction with the A axis and change.
Where: s is the sine function and c is the cosine function.
2 Swing cutter trajectory modeling and nonlinear error model

Analysis of the mechanism of nonlinear error generation
Linear interpolation is commonly used in CNC machines, which has the advantages of simple programming, easy implementation and smooth machining. Under the WCS, the starting and ending cutter position information is as follows.
The coordinates of the starting cutter center point is Where: The schematic diagram of linear interpolation of the rotation axis angle is shown in Fig. 4, and the rotation axis angle of the ith interpolation point is obtained according to Eq. (5) [19] . Substituting this angle into the (1 )  8).   Table 1 Where: [δ] = 10 -5 l, l is the distance between the beginning and end cutter center points, d is much smaller than l, and the cutter center points can be considered as in the plane.
Bring P W 6 into the Eq.

16
Where: U and V is a 3-dimensional orthogonal matrix, Σ is a 3-dimensional matrix.
As shown in Fig. 6, the discrete cutter center points in one interpolation cycle lie in the same plane, then the cutter center point trajectory is also a plane curve. In After establishing the cutter center plane coordinate system, the discrete cutter center point coordinates under the WCS are transformed into the coordinates under the cutter center plane coordinate system by coordinate transformation, and then the cutter center point trajectory is fitted. As shown in Fig. 7 Where: + is the pseudo-converse operation.   Table 2.
The parameter t is taken to have a range of values Where: The interpolated cutter axis vector obtained from the pre-interpolation is used to solve the cutter axis vector trajectory parameter curve coefficients, and then the cutter axis vector trajectory parameter curve is obtained.

Nonlinear error model
Nonlinear errors are defined in a number of ways, such as distance representation, angular representation and cutter axis vector deviation [20] . As shown in Fig. 11, the maximum deviation between the theoretical machining path and the actual machining path is defined in this paper as the nonlinear error ɛ of a machining interpolation segment. The theoretical machining path is the line between the start and end cutter center points, denoted as L(t). The actual machining path is the parametric trajectory of the cutter center point P(t). Thus the nonlinear error ɛ can be expressed as Eq. (18).

Nonlinear error compensation mechanism
The nonlinear error is caused by the unintended

Cutter axis vector trajectory optimization
The optimization of the cutter axis vector trajectory is based on the idea of the shortest distance between two points on the sphere, called the "shortest navigation" principle. The shortest distance between two points on the sphere in mathematics is the inferior arc of the great circle passing through these two points. We optimize the trajectory of the cutter axis vector as an inferior arc trajectory of a great circle, which can make the interpo- Where: Δθ = 1 / (θ e -θ s ), S 1 = sinθ s , S 2 =sinθ e ,C 1 =cosθ s ,C 2 = cosθ e , ΔS 21 = S 2 -S 1 , ΔC 21 = C 2 -

Calculation of interpolation points for formal interpolation
The new cutter center point and cutter axis vector

Simulation analysis and verification
Through the nonlinear error compensation method The proposed method of nonlinear error compensation above is used for the overall simulation machining of free-form parts. The complex free-form surface parts established by using A-C dual-table five-axis CNC machine in the machine tool simulation software VER-ICUT were simulated [21] , and the comparison experiments before and after nonlinear error compensation were made. Compare and analyze the change of error before and after compensation, and then illustrate the effectiveness of the compensation method. The four-dimensional diagrams of the errors before and after the compensation are shown in Fig. 18 and Fig. 19. The maximum machining error was reduced from 50μm before compensation to 5μm after compensation, and most of the surface errors of the compensated free-form surfaces were reduced to less than 2.5μm, which greatly improved the machining accuracy of the parts and improved the machining quality. This shows that the nonlinear error compensation theory proposed in this paper has a good effect on the control of nonlinear errors.

Conclusions
In this paper, an error compensation method based on the optimization of the swing cutter trajectory is proposed to reduce the nonlinear errors.In order to avoid excessive nonlinear errors between two adjacent cutter location points, the following work is done in this paper: 1. The kinematic model of AC double rotary table is established, the principle of nonlinear error generation is described, and the modeling method of swing cutter trajectory is given, which includes the parametric trajectory equations of cutter center point and cutter axis vector.

A nonlinear error compensation mechanism is
given. The cutter center point trajectory is optimized according to the nonlinear error and the constraints of the tool axis points. The cutter axis vector trajectory is optimized according to the "shortest navigation" principle.
3. Finally, the simulation verification of the nonlinear error compensation method was carried out on a five-axis CNC machine. It includes the comparison of nonlinear errors before and after compensation, the real-time verification of interpolation algorithm and the comparison verification of overall machining errors of free-form surfaces.
The simulation results show that the method can effectively reduce the nonlinear errors. It can effectively improve the machining quality and efficiency of parts in free-form machining.