Real-time estimate and control contour errors for five-axis local smoothed toolpaths based on airthoid splines

Five-axis linear commands are blended as the local smoothed toolpaths by inserting clothoid and airthoid splines at corners in five-axis CNC machining. The contour error is the bottleneck to achieve the precise dimension of the machined parts, when following the local smoothed toolpaths. This paper presents a contour error estimation and control method for the five-axis smoothed toolpaths with airthoid splines, according to the geometric characteristics of the toolpaths. The tool-tip contour error is analytically calculated based on the expression of the smoothed toolpaths. Consequently, the tool-orientation contour error is obtained by synchronizing the tool-orientation contour point with the tool-tip item based on the motion time through the designed time scale coefficient, when the toolpaths are scheduled by the time-synchronization scheme. Furthermore, a contour error compensation strategy is constructed to adaptively determine the compensator gain. It can be qualified to maximally eliminate the contour errors and steadily hold the control stability of the feed drives, in spite of the modeling error between the nominal and actual control models. The simulation and experiment results show that the estimation algorithm has higher accuracy than traditional methods, and the compensation strategy effectively eliminates the five-axis contour error.


Introduction
Five-axis machine tools are utilized for machining complex parts in the field of aerospace, energy and power technologies, such as turbine blades, impellers and so on. Machine tools urgently possess the perfect machining accuracy to satisfy the demands on the parts with the high dimensional accuracy and the good surface finish [1]. The contour error turns into the bottleneck to address the challenge, caused by the mismatch dynamic response of feed drives [2] and the external disturbances [3]. Therefore, the suppression of contour errors becomes of great significance for directly improving the machining accuracy of machine tools.
To minimize the contour error, the general strategies are divided into two steps, including estimating the contour error Extended author information available on the last page of the article and restraining the contour error. The contour error estimation is the premise of restraining the contour error. Many research works have been developed to estimate the contour errors for two-or three-axis machine tools, including the straight line approximation [4][5][6], the circle approximation [7,8] and the Newton approximation [9][10][11]. The estimation for five-axis machine tools presents additional challenges, since the tool-tip and tool-orientation contour errors are involved simultaneously. To tackle the problem, El Khalick et al. [12] presented a method to estimate the tool-orientation contour error, in which the error was synchronized with the tool-tip item according to the same curve parameter. To apply to any kinematic transformations of fiveaxis machine tools, Yang and Altintas et al. [13] and Li and Zhao et al. [14] innovatively proposed generalized methods to estimate the contour errors as the shortest distance from the actual point to the linear segments formed by the interpolated points. Consequently, Pi et al. [15] and Yang Ming et al. [16,17] involved the Ferguson curve and the threepoint arc rather than the linear segments to approximately describe the desired toolpath, which achieved higher estima-tion accuracy. The methods mentioned above can be widely applied to various forms of G code commands. As a tradeoff, there exists no analytical solutions to estimate the contour errors, since the geometric characteristics of the desired toolpaths are ignored. Considering the randomness of the contour errors, it is difficult to involve an approximate number of the curvilinear segments formed by the interpolated points to balance the estimation accuracy and the computational burden [11]. When the accuracy and effectiveness are both important factors, the geometric characteristics of the toolpaths should be considered carefully.
In general, parametric spline(i.e.NURBS, B-spline) commands [18,19] and successive linear commands [20,21] are main formats to describe five-axis toolpaths. Based on the geometric characteristics of the toolpaths, many beneficial attempts have been made to estimate five-axis contour errors. For five-axis parametric-spline toolpaths, Li and Zhao et al. [22] and Jia et al. [23] creatively derived the Taylor expansion of the mathematical expresion for the parametric toolpath to conduct contour errors. Liu et al. [24] developed an estimation method based on the curve's curvature and torsion of the toolpaths through the fourth Taylor series expansion.
In CNC machining, the successive linear commands are widely blended as the smoothed toolpaths by inserting splines(i.e.B-spline, PH spline, clothoid) at the corners [25][26][27][28]. Facing the smoothed toolpaths with the B-spline or PH spline, Yang et al. [29] precisely estimated five-axis contour errors according to the mathematical expression of the smooth toolpath. Jiang et al. [30] developed a similar method to calculate contour errors. In recent years, clothoid and airthoid splines draw more attentions as smoothing splines [31][32][33][34]. The five-axis contour error inevitably emerges, when following the smoothed toolpath. Due to the mathematical formulas of clothoid and airthoid splines [33,34], it is also feasible to analytically estimate the contour errors based on the geometric characteristics of the smoothed toolpaths. However, the formula is different from the item of the smoothed toolpaths containing the B-spline or PH spline. The mentioned studies [29,30] are unable to analytically estimate the contour error of the smoothed toolpath based on the clothoid and airthoid splines. Moreover, the tool-tip and tool-orientation motions are always synchronized by sharing the motion time rather than the curve parameter, when following the smoothed toolpath based on the clothoid and airthoid splines. In this case, the traditional methods [12,29], focusing on the parameter-synchronous motion, make no sense to estimate the tool-orientation contour error. To the best of our knowledge, no previously published work has made to accomplish the two significant researches for the smoothed toolpaths based on the clothoid and airthoid splines.
The contour error control is the final objective of the contour error estimation. Some researches attempted to reduce the contour error by indirectly eliminating the single deive's tracking error [3,35,36]. It is proved that the suppression of tracking errors might be not always the case to improve the contour accuracy [7]. The popular approach focuses on directly controlling the contour errors. Huo et al. [6], Liu and Ren et al. [37] and Wan et al. [38] proposed decoupled tangential contouring control schemes based on cross-coupled controllers to reduce the two-or three-axis contour error. Since the five-axis toolpaths involved the tool-tip and tool-orientation positions, the structure of the cross-coupled controller presents the complex to be extended to five-axis machine tools [24]. Actually, it is an effective method by decoupling the five-axis contour error into the error components of the feed drives. Li and Zhao et al. [22] and Du et al. [39] wisely designed dual PD-type sliding mode controllers to control the tracking and contour errors. It is still a challenge to apply the methods to the most of commercial CNC systems, since these are usually based on proportional-integral-differential(PID) controllers. As a representative work, Zhang and Altintas et al. [40] and Wang et al. [41] presented pre-compensation methods to eliminate the incoming contour errors of the machine tools based on PID controllers. It is noted that the accurate servo dynamics of the feed drive should be modeled in the pre-compensation methods. The compensation effect might be degraded by the modeling error. To enhance the robustness, Yang and Altintas et al. [13] and Jiang et al. [30] proposed feedback compensation methods to inhibit the existing contour errors. Inspired by Ref. [13,30,40,41], Jia et al. [23] and Liu et al. [24] developed five-axis contour error compensation approaches to inhibit the incoming and existing contour errors simultaneously.
In the abovementioned feedback compensation methods, the linear time-invariant system of multi-axis machine tools becomes a multi-input multi-output time-varying system [42]. Therefore, the realization of the control stability is a tricky problem. For two-or three-axis contour error, Yeh et al. [43] derived a contour error transfer function to analyze the stability. Yang and Li et al. [7] and Zhao et al. [9] developed methods to evaluate the stability under the general trajectories and then determine the cross-coupled gains. When decoupling the contour errors into the error components of the feed drives in five-axis CNC machining, the previous literatures [13,23,24,30,40,41] have off-line determinined the compensator gain as a constant value, according to the control stability of the nominal model of the cross-coupling feed drives. However, there are two problems needed to be confronted in five-axis machining as follows. Firstly, the control characteristics of the feed drives are affected by the time-varying compensation values. The pleasurable compensation effect is hard to achieve with the invariable gain. Secondly, the gain cannot always ensure the feed drives stability in the practice, since there exits the difference between the nominal and actual model parameters.
In this paper, a contour error estimation and control method is proposed for five-axis local smoothed toolpaths based on airthoid splines. On the one hand, the tool-tip contour error is analytically calculated with the mathematical expression of the smoothed toolpaths. After that, the toolorientation contour error is obtained by synchronizing the value with the tool-tip item through the designed time scale coefficient. On the other hand, a compensation strategy is developed to eliminate the contour errors of the five-axis machine tool based on PID controllers. With the consideration of the modeling errors of the feed drives, an adaptive design scheme is presented to determine the compensator gain, and thus ensure the control stability.

Preliminary of smoothed toolpaths based on airthoid splines
The airthoid is an arclength-parameterized spline, where the derivation of the curvature linearly increases with the arclength, as shown in Fig. 1. The tangent angle θ is expressed as where θ 0 and κ 0 are the tangent angle and the curvature at the start point P 0 , respectively; c is the sharpness of the airthoid spline. A point P on the airthoid spline is expressed as where a is the scaling parameter and expressed as 3 π c ; t and n are the tangential and normal unit vectors of the spline at the point P 0 , respectively; the terms C(θ ) and S(θ ) can be respectively formulized and calculaed in the form below [44] By inserting airthoid splines at the corners, the linear commands are blended as the smoothed toolpath, as shown in i and B 1 i are the entry and exit transition points of the spline; S i and E i are the connecting points of the biairthoid splines, respectively. The detail procedures to determine such geometric parameters of the smoothed toolpaths are available in Ref. [33], including the scaling parameter, the sharpness, the entry and exit transition points, and so on.  The point Q on the smoothed toolpath is analytically expressed as where S 1 = S Q − S 1 i−1 , S Q and S 1 i−1 are respectively the displacements from the point Q and B 1 i−1 to the start point of the smoothed toolpath, the similar procedures hold for S 2 and S 4 ; unlike before procedures, S 3 = S 0 i − S Q ; t is the unit vector and can be expressed as P i−1 P i , · is the Euclidean norm; n is the vertical unit vector of t in the plane formed by the points P i−1 , P i and P i+1 .
Obviously, it is expressed as a clear and simple mathematical formula for the smoothed toolpaths based on airthoid splines. Therefore, when the contour errors emerge, it is feasible to analytically estimate the values with the mathematical expression of the smoothed toolpaths.

Estimation of the tool-tip contour error
The five-axis contour error is composed of the tool-tip contour error and the tool-orientation contour error, as shown in Fig. 3. r c is the five-axis smoothed toolpath made up of the linear segments and airthoid splines; P r and O r are the desired tool-tip and tool-orientation positions, respectively; P a and O a are the actual tool-tip and tool-orientation positions, respectively. The tool-tip contour errorε p is defined as the discrepancy between P a and the tool-tip contour point P f . Similarly, the tool-orientation contour errorε o is the discrepancy between O a and the tool-orientation contour point O f .
(1) Located area of the tool-tip contour point The tool-tip contour point P f is the nearest point on the toolpath r c from the point P a , which can be conducted as where P f is the tangential vector at the point P f of the toolpath r c .
To estimate the contour errorε p , the located area for the point P f should be determined. There are three possible situations for the location of the point P f on the toolpath r c as shown in Fig. 4(a), including the line and the spline B 0 i B 1 i . The procedures to determine the located area are illustrated in the following part. First, two Frenet frames are established based on the entry and exist transition points of the spline at the corner. As shown in Fig. 4(a), the Frenet frame F 0 i at the point B 0 i of the i-th(i = 0, 1, · · · , n) corner in the Cartesian coordinate is constructed as Then, the coordinates of the actual point in the local Frenet frames are constructed. The point P a in the Frenet frame F 0 i is expressed as where P a f T , due to the unit orthogonal matrix properties.
The coordinate vector P a f i is similarly obtained. Last, the located area for the contour point is determined as follows: consists of a pair of airthoids, and E i is the conected point of the airthoids. The located (2) Estimation of the tool-tip contour error When the point P f is located on the line B 1 i−1 B 0 i , the corresponding coordinate P Ff in the Frenet frame F 0 i is conducted as The tool-tip contour error vector ε p and contour error ε p are expressed as When the point P f lies within the line B 1 i B 0 i+1 , the contour error vector ε p and contour errorε p are similarly obtained.
When the point P f lies within the spline B 0 i B 1 i , the different scheme to determine the contour point and contour error is involved. Take the point P f on the spline B 0 i E i as an example to illustrate the procedure. As shown in Fig. 4(b), on the plane t 0 i − n 0 i , the projection of the point P a denotes as P aftn (P t0 f i , P n0 f i ) refering to Eq. (7). The contour point P f on the plane denotes as P ftn (a i C(θ f ), a i S(θ f )). The requirement for the point P ftn to be the contour point is where P ftn (cos θ f , sin θ f ) is the tangential unit vector. Equation (10) is specifically expressed as It is noted that f (θ ) is a monotone function for θ ∈ 0, π 2 . Therefore, the equation has only one root, which can be solved by the Newton-Raphson method.
And thus, the contour point In this situation, the tool-tip contour error vector ε p and contour error ε p are formulized as

Estimation of the tool-orientation contour error
(1) Definition of the tool-orientation contour error The tool-orientation contour error is determined as the difference between the actual and contouring tool poses. In fiveaxis machining, the time-synchronization and parametersynchronization schemes are two forms to synchronize the tool-tip and tool-orientation motions [25,26,34,45]. For the parameter-synchronization scheme, the contouring tool pose is obtained by substituting the corresponding curve parameter of the tool-tip contour point to the tool-orientation toolpath [12,29]. However, the rule is expired under the time-synchronization scheme, since the mapping relationship between the tool-tip and tool-orientation toolpaths is the motion time rather than the curve parameter.
Therefore, this paper develops a method to determine the tool-orientation contour error based on the motion time for the time-synchronization motion. Specifically, the toolorientation contour point is conducted by substituting the occurrence time of the tool-tip contour point into the toolorientation toolpath. The tool-orientation contour erorr is obtained as the difference between the actual and contouring tool-orientation positions further.
(2) Time scale coefficient where T s is the interpolation period; T Ps,k is the occurrence time of the point P s,k . The point P s,i (i = 0, 1, 2, · · · , k, · · · ) is the interpolation point. The occurrence time and coordinate value of the point P s,i are achieved in the fine interpolation stage and cyclically stored in the numerical control(NC) memory unit. k is determined by comparing the point P f and the interpolation point P s,i , which ensures the point P f sandwiching between the points P s,k and P s,k+1 according to the spatial location.
If the point P f is located on the line where the interpolation points P s,k and P s,k+1 sandwich cooperatively the point P f in the middle.
If the point P f is located on the spline B 0 where S p,k , S p,k+1 and S p, f are the distances along the toolpath from the points P k , P k+1 and P f to the start point of the tool-tip toolpath, respectively. It is noted that S p,i (i = 0, 1, 2, · · · , k, · · · ) is pre-stored in the NC memory unit. According to Eq. (1), S p, f is formalized as where S 0 i is the distance from the point B 0 i to the start point of the toolpath; θ f is the tangental angle of the point P f , obtained from Eq. (11); c i is the sharpness of the airthoid spline at the i-th corner.
Following the similar procedures, the coefficient h can be obtained analogously, when the point P f is located on the Estimation of the tool-orientation contour error As shown in Fig. 5, the tool-orientation linear toolpaths are usually projected into the machine coordinate system(MCS) and then smoothed by inserting splines at the corners [25,30,34,45]. This paper focuses on estimating the tool-orientation contour point and contour error for the smoothed toolpath based on the airthoid spline in the MCS, when the tool-tip and tool-orientation motions are time-synchronized. The details to project and smooth tool-orientation linear toolpaths are available in Ref. [34].
Since the motion time isnot the characteristic parameter of the toolpath, it is a complicated work to directly estimate the tool-orientation contour point O f by directly substituting the occurrence time T P f into the the tool-orientation toolpath. As a workaround, the distance between the point O f and the start point of the tool-orientation toolpath is easily obtained with the coefficient h, and thus, it is involved to estimate the contour point O f and contour error ε o .
The distance S o, f from the point O f to the start point of the tool-orientation toolpath is conducted as where S o,k is the distance from the point O s,k to the start point of the tool-orientation toolpath, pre-stored in the NC memory unit; the point O s,i (i = 0, 1, 2, · · · , k, · · · ) is the tool-orientation interpolation point sequence, achieved in the interpolation stage. k is determined when calculating the coefficient h. Fig. 5(b), the point O f is expressed as where the points B

Discussion
The method to on-line estimate the five-axis contour error is summaried as shown in Fig. 6. Firstly, the tool-tip contour point P 3 Contour error control for five-axis local smoothed toolpaths

Control schematic of the five-axis contour error compensation strategy
A control strategy is presented to eliminate the five-axis contour error in this section, the flow chart of which is briefly illustrated in Fig. 7. The five-axis contour error is estimated and decoupled into axis components, and thus, fed into the position loop of the feed drives through the compensator. r p, j and r a, j are the j-th( j = x, y, z, a, c) axis position command and response, respectively. r c, j is the j-th axis component of the contour points. r cm, j is the j-th axis compensation component through the contour error compensator. m is the proportional gain of the contour error compensator. G j (s) is the transfer fuction of the j-th feed drive from r p, j to r a, j without the contour error compensation. Specifically, the control block diagram of the j-th feed drive is shown in Fig. 8, which is widely applied in commercial CNC systems. K p, j , K vi, j and K vp, j are the proportional gain of the position controller, the integral and proportional gains of the velocity controller, respectively. K f v, j is the gain of the velocity forward controller. J j and B j are the inertia and viscous damping of the j-th feed drive, respectively. K t, j is the torque constant of the servo motor. R g, j is the transmission ratio from the servo motor to the worktable. The transfer fuction G j (s) is expressed as where a i, j (i = 0, 1, 2, 3) and b i, j (i = 0, 1, 2) are the polynomial coefficients, which are expressed as a 0, j = K p, j K vi, j K t, j R g, j , a 1, j = K p, j K vp, j + K vi, j K t, j R g, j , a 2, j = B j + K vp, j K t, j R g, j , a 3, j = J j and b 0,

Control characteristics of the cross-coupling feed drives under the compensation
(1) Control characteristic of the contour error compensation system Without the compensation, the j-th axis component of the contour error ε j is expressed as When the compensation is invovled and m = 0, the j-th axis component ε c, j is conducted as The relationship between the contour errors with and without compensation is constructed as The transfer function G ε, j for the j-th axis component of the contour error compensation system is where It is noted that the contour error can be reduced to 1 1+m times, when the compensation is involved. Guided by this fact, the contour error will approach to zero, in case m approaches infinity. However, the control characteristic of the contour error compensation system is always influenced by the compensator gain m, according to Eq. (26). In this case, the unreasonable gain m might cause the feed drives control unstable. Therefore, it becomes of great significance to determine the gain m with consideration of the control characteristic of the contour error compensation system.
(2) Control characteristic of the tracking error feed drive system Due to coupling with the other feed drives, the equivalent control characteristics of the feed drive can be indirectly discussed by involving the compensation characteristic parameter k s, j . In this case, the j-th axis compensation component r cm, j added on the feed drive is expressed as the product of k s, j and r a, j − r p, j . Then, k s, j is expressed as k s, j = r cm, j r a, j − r p, j = r c, j − r a, j r a, j − r p, j m Under the compensation, as shown in Fig. 7, r a, j is conducted as r a, j = r p, j + r cm, j G j = r p, j + k s, j r a, j − r p, j G j (28) Combined with Eqs. (27) and (28), the transfer function G c, j for the j-th axis tracking error feed drive system is expressed as Combined with Eq. (22), G c, j is conducted as where d j,i (i = 0, 1, 2, 3) is the polynomial coefficient, and expressed as d j,0 = (1+ k s, j K p, j K vi, j K t, j r g, j , From the above analysis, it is concluded that k s, j has a crucial impact to the control stability of the tracking error feed drive system. According to Eq. (27), once the reasonable k s, j making G c, j stable is determined, the compensator gain m varies with the time-varying contour error component r c, j − r a, j . It is noted that, to make the cross-coupling feed drives stable, the determination of the compensator gain m should consider both of the control stabilities of the contour error compensation system and the tracking error feed drive system.

Determination of the compensator gain
Considering the time-varying dynamic characteristics of the feed drives, the absolute and robust control stability rules are involved to online and adaptively determine the compensator gain.
(1) Absolute control stability rule The contour error compensation system and the tracking error feed drive system should satisfy the Routh-Hurwitz criterion with a reasonable m, named the absolute stable rule. Take G ε, j hereby to illustrate the rule. The denominator polynomial in Eq. (26) should make the following inequalities hold.  Similarly, the control stability of the tracking error feed drive system is ensured by applying the absolute control stability rule to the transfer function G c, j .
(2) Robust control stability rule The compensator gain m may cause the actual feed system instable in the practice, which making the nominal model stable. The main reason is that there exists discrepancys of the model parameters between the nominal and actual models of the feed drives, such as the inertia, the damping and so on. To deal with the problem, Karitonov rule is involved to realize the robust design of the compensator gain, named the robust stable rule [46]. Take the stability of the contour error compensation system hereby to illustrate the design strategy.
According to Karitonov rule, the following Karitonov polynomials j,k (k = 1, · · · , 4) for G ε, j is expressed as where c ± j,k (k = 0, 1, 2, 3) is the critical parameter and can be formulized as where K − t, j and K + t, j are the minimum and maximum of the torque constant K t, j for the j-th axis feed system, respectively; J − j and J + j are the minimum and maximum of the mechanical inertia J j , respectively; B − j and B + j are the minimum and maximum of the mechanical damping B j , respectively; R − g, j and R + g, j are the minimum and maximum of the transmission ratio R g, j , respectively.
To make the polynomials in Eq. (32) stable, m should satisfy the Routh-Hurwitz criterion. Take j,3 as an example, the details can be expressed as Following similar procedures to determine m, the parameter k s, j can be obtained analogously to keep the control stability for the tracking error feed drive systems.
(3) Adaptive design of the compensator gain To ensure the control stability of the cross-coupling feed drives, the compensator gain m should be adaptively determined in real-time. Firstly, referring to the absolute and robust control stability rules, the feasible solution intervals of the compensator gain m c, j ( j = x, y, z, a, c) and compensation characteristic parameter k s, j are determined, respectively. Secondly, according to the calculated five-axis contour points, r c, j (t) is real-time obtained. Then, combined with r p, j (t), r a, j (t) and k s, j , the sub-optimal compensation gain m k, j (t) is real-time conducted with Eq. (27). Finally, adaptively take the minimum value of the suboptimal compensation gains, m c, j and m k, j (t), as the optimal compensator gain m(t) at the current moment. It is noted that m c, j and m k, j (t) are derived from the each feed drive of the five-axis machine tool, including x, y, z, a, c axis feed drives. m(t) is online determined by the five-axis contour error and the control characteristics of five feed drives, which can be expressed as

Summary of the contour error estimation and control method in five-axis CNC machining
As a summary of the proposed five-axis contour error estimation and control method in Sections 2 and 3, a systematic flowchart for the main steps in five-axis CNC machining is shown in Fig. 9.
(1) Real-time smooth and interpolation of the five-axis linear toolpaths  The five-axis G01 commands are blended as the smoothed tool-tip and tool-orientation toolpaths with airthoid splines. The tool-tip and tool-orientation motions are synchronized by sharing the motion time at the look-ahead stage, and thus, the interpolation datas are cyclically generated. According to the inverse kinematic transformation (IKT), the reference position commands (r p,x , r p,y , r p,z , r p,a , r p,c ) are obtained. The details for the local smoothing method and the interpolation strategy are available in Ref. [34]. It is noted that the geometry characteristics of the smoothed toolpaths and the interpolation datas are iteratively stored in the NC memory unit.
(2) On-line estimation of the five-axis contour error Following the commands, the five-axis contour error generates. Through the forward kinematics transformation (FKT), the actual tool pose is calculated based on the position responses of the feed drives (r a,x , r a,y , r a,z , r a,a , r a,c ), including P a in the workpiece coordinate system(WCS)and O a in the machine coordinate system(MCS). Due to the geometry characteristics of the toolpaths, the tool-tip contour point P f is analytically calculated as mentioned in Section 2.2. Then, the tool-orientation contour point O f is conducted based on the occurence time of the tool-tip item, as presented in Section 2.3. The contouring tool pose r c,x , r c,y , r c,z , r c,a , r c,c in the MCS is obtained through the IKT further.
(3) Real-time control of the five-axis contour error The sub-optimal compensation parameter m c, j and the characteristic parameter k s, j for the j-th feed drive are off-line determined as mentioned in Section 3.2. In the compensation stage, the current compensation gain m(t) is real-time obtained based on m c, j , k s, j and the five-axis contour error, as presented in Section 3.3. Then, the j-th axis compensation component r cm, j (t) is fed on the position loop of the j-th feed drive.

Simulation
The proposed five-axis contour error estimation and control method is simulationally performed on a personal computer with 3.1GHz CPU. Theinterpolation and contour-following modules for the five-axis commands are fulfilled in MATLAB/Simulink environments. The sampline frequency is set as 1ms. The simulation tests are carried out on a fiveaxis machine tool with a A-C tilting-rotary-table. The control model of the feed drives is shown in Fig. 8. Unless special stated, the model parameters are presented in Table 1. In addition, a friction model is involved to simulatethe nonlin- Fig. 13 Number of iterations to calculate the contour point with the compared method ear external interference [47]. The expression for the friction torque T f , dependent on axis velocity ω, and actuation torque T , is written as where T + s is the static friction force in the positive direction, T − s is the static friction force in the negative direction, T + c is the coulomb friction force in the positive direction, T − c is the coulomb friction force in the negative direction. To simply the simulation process, the coulomb friction force and static friction force are set as constant values, which are presented in Table 2 According to the FKT, the position in the WCS can be obtained from the MCS as where P = P x , P y , P z To highlight the advantages of the proposed methods, a five-axis toolpath composed of four linear segments is  conducted for the test, as shown in Fig. 10(a). The toolorientation toolpath in the WCS is converted into A-and C-axis linear commands in the MCS, referring to Eq. (38).
With the predefined tool-tip and tool-orientation approximation error tolerances as 80μm and 60μrad, the tool-tip and tool-orientation smoothed toolpaths are shown in Fig. 10(b) and (c), respectively. According to the predefined kinematic constraints as mentioned in Ref. [34], the position commands and acceleration profiles for the feed drives are obtained through the time-synchronization motion scheduling, as shown in Fig. 11. Following the position commands, the tracking errors of feed drives generate based on the illustrated control model parameters in Table 1 and the friction model parameters in Table 2. As a result, the tool pose derivates the desired toolpath, and thus, the five-axis contour error generates. First of all, the effectiveness of the proposed estimation algorithm is investigated. A traditional estimation method is involved to show the advantages of the proposed algorithm. In the comparison method, the tool-tip contour error is estimated as the shortest distance between the actual tool-tip position and the nearby polygon segments, the later of which are formed by the interpolation points, according to the Ref. [6]. The tool-orientation contour error is determined by synchronizing the tool-orientation contour point with the tool-tip item based on the motion time. The estimation results of the five-axis contour error are illustrated in Fig. 12(a) and (b). It is found that the comparison method has obtained the poor estimation accuracy in some area. This phenomenon can be understood as follows. In the comparison method, the tool-tip contour point is located on the linear segments formed by the interpolation points rather than the desired toolpath. There exists the deviation between the linear segments and the reference path. The approximative tool-tip contour point results in the deviation of the tool-orientation contour error further. Figure 13 shows the number of the iterations to find the contour points in the compared method. It is noted that the number is varied, since the geometric characteristics of the toolpaths are ignored. It leads to the computation burden in five-axis CNC machining. From the verification testing results, the proposed method possesses the higher estimation accuracy and the faster calculation efficiency to on-line estimate the five-axis contour error.
After that, to indicate the performance of the proposed compensation method, the compensation is employed based on the mentioned test toolpath. Two comparison methods are employed, including the pre-compensation scheme [35] and the traditional feedback compensation method [13]. For the pre-compensation scheme, two different cases are involved. In the pre-compensation I, the compensation values are obtained based on the transfer functions of the feed drive systems with the accurate model parameters.
In the pre-compensation II, the compensation values are obtained with the inaccurate model parameters, including K p = 51s −1 for the A-axis feed drive. Moreover, three sinusoidal forces (unit N · m) are respectively added on the X −, Y − and A− feed drive to imitate the external disturbances, such as T x = 0.5 sin(0.5π t + π), T y = 0.3 sin 0.5π t, and T c = 0.03 sin(π t + 0.05π). For the traditional feedback compensation method, the compensator gain is invariable as 2, which is obtained by ensuring the nominal control system stable and obtaining the good response characteristic simultaneously.  Figure 14 shows the five-axis contour error with and without the compensation. Table 3 presents the maximum and average values of the contour error with and without the compensation. As depicted in Fig. 14, the pre-compensation method based on the precise model parameters effectively eliminates the contour errors, whereas the method has failed under the inaccurate parameters and the external disturbances. The main reason is that the compensation values are predicted based on the transfer functions of the feed drives.
The compensation effect is sensitive to the modeling accuracy of the feed drive system. However, the model parameters of the feed drives always change, since there exists the modeling errors, the random external disturbance and so on. Therefore, the pre-compensation method has the poor ability to eliminate the contour errors, when the deviations between the nominal and actual models obviously emerge.
In the simulation using the proposed compensation method, the sub-optimal compensator gain m c, j ( j = x, y, z, a, c) and the compensation characteristic parameter k s, j are off-line determined as 2 and −1 to ensure a highly stable and smooth control. During the calculation, the parameters of the feed drives are presented in Table 1 and the corre-sponding items in Eq. (33) are scaled to (1 ± 0.05) times the original values. Compared with the proposed compensation I, the proposed compensation II is executed under the external disturbance, which is mentioned in the pre-compensation II. As shown in Fig. 14, the proposed method successfully eliminates the contour errors, whether or not external disturbances emerge. Figure 15 shows the compensator gain of the proposed compensation method. The compensation gain is real-time and adaptively determined in the proposed compensation I and II. For the feedback compensation method with the invariable gain, the simulation system obtains the unreasonable contour accuracy. From the verification testing results, it can be seen that the proposed method possesses the better performance than the traditional pre-compensation and feedback-compensation methods.

Experiment
To carry out analysis on the proposed methods further, an in-house five-axis machine tool is designed, as shown in Fig. 16. The equipment is composed of an industry computer, a motion controller system and a five-axis mechanical Fig. 19 Experimental results of the contour error estimation system. The industry computer is used to execute the interactive operation. The motion controller, based on a dSPACE 1005 real-time control board with 1 GHz CPU and 128 M SDRAM, is utilized to generate the axial commands, fulfill the position control and realize the contour error compensation. The sampline frequency is set as 1ms. The X-or Yaxis linear feed drive is composed of a ball screw with the lead of 5 mm/rev. The Z-axis linear feed drive is guided by a ball screw with the lead of 10 mm/rev. These are driven by servomotors (SGM7J-04A7C6S, Yaskawa). In addition, the A-and C-axis feed drives are directly driven by a servomotor (SGMCS-08D3C41, Yaskawa) and a servomotor (SGMCS-02B3C41, Yaskawa), respectively. The five amplifiers are working with the built-in current control loop, and the motion controller is designed to undertake the feedback control of the velocity and position loops with PID controllers. The FKT and IKT between the WCS and the MCS are presented as Eqs. (37) and (38), respectively. Based on the parameter identification, the mechanical parameters and controller gains are shown in Table 1.
The linear segments generated by CAM are involved as the testing toolpath, as shown in Fig. 17(a). By setting the tool-tip and tool-orientation approximation errors as 80μm and 60μrad, the smoothing results for the tool-tip toolpath in the WCS and the tool-orientation toolpath in the MCS are shown in Fig. 17(b) and (c). According to the predefined kinematic constraints in Ref. [34], the position commands and acceleration profiles are determined using the time-synchronization motion scheduling as shown in Fig. 18. Figure 19 shows the actual and estimated contour errors, the later of which are obtianed based on the proposed estimation method. It can be seen that the estimation derivation using the proposed method is less than 10 −6 mm and 2×10 −7 rad. These observations suggest the effectiveness of the proposed method to on-line estimate the contour errors with the high-accuracy. Figure 20 presents the feedback-compensation values for the feed drives and the compensator gain using the proposed method, respectively. Figure 21 shows the contour errors before and after the compensation. Also, the statistical analysis is presented in Table 4.
As indicated in Fig. 21 and Table 4, the proposed method performs excellent compensation results, which significantly improves the contour accuracy.  To further demonstrate the advantages, the proposed compensation strategy is integrated with the traditional precompensation method [35], which is denoted as the comprehensive method. In this case, the pre-compensation method is used to predict the incoming contour errors, and add the pre-compensation values on the commands of the feed drives. At the same time, the proposed method is employed to estimate the existing contour errors, and add the feedback-compensation values on the commands of the position loops. Figure 20 presents the pre-compensation and feedback-compensation values for the feed drives, and the compensator gain under the comprehensive method, respectively. The experiment results are presented in Fig. 21 and Table 4. The contour errors are effectively reduced by implementing the synthesized methods. It indirectly demonstrates that the proposed method can perform the high machining accuracy.

Conclusion
Contour errors directly affect the dimension accuracy of the machined parts in five-axis CNC machining. This paper proposes a contour error estimation and control method for five-axis local smoothed toolpaths based on airthoid splines. Compared with the existing research works, the proposed method has already been proven to be beneficial in the following advantages.
(1) Based on the expression of the smoothed toolpaths, the tool-tip contour error is analytically calculated, thus the high-accuracy estimation is on-line obtained. (2) The tool-orientation contour error is synchronized with the tool-tip item by sharing the motion time based on the designed time scale coefficient. It can be applied to the five-axis toolpaths with the motion planning through the time-synchronization scheme. (3) A contour error compensation method is constructed to on-line eliminate the five-axis contour error. The method is proposed toward to the feed drives with PID controllers and position-velocity-current loops, and thus it can be easily applied to commercial CNC systems. (4) An adaptive scheme is developed to online determine the gain of the contour error compensator. Compared with the traditional methods, the compensation effect is pleasantly achieved without making the control system unstable.