Cross-coupled control for contour tracking error of free-form curve based on fuzzy PID optimized by improved PSO algorithm

Aiming at the free-form curve contour tracking error problem of CNC machining, a cross-coupled controller based on Fuzzy PID using an improved PSO algorithm is proposed. First, the exact formulas of the linear and circular arc contour errors under a plane trajectory are derived, and an estimation method for the free curve profile error under a plane trajectory based on the principle of approximate approximation of preferred points is designed. Second, a cross-coupled controller based on Fuzzy PID using an improved PSO algorithm is achieved. An improved PSO algorithm, whose learning factor is adjusted with the inertia weight, is used to optimize the controller parameters and achieve contour tracking of the free curve. Finally, a two-dimensional biaxial experimental platform is used to test the proposed method. The results demonstrate that the optimal gain parameters obtained by the proposed strategy can significantly improve contour control accuracy in biaxial contour tracking tasks. The proposed contour error control scheme can achieve not only a nearly perfect contouring error estimation, but also an obvious promotion of contouring accuracy.


Introduction
Contour error is an important research topic in contour following tasks such as computer numerical control (CNC) machine tool machining and welding, 1-3 the contour error is not only affected by the following error of a single driver, but also closely related to the synchronous movement between the drivers. 4 In the field of numerical control machining, the errors of servo system generally include position following error and trajectory contour error, the position following error is the difference between the actual position and the expected position, and the trajectory contour error is the distance from the actual position to the expected contour. 5,6 Domestic and foreign scholars have done a lot of research on contour error. Song et al. 7 defined the five-axis contour error five joint space, by adjusting the uniform unit of the five joints, and with the concept of the generalized curve, for the definition of joint space contour error, a third-order estimation algorithm is proposed. Bo et al. 8 proposed a double circle contour error estimation method. According to the kinematic information of the reference point on the instruction trajectory, five interpolation points closest to the actual point were obtained, and then the approximate contour error was obtained by using the double circle approximation method. Conway et al. 9 proposed a method based on calculating polynomial curve to calculate contour error, which will also have a large amount of calculation.
Contour error reduction is an issue of much concern. The control of contour error is generally divided into single-axis decoupling contour control and multi-axis coupling contour control. Improving the following performance of a single axis has little effect on the small contour error. 6 In order to better complete the contour following task, Koren et al. 10 firstly proposed a twodimensional contour cross-coupled control (CCC) method in the 1980s. The contour error control model is mainly based on the error of each feed axis. Each single-axis controller not only adjusts its error but also adjusts other feed axis errors, so that each independent single-axis servo system becomes a whole cross-coupled system. The key techniques in the cross-coupling structure mainly include the design of the contour controller and the selection of the cross-coupling gain, based on which some scholars have studied the design of the contour error controller, Chen et al. 11 used the H N theory to design a cross-coupled controller, which improved the robustness of the system. Liu et al. 12 used the characteristics of the servo structure to establish a prediction model for following error. Based on considering the friction damping of the transmission mechanism, a LuGre friction compensation strategy that considered friction and external interference at the same time was proposed. Zhang et al. 13 coordinated following error and contour error through multi-step prediction, rolling optimization, and feedback correction ideas in generalized predictive control to obtain the optimal control input signal. Han et al. 14 proposed a tooth profile error modeling method and an adaptive electronic gearbox cross-coupled controller for internal meshing dynamic honing. Zhou et al. 15 proposed a new dual-axis integrated control strategy, using a disturbance observer in a cross-coupled architecture to compensate for friction. Wang et al. 16 designed sliding-mode structure control algorithm and proposed a cross-coupled control strategy consisting of a sliding-mode following controller, a disturbance observer, and an adaptive fuzzy PID, but the sliding-mode structure is prone to chattering. Sun et al. 17 proposed a dynamic compensated fast adaptive robust control method to reduce the influence of parameter estimation error and unmodeled dynamic disturbance. Shang et al. 18 and Zhang et al. 19 proposed an improved cross-coupled control scheme combining real-time contour error estimation and model-free adaptive control (MFAC).
In addition, many advanced PID and fuzzy control strategies have also been developed. Ling et al. 20 proposed a position domain iterative learning controller with PID iterative learning control and PD crosscoupled control. Chen et al. 21 proposed an adaptive cross-coupled two-degree-of-freedom PID control strategy and designed two compensators to eliminate the contour error in biaxial motion. Yao et al. 22 established the mathematical model of the compensation and decoupling link, designed the cross-coupled fuzzy PID controller, and combined it with the complete decoupling compensation method. However, it has shortcomings in the optimization of controller parameters, and poor adaptability and robustness. At present, most contour error methods are designed on the basis of CCC, such as sliding mode structure, 16 Modelfree adaptive control, 19 fuzzy PID control, 22 and model reference adaptive control, 23 and so forth, all have their own advantages and contributions within their applications, but there are also problems of accuracy and realtime. The current cross-coupled control method of contour error has been well developed and applied, but there are still some shortcomings in the optimization of controller parameters.
This paper provides an in-depth discussion on the estimation and control of contour errors based on the traditional contour error cross-coupled control problem. The main contributions of this paper are as follows: (1) The contour error estimation calculation method is discussed, and the test shows that the contour accuracy of the method can meet the requirements even if the curve curvature is large. (2) In the contour control, the PSO algorithm is improved to optimize the fuzzy PID control parameters so as to perform adaptive fuzzy PID contour error cross-coupled control. (3) The effectiveness of the proposed method is verified. The contour error tracking experiments are carried out for different shapes of NURBS curves, and high accuracy tracking of 2D contours is achieved.
The rest of the paper is organized as follows. The ''Contour trajectory error estimation algorithm'' section presents the calculation of the contour error under free trajectory with high estimation accuracy based on the principle of preferred point approximation. The ''Improved PSO algorithm to optimize fuzzy PID cross-coupled controller'' Section presents the control method of fuzzy PID based on PSO optimization. Experimental results are given in ''Verification of twodimensional x-y axis experimental platform'' Section, and conclusions are given in ''Conclusion'' Section.

Contour trajectory error estimation algorithm
In CNC machining, contour accuracy plays an important role in multi-axis servo systems. 16 and real-time acquisition of contour error values is a prerequisite for controlling contour errors. Existing two-dimensional plane contour error calculation models include contour estimation models of arcs, straight lines, and free curves.

Calculation of contour error of straight line and arc
Divided by spatial dimensions, contour error can be divided into two-dimensional plane trajectory contour error and three-dimensional space trajectory contour error. This article only discusses contour error control under plane trajectory, if the ideal contour is a straightline trajectory or a circular arc trajectory, the contour error can be accurately obtained. The principle diagram for calculating the contour error of a straight line or arc trajectory is shown in Figure 1, R is the desired position point, P is the actual position point, R p is the vertical foot point on the ideal contour, and O is the center of the arc trajectory. According to the schematic diagram, the calculation formulas of the two are listed separately.
For a straight-line trajectory, the precise calculation formula for its contour error can be calculated as: where e x and e y are the components of the following error on the x-axis and y-axis, respectively; u is the angle between the linear trajectory and the x-axis.
For the arc trajectory, the precise calculation formula for the contour error as: where ||P-O|| represents the two norms of P-O.
Substitute the coordinates of each point into equation (2) to obtain: where r is the radius; x p and y p are the coordinates of the actual position point P; x o and y o are the coordinates of the center O of the arc trajectory.

Free curve contour error estimation algorithm
The contour error is defined as the shortest normal distance from the actual position of the machine tool to the contour curve, and the true value of the contour error of the free curve is difficult to calculate analytically, so it is usually approximated. The estimation of the free curve contour error in this paper is inspired by Chen et al. 24 The contour error estimation method does not need to consider the command position and speed information and has good accuracy and real-time. Figure 2 shows the principle diagram of the estimation method.
In Figure 2, P is the current position point, the interpolation point closest to the point P on the ideal contour is R e , trace back from the command position R, when the condition PR e k k 2 4 PR eÀ1 k k 2 is satisfied, the determined point R e is nearest to the actual position point P. In the actual situation, since the following error will not be too large, the distance between the point P and the point R will not be too far, so R e can be found in a short time. Similarly, the other three adjacent interpolation points R e + 1 , R e-1 , R e-2 can be obtained.
If the coordinates of the four interpolation points are R e + 1 (x e1 , y e1 ), R e (x e2 , y e2 ), R e-1 (x e3 , y e3 ), R e-2 (x e4 , y e4 ), respectively, then the center of the circle over the points R e + 1 , R e , R e-1 is e1 (x o1 , y o1 ), the radius is r e1 , and the center of the circle e2 (x o2 , y o2 ) can be obtained in the same way. The expression of the circle can be formed by the following quadratic equation.
The expression of the circle can be composed of the following binary quadratic equations: Substitute the coordinates of points R e + 1 , R e , R e-1 into equation (4) to find the coefficient of circle e1 . Then a e1 , b e2 , c e3 are calculated as: Similarly, b e2 , c e3 can be obtained. Then the center e1 (x o1 , y o1 ) and radius r e1 of circle e1 can be obtained.
Combining equations (6) and (7), the vector expression of the distance from the actual position point P to the circle e1 is obtained In the same way, the vector expression of the distance from the point P to the circle e2 is The two contour error vectors e 1 * and e 2 * are obtained by two approximate circles, and the final estimated contour error vector e * needs to be obtained by weighting and summing the vectors e 1 * and e 2 * : Set weight coeffi- , which reflect the distance from point R e + 1 to point P in circle e1 and the distance from point R e-1 to point P in circle e2 , respectively. At the same time, a 1 + a 2 =1 is satisfied to ensure the consistency of the overall scale. Therefore, the contour error is estimated as: This contour error calculation model takes full account of the interpolation point information with higher accuracy, when jjPR SÀ2 jj is larger and jjPR S + 1 jj is smaller, a 1 takes a value greater than a 2 and the contour error * e depends more onẽ 1 ,ẽ 2 is obtained in the same way. The contour error generated by the two-axis motion control can be obtained from equation (10) above. In the following two sections, the estimated contour error is used as the input of the cross-coupled controller to further control the contour error.
Improved PSO algorithm to optimize fuzzy PID cross-coupled controller

Variable gain fuzzy cross-coupled control strategy
In actual machining, the existence of contour error will affect the machining accuracy of parts. In order to directly control the contour error and input a certain amount of compensation to each driving shaft to improve the coupling degree between each shaft, Koren et al. 10 proposed the idea of cross-coupled control and the control structure diagram is shown in Figure 3. The control quantity of a single servo drive system depends on its output and the output of other drive shafts. The correction signal generated by the cross-coupled controller compensates for the estimated contour error in each axis, thus improving the contour tracking accuracy.
In the above Figure 3, r and r xy are the motion reference positions given by the interpolation, p x and p y are the actual positions after the x-axis and y-axis feed motions, respectively. e x and e y are the following errors of the x-axis and y-axis respectively. G x , G y is x-axis and y-axis position loop controllers. L x and L y are mathematical models of the controlled object in the xaxis and y-axis position loops, respectively. C x and C y are cross-coupled gains obtained by the contour estimation algorithm. e is the contour error under the crosscoupled control structure. CCC is a cross-coupled controller. The contour error estimation algorithm in the previous section is applied to the above control structure and analyzed and verified in the subsequent simulation tests.
The traditional CCC controller is adjusted by PID control, and the parameter optimization of conventional PID control is mainly through theoretical calculation and engineering optimization. The parameters after theoretical calculation are not always directly usable. In this paper, a fuzzy controller is added to the PID adjustment, which can adaptively adjust the proportional, integral, and differential coefficients. A fuzzy cross-coupled controller is obtained by using a twodimensional fuzzy controller, as shown in Figure 4. The contour error e and the change rate of contour error De under the cross-coupled control structure are used as the input of the fuzzy controller. For the fuzzy processing, each input sample should be switched to the corresponding fuzzy set, that is, each input sample is multiplied by the corresponding factor, and the contour error quantization factors are defined as k e and k De respectively. The contour error e and the change rate De are multiplied by the quantization factor to obtain the corresponding fuzzy domain, the fuzzy processing is completed. Return the actual position of the controlled object after the x-axis and y-axis feed through the mathematical model L x and L y of the position loop.
After the fuzzy processing, the fuzzy controller uses the set fuzzy rules to make corresponding decisions. After defuzzification, multiply by the proportional factors k pf , k if , and k df , the final output is the three adjustments of CCC, which are DK p , DK i , and DK d , the form of the fuzzy set is selected as ''negative large (NL),'' ''negative medium (NM),'' ''negative small (NS),'' ''zero (ZO),'' ''positive small (PS),'' ''positive medium (PM),'' and ''positive Large (PL)'' to describe the system's variable. The fuzzy rules are obtained by summarizing the control experience and by fuzzy reasoning. The fuzzy inference mechanism will make inference decisions based on the established rule table. The fuzzy rules are given in Tables 1 to 3, corresponding to three output variables DK pf , DK if , and DK df , respectively. Based on the established fuzzy rule table, Mamdani fuzzy inference is used to infer the fuzzy set of output. The defuzzification is performed using the center of gravity method. As shown in Figure 5, the output surfaces of DK pf , DK if , and DK df are obtained after defuzzification, and the exact solutions DK pf , DK if , and DK df of the three outputs in their respective fuzzy domains are multiplied by the corresponding proportional factors k pf , k if , and k df . finally, the exact adjustment quantities DK pf , DK if , and DK df are obtained. therefore, the control parameters of the fuzzy PID can be expressed as: where K p0 , K i0 , and K d0 are the initial values of proportional, integral and differential coefficients.
The control quality of a fuzzy controller depends mainly on the values of the quantization and scaling factors. A global optimization algorithm with high precision and fast convergence is needed to optimize the control parameters to improve the traditional fuzzy CCC. Therefore, an improved PSO algorithm for parameter optimization is proposed.

Traditional PSO algorithm
The basic idea of the swarm control algorithm is constructed by simulating the behavior of natural biological groups. Particle swarm optimization (PSO) is a swarm-based optimization technology based on swarm intelligence, which was first introduced by Dr. Eberhart and Kennedy in 1995. The inspiration comes from the foraging behavior of a flock of birds. As a global optimization evolutionary algorithm, PSO is used to solve optimization problems. The algorithm initializes a set of random particles with parameters to perform iterative computations. In each iteration, the velocity and position of each particle are updated by following the individual optimal position and the global optimal position of the particle, and the optimal solution satisfying the termination condition is finally obtained. 25,26 The update formula of the velocity v id and position x id of the ith particle in the d-dimensional space in the standard PSO algorithm is expressed as: where, w is the inertia factor. c 1 and c 2 are learning factors. r 1 and r 2 are random numbers in (0,1). Dt is the step length, generally taking 1. P id is the individual optimal position, P gd is the global optimal position. i = 1, 2, . m, m is the population size. t is the number of iterations, t = 1, 2, .T, T is the maximum number of iterations.

Improved PSO algorithm
In the optimization process of the standard PSO algorithm, the global search ability will continue to weaken as the inertia factor w decreases, but the local search ability will continue to increase. The particles tend to fall into local optimization prematurely, affecting the global search ability and failing to balance the contradiction between global search and local search. The algorithm cannot be well coordinated due to the adjustment of inertia weights and the independence of learning factors. Therefore, an improved particle swarm optimization algorithm is proposed in this paper, which adjusts the learning factors by inertia weights. The method is based on the nonlinear decreasing strategy of inertia weights, and establishes the nonlinear change relationship between the learning factor and inertia weights. The global search ability and local search ability of the PSO algorithm are also better balanced when the two coordinates are changed. The calculation formula of inertia weight nonlinear decreasing strategy is: where w start = 0.9; w end = 0.4; a = 3.4; b = 0.07. The nonlinear change strategy formula of learning factor with inertia weight is: where c start = 0.5; c end = 1.   Figure 6 shows the nonlinear variation curves of the inertia weights and learning factors, and it can be seen that the inertia weights establish a nonlinear relationship with the learning factors. Because large c1 values and small c2 are maintained, the global search capability of the improved PSO algorithm is enhanced in the initial stage of execution. In the later iterations of the algorithm, the situation is just the opposite, making our birds neither concentrated nor dispersed. Smaller c1 values and larger c2 values are taken to improve the local search accuracy and avoid premature convergence.

Adaptive fuzzy PID cross-coupled control based on improved PSO algorithm
The control effect of the cross-coupled controller is largely dependent on the selection of quantization factors k e , k De , and the proportional factors k pf , k if , and k df . Therefore, to realize the adaptive fuzzy crosscoupled control of contour error, the quantization factors k e , k De , and the proportional factors k pf , k if , and k df in the fuzzy controller are optimized by the improved PSO algorithm in this paper, to achieve the purpose of parameter self-optimizing and the best control effect. The specific process is as follows: (1) Expected input value of the feed shaft. The interpolation point of the curve is taken as the expected input of each feed shaft. (2) Calculate the input of the cross-coupled controller.
The input of CCC is the contour error. (3) Based on the improved PSO algorithm, the quantization factors k e , k De , and proportional factors k pf , k if , k df of fuzzy CCC are optimized. The specific steps are as follows: (a) Initialize the PSO algorithm parameters. The parameters of equations (13) and (14): w start = 0.9, w end = 0.4, c start = 0.5, c end = 1, a and b take values 3.4 and 0.07, respectively. The population size m = 50, the maximum number of iterations T = 100, and the parameter dimension D = 5. Determine the initial values of the quantization factor and proportional factor according to the trial-and-error method, and initialize the particle swarm. (b) Update particle velocity and position.
Calculation of velocity and position of next generation particles based on equation (12). (c) The fitness value of particles is calculated, and the expression is: where N is the sampling point. e i is the contour error modulus at position i. e is the modulus average of contour error.
(d) Calculate the fitness value of each particle and determine whether to continue iteration. If the calculation of equation (15) reaches the expected value or the iteration has reached the maximum number of iterations, the iteration is terminated; otherwise, let t = t + 1, and go to step as (b). (4) According to step (3), the optimized quantization factor and proportional factor are obtained, and the optimal PID control parameters are calculated by combining equation (11). Therefore, The CCC control output is decoupled to each feed axis, as the control input of each feed axis for adjustment, and finally the contour error is formed into a coupling control. The contour control chart of parameter optimization is shown in Figure 7.

Simulation verification
Based on the single-axis servo system model, 27 an x-yaxis servo system was built for analysis. The parameters for the x and y axes are as follows: torque coefficient C T = 0.57 N/A, Viscous friction coefficient B = 1.2 NÁmÁs, moment of inertia J = 0.015 NÁm. The cross-coupled control simulation model is built in MATLAB/Simulink as shown in Figure 8.

Circular trajectory simulation
The circular trajectory as shown in Figure 9 is used to test the contour error control performance, where the x and y-axis position input signals are:  (0, 100), respectively. The inertia weight in the standard PSO algorithm is 0.7. Figure 10 shows the fitness change trend curves of the two algorithms. It can be seen from Figure 10 that both the standard PSO algorithm and the improved PSO algorithm curves flatten out at the end, but the improved PSO algorithm has fewer iterations and smaller fitness. This indicates that the improved PSO algorithm is superior to the standard PSO algorithm in optimizing the quantization factor and proportional factor.
The improved PSO algorithm is used to optimize the parameters, and the optimal parameters (k e , k De , k pf , k if , k df ) = (1, 1.2, 87, 8.5, 4) are obtained. The contour error is calculated by the contour error calculation method of arc trajectory, and the control performance of contour error is verified based on the simulation of optimal parameters. As shown in Figure 11, the contour errors under no cross-coupled control, traditional fuzzy PID cross-coupled control, and fuzzy PID crosscoupled control of improved PSO are compared.
It can be seen from Figure 11(a) that the arc trajectory deviation is obvious without cross-coupled control. According to the comparison of Figure 11(b), it can be seen that the maximum contour error values under the non-cross-coupled control and the traditional fuzzy PID cross-coupled control are 0.049and 0.0089 mm, respectively, while the maximum contour error under the improved PSO fuzzy PID cross-coupled control is 0.00059 mm. The improved PSO algorithm optimize the cross-coupled control method of fuzzy PID, which can obtain higher contour accuracy and better contour control effect.

Typical ''N'' trajectory simulation
Using the ''N'' shaped NURBS curve trajectory shown in Figure 12 as the test object, the improved PSO algorithm is used to optimize the fuzzy PID control parameters. Figure 13 shows the fitness change curve of the standard PSO and the improved PSO algorithm.   As can be seen from Figure 13, the fitness curves of both eventually flatten out, and the optimization effect of the improved PSO algorithm on the control parameters is better than the standard PSO algorithm. At the same time, the improved PSO algorithm has fast convergence speed and smaller fitness.
The estimation accuracy of ''N'' NURBS curve is tested by the contour error estimation method in this paper. The actual contour error is obtained by offline calculation of the actual position of the trajectory collected by each axis according to the definition. 28 Among them, Figure 14(a) shows the estimated value of the ''N'' shaped trajectory contour error, and Figure 14(b) shows the estimated deviation of the contour error. It can be seen from the Figure 7 that the estimated deviation value of contour error is less than 0.0184 mm, and the average value of estimated contour error is 0.0057 mm. This contour error estimation method has high estimation accuracy.
Comparison of no cross-coupled control, fuzzy PID cross coupled control effect, the results are shown in Figure 15.
From the experimental results, it can be seen that the fuzzy PID cross-coupled control method under the improved PSO algorithm is better than the traditional fuzzy PID cross-coupled control method in controlling the contour error. Based on the control results of each method, the maximum MAX and the module average CEA of the ''N'' trajectory contour error are calculated and compared in Table 4, where CEA = 1 n P n k = 1 e * k ð Þ, n is the number of sampling and e * k ð Þ is the modulus of the kth contour error.
The results of the simulated ''N'' curve are shown in Table 4, it can be seen that the maximum contour error under the fuzzy PID cross-coupled control of the improved PSO and the traditional fuzzy PID crosscoupled control are reduced by 77.33% and 51.09%, respectively, compared with the maximum contour error under the non-cross-coupled control. Compared with the conventional fuzzy PID-CCC control, the maximum contour error under the improved PSO algorithm control is reduced by 53.6%. The maximum contour error under the fuzzy PID cross-coupled control of the improved PSO algorithm is smaller than that under the traditional fuzzy PID cross-coupled control.   At the same time, the average also reduced by 84.91%. It can be seen that the fuzzy PID cross-coupled controller of improved PSO has a better contour error control effect.

Verification of two-dimensional x-y axis experimental platform
Test experiments are carried out on the 2D X-Y axis experimental platform, to verify the proposed contour error control algorithm, which is based on fuzzy PID optimized by improved PSO. The experimental platform is an x-y axis platform motion control system with a motion control board as the core controller. The motion control system consists of upper computer system, servo drive control system, and mechanical drive part. The physical device diagram of the twodimensional x-y axis experimental platform is shown in Figure 16, which is mainly composed of two-axis motion control card, servo driver and motor, grating digital encoder, and x-y mechanical motion platform. It can be seen from the figure that in the process of motion control of the experimental platform, the host computer generates the processing data of the target trajectory and transmits it to the motion control card. The motion control card generates the control instructions for the interpolation trajectory of each feed axis according to the instructions of the host computer and transmits them to each feed axis. Each axis moves the trajectory according to the control instruction and saves the encoder results back to the host computer.
A standard circular trajectory is used as an example to illustrate the effectiveness of the proposed contour error control method. Given the radius of the desired circle is 10 mm, where x = 10cos (pt) -10, y = 10sin (pt), the servo system moves according to the given instructions and uses the encoder to collect the actual position information of each axis to calculate the actual contour error value of the x and y-axis trajectory. The contour error control effects under no cross-coupled control, traditional fuzzy PID cross-coupled control, and fuzzy PID cross-coupled control of improved PSO are compared, and the comparison is shown in Figure 17.
It can be seen from Figure 17 that the maximum contour error under no cross-coupled control is 0.115 mm, and the maximum contour error under traditional fuzzy PID cross-coupled and fuzzy PID crosscoupled control of improved PSO is 0.0247 and 0.0143 mm. Compared with no cross-coupled control, the traditional fuzzy PID cross-coupled control method can reduce the maximum contour error by 78.57%, while the fuzzy PID cross-coupled control of improved PSO method can reduce the maximum contour error   by 87.57%, and the average contour error is also reduced by 62.94% compared with the traditional fuzzy PID cross-coupled control method. Therefore, the fuzzy PID cross-coupled control of the improved PSO method has a better contour error control effect.
In order to enhance the convincing power of the proposed contour error control method, the NURBS curve is selected for experiments. The selected NURBS curve is shown in Figure 18. The test shows that the curvature of the curve changes irregularly.
The proposed curve estimation deviation algorithm is used to calculate the trigonometric curve, and the result is shown in Figure 19. The contour error control effect of fuzzy PID optimized by improved PSO algorithm is tested. The actual contour error is calculated from the actual position of each axis collected by the encoder. The contour error control effect of each method is shown in Figure 20. The maximum MAX and average CEA of contour error calculated from the control results of each method are summarized in Table 5.
It can be seen from the graph that the estimation deviation of contour error is kept within 0.00221 mm, which indicates that the contour error estimation method has a high estimation accuracy. It can be seen from Figure 20 and Table 5 that the maximum contour error without cross-coupled control is 0.04364 mm, the maximum contour error under the traditional fuzzy PID cross-coupled control is 0.01806 mm, and the maximum contour error under the fuzzy PID cross-coupled control of improved PSO is 0.00583 mm, which is 86.63% and 67.7% lower than the previous two methods, and the average contour error module is 0.00111 mm. It can be seen that the contour error control effect of the proposed method is better than that of the traditional method, which also proves the effectiveness of the proposed method.

Conclusions
In this paper, based on the principle of approximate approximation of preferred points, the estimation algorithm of the free curve contour error under plane trajectory is studied to improve the estimation accuracy of the contour error. In the contour control, the control parameters of the fuzzy PID are optimized based on the improved PSO algorithm, and the cross-coupled control of the contour error with adaptive fuzzy PID is realized. The two-dimensional contour following is implemented on the experimental platform.
(1) The contour error of the free curve is estimated based on the principle of approximate approximation of preferred points is designed, the simulation results of ''N'' NURBS show that the estimation method in this paper can achieve a high-precision estimation of contour error. Aiming at the local and global search balance problem of the PSO algorithm, the learning factor of the improved PSO algorithm is adjusted with the inertia weight. The improved particle swarm algorithm is applied to the cross-coupled control model to optimize the system control parameters and achieve the suppression of the contour error. Compared with the traditional fuzzy PID cross-coupled control  method, the fuzzy PID cross-coupled control based on the improved PSO algorithm can reduce the maximum contour error by 53.64%, which has better control effect. Therefore, the proposed improved particle swarm optimization algorithm has better optimization capability. (2) A fuzzy PID contour error control method, which is based on improved PSO optimization algorithm, is proposed to achieve high-precision contour following on arc contours and typical NURBS trajectories. The experimental results show that the proposed contour error control method applied to the arc contour following test has high following accuracy, and the contour error is controlled in the range of 0-0.0143 mm. In the typical NURBS trajectory test, the maximum contour error obtained by the proposed method is also reduced by 67.7% compared with the traditional Fuzzy PID control method, which meets the requirements of control accuracy, thus verifying the effectiveness of the proposed method. (3) It has potential of being integrated into application for other types of multiple axis tracking controller, in the future research, the authors will study more excellent contour control methods, and further apply them to three-axis and five-axis, considering relevant testing with CNC system manufacturers and conducting further research in this direction.

Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.