Abstract
Because micro-line segments are the most widely used form of tool-paths for computer numerical control machining, the smoothness at the junction of two adjacent segments is still the bottleneck for the machining quality and efficiency. To reduce the time spent by the smoothing process and improve the smoothness at the junction, this article proposes a real-time and look-ahead interpolation algorithm with an axial jerk-smooth transition scheme. In one step, the algorithm finishes the transition scheme construction and velocity planning by using the trigonometric velocity planning method. This method can utilize the maximal acceleration and/or jerk capabilities of drive axis to achieve smooth axial kinematic profiles while satisfying the user-specified chord error. In addition, a real-time look-ahead method is developed to plan the global feedrate profile and adjust the transition schemes without intersections constantly. The simulation results demonstrate that the proposed algorithm could realize smooth axial velocity, acceleration and jerk control and improve the smoothing process efficiency and machining accuracy.
Keywords
Introduction
For the computer numerical control (CNC) machining of complex curves and surfaces such as impellers, blades and aerospace components, short line segments or G01 codes are still the most widely used form of tool-paths. If linear paths are interpolated directly, discontinuities of velocities at junctions of adjacent segments will bring about large fluctuations of velocity, acceleration and jerk of drive axis, 1 which causes vibrations of the machine tool and reduces the machining efficiency and quality. Therefore, a significant amount of research has been conducted to obtain smooth trajectories, including the global smooth method (GSM) and local smooth method (LSM).
In the GSM method, tool-paths that comprise micro-line segments are transformed into one or several smooth spline curves by an approximation or interpolation approach. For example, FANUC and SIEMENS companies proposed the Smooth Tolerance+ Control function 2 and Advanced Surface and Top Surface function, 3 respectively, which generate a smooth curve for a machining path specified with continuous small blocks. The methods used in these approaches are, however, not available in the published literature. Zhang et al.4,5 adopted the cubic spline curve to interpolate tool-paths, which can pass exactly through all the data points. Zhang et al. 6 extended the cubic spline curve to the quintic polynomial curve with the least-square method. Another method is based on the Akima spline curve,7,8 in which the curve not only passes through all the data points exactly but also has the first-derivative continuity. However, these three kinds of spline curves are locally defined, therefore any change in one data point can significantly affect several adjacent points. Hence, many researchers have focused on the use of B spline curve.9–11 Yang et al. 12 fitted polyline machining tool-paths into quadratic B spline curves with respect to time parameter. In order to reduce the number of control points and iterations, Zhao et al. 13 found dominant points from discrete data points and approximated them into cubic B spline curves, but only the G0 continuity was achieved at the junction of adjacent curves. Zhao et al. 14 constructed G2 continuous Bézier curves without iterations, but only the second-order Taylor expansion formula was used to estimate and control fitting errors. Wang and Yau 15 developed a real-time NURBS interpolation methodology with a look-ahead function to recognize line segments which could be transformed into continuous NURBS blocks. Although the GSM could achieve very smooth trajectories that approximate the original curves closely, the method presents the following three shortcomings. First, the complex fitting conditions lead to heavy computation load with the required iterative algorithms. Second, it is difficult to calculate fitting errors accurately, and the process of adjusting the parametric curves is complicated. Third, inevitable errors caused by utilizing truncated Taylor series result in fluctuations in the feedrate.
For the LSM, tool-paths are blended by inserting curves, such as arcs or parametric curves, in junctions of adjacent short line segments to improve velocity profile while passing through the corners. Because these processes are local and contour errors can be easily controlled, many researchers have focused on this method. Lee and Hascoet, 16 Zhang and Zhou 17 and Lv et al. 18 constructed a circular arc tangent to adjacent line sections at the corners. Zhang et al. 19 adopted the quintic polynomial curve, and Ernesto and Farouki 20 utilized the rational quadratic Bézier curve. But these methods only provide velocity continuity or G1 continuity at the junctions, which would result in normal acceleration-induced vibration. Hence, Sencer et al. 21 fitted quintic B spline curves to smooth the blocks, which ensures continuous curvatures or G2 continuity. Du et al. 22 adopted the cubic Bézier curve, but the method needs a significant amount of calculation to estimate the proper transition lengths. Yutkowitz and Chester 23 realized corner-blending with two fourth-order polynomial curves at the cost of significant computational load. Zhao et al. 24 achieved curvature-continuous trajectories by inserting two symmetric cubic B Splines in the junction. In order to further improve the continuity, Fan et al. 25 generated curvature-smooth or G3 continuous tool-paths with two quartic Bézier curves, which is helpful to reduce vibration in machinery. However, even though the reviewed algorithms can obtain smooth trajectories and motion profiles, they still have the following three basic drawbacks. First, they need two computational steps. In the first step, the transition geometry is constructed by inserting parametric curves at the corners. In the second step, according to synthesized trajectories, the motion profiles are scheduled. This method is therefore not very efficient. Second, it is difficult to calculate the curve lengths accurately. Third, by only considering tangential kinematic limits, fluctuations are caused in the velocity, acceleration and/or jerk in the drive axis direction. Recently, the one-step LSM, in which the transition curve construction and velocity planning are conducted in one step, has attracted the interest of researchers. Sencer et al. 26 and Biagiotti and Melchiorri 27 adopted finite impulse filters to smooth linear paths, but the method causes unavoidable delay and large contour errors. Zhang et al. 28 utilized the quadratic Bézier curve in the time domain and axial linear acceleration and deceleration approach to achieve optimal interpolation, but the method does not guarantee chord error and axial jerk bounds.
Tsai and Huang 29 incorporated servo dynamics into transition curve generation to improve dynamic contour accuracy. Duan and Okwudire 30 used optimal control to generate time-optimal kinematic trajectories. However, these one-step algorithms only consider axial acceleration limit. Tajima and Sencer 31 developed a kinematic corner smoothing algorithm based on a jerk-limited acceleration profile to achieve optimal-time feed motion. The method, however, assumes that G01 blocks are long enough so that corners could be blended without interfering with adjacent transition curves. In addition, changes in jerk can occur at the corners since a jerk-limited acceleration method is used.
In this article, a real-time and look-ahead interpolation algorithm with an axial jerk-smooth transition scheme is proposed for CNC machining of micro-line segments, which would improve the efficiency of the smoothing process and the resulting smoothness. In section “Transition scheme,” the proposed algorithm is used to construct transition curves and conduct velocity scheduling in one step using the trigonometric velocity planning method (TVPM). TVPM can utilize the maximal acceleration and/or jerk capabilities of the drive axis to achieve smooth axial kinematic profiles while satisfying the user-specified chord error. In section “Real-time interpolation with look-ahead function,” a real-time look-ahead model is developed for planning the global feedrate profile to guarantee attainment of two corner velocities on every block. In section “Simulation validations,” simulation results validating the proposed approach are presented. Concluding remarks are provided in section “Conclusion and discussions.”
Transition scheme
Transition curves are constructed by planning motion profiles of the axes, which is different from the traditional LSM, in which parametric curve fitting is followed by tangential feedrate scheduling. In this section, a scheme is presented for synthesizing the transition under chord error and axial kinematic constraints to achieve axial jerk-smooth motion profiles.
Trigonometric velocity planning method
In contrast to jerk-limited velocity planning methods, TVPM can achieve a jerk-smooth profile without exhibiting sudden changes in jerk at the corners. Supposed that the initial and terminal acceleration and jerk are zero and that the velocity increases from vs to ve during the period T. The trigonometric displacement function can then be described as follows
where t denotes the time,
Taking the first, second and third derivatives of equation (1) with respect to the time, the velocity, acceleration and jerk functions are obtained as follows
Figure 1 shows the jerk-smooth motion profiles. Here, for the given initial and terminal conditions, the following relationships are derived for the time t = 0 and t = T

Jerk-smooth motion profiles.
Let J and –J indicate the maximum and minimum jerk, respectively, and the maximum acceleration be A. Then as shown in Figure 1, the acceleration curve reaches its maximum at the time t = T/2. Then from equation (3)
And the jerk curve achieves the maximum and minimum at the times t = T/4 and t = 3T/4, respectively, as follows
To simplify coefficient calculations, let
Then, from equations (5) to (14), the coefficients are calculated as follows
Finally, the jerk-smooth kinematic functions are obtained as given in equation (16) by substituting the coefficient equation (15) into equations (1)–(4)
Transition construction scheme with prescribed chord error and axial jerk-smooth motion profiles
The proposed transition scheme is illustrated in Figure 2. The point Ps,i is chosen as the origin to establish the x–y coordinate system. The corner consists of two line segments Pi–1Pi and PiPi+1 with lengths li and li+1, respectively. The curve with dotted line from the point Ps,i to the point Pe,i is the synthesized transition curve with the corner length Lc,i for the line segments Ps,iPi and PiPe,i. In order to reduce the transition construction complexity, we let the lines Ps,iPi and PiPe,i to be equal in length and assume that the corner motion has equal initial and terminal tangent velocity vc,i, acceleration ac,i = 0 and jerk jc,i = 0. Hence, the objective of this section is to determine the maximum corner velocity vc,i and length Lc,i based on a prescribed chord error

Transition construction scheme.
To find the maximum corner velocity vc,i, at least one of the axis acceleration or jerk limit must be saturated. Hence, vc,i should be determined by the axis experiencing the largest velocity change at the corner, namely, the limiting axis.
As an example, let the x-axis be the limiting axis, and let Ax and Jx indicate the acceleration and jerk of the x-axis; Axmax and Jxmax indicate their limits, respectively; and F indicates the programmed feedrate. In this example, three constraints, namely, the peak acceleration and jerk in the x-axis are limited to Axmax and Jxmax, respectively, and the contour error εi, Figure 2, is bounded.
First, the boundary velocities should be bounded. From Figure 2, the start and end velocities of x-axis are defined as follows
where θ1 is the angle between the vector
From equation (16) at the time t = T, we get the end velocity as follows
Substituting equations (17) and (18) into equation (19), we can get
Then by adjusting equation (20), the corner velocity v1 is achieved as follows
Second, to avoid intersection of adjacent transition curves, the corner motion length Lc,i is constrained to
where Lc,i–1 is the corner length of the previous corner
The x-axis displacement scx,i is calculated based on the corner geometry as follows
From equation (16) at the time t = T, we can also get the displacement scx,i as follows
Then from the equations (17) and (22)–(24), the corner velocity v2 becomes
Third, the chord error is also considered to be bounded. As can be seen in Figure 2, Pm,i is the mid-point of the transition curve. Since the initial and terminal tangent velocities, accelerations and jerks of the corner motion are the same, the transition curve is symmetric about the bisector of the angle
The x-coordinate of the point Pi is seen in Figure 2 to be
The projection of corner error εi on the x-axis is also seen to be
From equation (16), the x coordinate of the point at the time t = T/2 is as follows
Now let xm,i – xi =εx,i and εi = ε. Then the corner velocity v3 is calculated from equations (17) and (26)–(28) as follows
where
Finally, the maximum corner velocity vc,i is determined by the programmed limitation on the feedrate and bounds on the velocity, corner length and chord error, that is
Now the initial and terminal velocities vsx,i and vex,i are given by equations (17) and (18), respectively. Ax is computed by substituting vc,i and Jx =Jxmax into equation (21). And Lc,i is achieved from equation (25) with v2 = vc,i, Ax and Jx. We can then determine the desired jerk-smooth trajectory for the x-axis by substituting the calculated values into equation (16). Then, let the y-axis be the limiting axis, and the jerk-smooth trajectory for y-axis is synthesized using the same process with similarly applicable operational limitations for the axis.
If Ty > Tx, y is the real limiting axis. In order to synchronize the corner motion, we need to adjust Ax, Jx according to equations (16) and (19) with the motion period of y-axis Ty for re-synthesizing the jerk-smooth trajectory of x-axis; Otherwise, x is the real limiting axis. Similarly, the jerk-smooth trajectory of y-axis is re-created with Tx, recalculated Ay and Jy.
Real-time interpolation with look-ahead function
Figure 3 illustrates the flow chart of the present real-time interpolation scheme with the look-ahead characteristic feature. It can be seen that the look-ahead scheme process involves two modules: the initialization module, which is used to construct smooth trajectories and axial motion profiles without the intersection of adjacent transition curves and the backward scanning module, which guarantees the global feedrate profile and accessibility of corner velocities. These two modules are described in the following sections.

Flow chart of real-time interpolation with look-ahead function.
Look-ahead initialization
A look-ahead buffer with N units is used to store the kinematic information of line segments and transition curves as shown in Figure 4. Before machining, the N line segment data loaded into the buffer and the transition schemes are constructed as was described in section “Transition scheme.” Then, trajectories comprising line segments and transition curves are obtained as shown in Figure 5. Li and Li+1 are corner lengths of joint points Pi and Pi+1, and vc,i and vc,i+1 are their corner velocities, respectively. li+1 is the length of the i + 1th line segment, and di+1 is its interpolation length.

Look-ahead buffer.

Synthesized trajectories.
Backward scanning
To guarantee that on every line segment the tangential velocity can change from vc,i to vc,i+1 within the length di+1 and that the global velocity profile can be achieved, the following five steps are needed to be executed in this module:
Step 1. Let the start velocity of the first segment vc,0 and the end velocity of the Nth segment vc,N be equal to zero in the buffer, and let j = N – 1, p = 0.
Step 2. Use the TVPM to plan motion profiles from vc,j+1 to vc,j along the interpolation length dj+1.
If the planning succeeds, the terminal condition is satisfied. Otherwise, perform the following process to reduce the velocity vc,j or vc,j+1:
If vc,j < vc,j+1, calculate the maximum reachable velocity
Step 3. The backward scanning process is finished only when one of the following two conditions is satisfied: j ≤ 0. p = 1 and the terminal condition is satisfied.
Otherwise, let
Step 4. Real-time interpolation: Take the first segment to machine. When finished, delete it from the buffer. If p equals to zero, set p = 1.
Step 5. Add a new line segment at the end of the buffer, set its end velocity equal to zero and construct the transition scheme. Then let j = N – 1 and go to Step 2 to do the backward scanning process again.
Simulation validations
In this section, the results of simulations that are performed to validate the feasibility, effectiveness and performance of the proposed real-time look-ahead interpolation algorithm with axial smooth transition scheme are presented.
Case 1
In this simulation, the proposed algorithms are implemented with VS2013, and the software used for plotting is MATLAB 2015. For the hardware, Intel Atom N450 CPU 1.66GHz is used. As shown in Figure 6(a), the lightning-shaped tool-paths with two obtuse angles is utilized. The machining direction starts from point B and ends at point E. The tangential federate F is set to 50 mm/s, the acceleration and jerk limits for both axes are considered to be Axmax =Aymax = 2000 mm/s2 and, Jxmax =Jymax = 250,000 mm/s3, respectively. The sample time and chord error limit are considered to be T = 0.002 s and ε = 0.1 mm, respectively.

Tool-paths of case “1”: (a) synthesized trajectories and (b) enlarged profile of corners C and D.
After applying the smoothing algorithm, the synthesized trajectories comprising line blocks and curves are presented in Figure 6(a). To illustrate the transition scheme clearly, profiles of the corners C and D are enlarged, as shown in Figure 6(b). From Figure 6(b), we can see that these two curves do not overlap. In Table 1, corner lengths of angles
Parameters of the synthesized trajectories.
The simulation results are shown in Figure 7. Figure 7(c) shows the resulting jerk profiles for the x-axis and y-axis jerk curves. It can be seen that the jerks do not exceed the specified limits amounts and that they are both smooth and without sudden changes at corners. The acceleration and velocity profiles are shown in Figure 7(a) and (b), respectively. The contour error curve is shown in Figure 7(d) and is seen to stay within the specified limit of ε. It is therefore concluded that the proposed algorithm would yield trajectories that satisfy the specified requirements and drive constraints for machining accuracy

Simulation results of the case “1”: (a) velocity, (b) acceleration, (c) jerk and (d) contour error profiles.
Case 2
To evaluate the proposed algorithm, the following two algorithms were also implemented as the basis for comparison: a jerk-limited algorithm 31 and a polynomial algorithm. 19 The jerk-limited algorithm 31 achieves the transition curve and axial jerk-limited motion profiles in time domain in one step. The polynomial algorithm 19 uses the quintic polynomial to construct the transition curve in arc length domain and then uses a trigonometric velocity planning method to schedule the blended tool-paths.
The proposed algorithm obtains the transition curve and axial jerk-smooth motion profiles in time domain in one step as described in section “Real-time interpolation with look-ahead function.”
The jerk-limited algorithm 31 is selected as one of the comparison algorithms since this algorithm can obtain axial jerk-limited profiles, while other one-step algorithms26–30 only consider the axial acceleration limits. In addition, the jerk-limited and the proposed algorithms both use velocity planning to synthesize transition curves. Meanwhile, to show the difference between one-step and two-step methods, the quintic polynomial algorithm 19 is used as the comparison algorithm. In this method, the transition curve construction and the kinematic scheduling are separately implemented, and the conventional trigonometric velocity planning method is employed to schedule the blended toolpath.
To validate the effectiveness of the proposed method, the smoothness and the required computing times of the synthesized motion trajectories are utilized as the evaluation indexes.
In this case, the following typical settings are considered: a tangential feedrate of F = 100 mm/s, acceleration limit of the drive axes Axmax=Aymax=2000 mm/s2, jerk limit of the drive axes Jxmax=Jymax=100,000mm/s3, a sample time of T = 0.002 s and a chord error limit of ε = 0.1 mm.
The trident-shaped pattern, Figure 8, is employed as the tool-paths. It consists of two acute angles, one right angle and two obtuse angles. After the smoothing processing of the three algorithms, the synthesized trajectories and enlarged corner transition curves are shown in Figure 8.

Trident-shaped trajectories and enlarged transition corner curves.
As shown in Figure 9(a), tangential velocities of the three algorithms are all smooth and below the specified federate F. In addition, as can be seen in Figure 9(b) and (c), the x-axis and y-axis velocities of the polynomial algorithm are not smooth at corners, while those of the jerk-limited algorithm are smooth. The axial acceleration and jerk profiles of these two comparison algorithms are also seen in Figure 9(d)–(g) to be significantly inferior as compared to the proposed algorithm. In Figure 9(d)–(g), the axial accelerations and jerks produced by the polynomial algorithm fluctuate frequently and exceed the specified limitations at corners due to the use of tangential kinematic constraints alone. And since the jerk-limited algorithm only guarantees the jerk-limited motion profiles under the axial kinematic limits, its axial accelerations are not smooth, and its axial jerks exhibits sudden changes at the corners. It can therefore be concluded that the synthesized motion profiles with the two comparison algorithms are more prone to causing vibration in the machine tool with the resulting surface quality issues. The proposed algorithm, on the other hand, has smooth axial velocity, acceleration and jerk profiles. The proposed algorithm should therefore achieve significantly better machining flexibility and machining quality.

Comparison of the kinematic profiles for the Case 2: (a) tangential velocity profiles, (b) x-axis velocity profiles, (c) y-axis velocity profiles, (d) x-axis acceleration profiles, (e) y-axis acceleration profiles, (f) x-axis jerk profiles and (g) y-axis jerk profiles.
In Table 2, we can see that the machining time of the polynomial algorithm is the slowest at 1.8165 s, which is 1.3% and 3.7% slower than the proposed (1.7927 s) and jerk-limited (1.7515 s) algorithms, respectively. The computing time of the polynomial algorithm is 1.75 and 1.84 times longer than the proposed and jerk-limited algorithms, respectively. The reason for longer machining and computing time of the polynomial algorithm is due to separate tasks of constructing the transition curve and velocity planning, in which only the tangential kinematic limits are considered. Figure 10 shows the contour errors. As can be seen, large contour errors happen at the corners, but none of the three algorithms exceed the specified contour error ε.
Statistical data of experimental performance for the Case 2.

Contour errors for the Case 2.
As can be seen in Table 2, the maximum contour error of the proposed algorithm is 0.0721 mm, which is 17% and 3.7% less than the polynomial and jerk-limited algorithms, respectively. The mean contour errors of the proposed, polynomial and jerk-limited algorithms are 0.0018, 0.0023 and 0.0019 mm, respectively. So, the proposed real-time look-ahead interpolation algorithm with axial smooth transition scheme can also satisfy the requirement of machining accuracy and efficiency.
Case 3
In this case, a more complex pattern shown in Figure 11 is used for comparison of the performance of each of the above three algorithms. The pattern is closed and comprises 15 corners. The simulation conditions are the same as those of case 2. Similarly, the two-step quintic polynomial algorithm with the trigonometric velocity planning method 19 and the axial jerk-limited transition algorithm 31 are used for comparison and are referred to as the “polynomial algorithm” and “jerk-limited algorithm,” respectively.

Star-shaped trajectories and synthesized transition curves.
The comparison of the simulation results is shown in Figures 12 and 13. From Figures 12(a) and 13, we can see that the tangential velocity curves of the three methods are smooth and below the programmed feedrate F, and that all the chord error curves are restricted to ε.

Comparison of the kinematic profiles for the Case 3: (a) tangential velocity profiles, (b) x-axis velocity profiles, (c) y-axis velocity profiles, (d) x-axis acceleration profiles, (e) y-axis acceleration profiles, (f) x-axis jerk profiles and (g) y-axis jerk profiles.

Contour errors for the Case 3.
However, in Figure 12(b) and (c), the axial velocity profiles of the polynomial algorithm are seen not to be smooth at the corners. In addition, Figure 12(d)–(g) shows that the polynomial algorithm axial accelerations and jerks fluctuate frequently and exceed the specified limitations at corners since the method only uses tangential velocity planning.
For the case of jerk-limited algorithm, its axial acceleration profiles are not smooth and its axial jerk curves change abruptly at the beginnings and ends of accelerating or decelerating periods at the corners.
The proposed algorithm, however, is shown to provide smooth axial velocity, acceleration and jerk profiles during the entire motion, as can be seen in Figure 12. In Table 3, we can see that the polynomial algorithm requires close to twice the computing time of the proposed and jerk-limited algorithms. The machining time of the proposed algorithm is shown in Table 3 to be 5.5057 s, which is 2.4% slower than the jerk-limited algorithm (5.3765 s). However, it has a significantly reduced corner errors and should reduce machine tool vibration. It is therefore concluded that the proposed real-time look-ahead interpolation algorithm with axial smooth transition scheme can satisfy the requirements of machining efficiency and achieve a significantly better machining flexibility and machining quality.
Statistical data of experimental performance for the Case 3.
Conclusion and discussions
In this article, a real-time and look-ahead interpolation algorithm with axial jerk-smooth transition scheme for CNC machining of micro-line segments is proposed. Transition curves and axial motion profiles are constructed in time domain simultaneously using the TVPM and look-ahead functions.
Compared to previous published work, the proposed algorithm has the following advantages. (1) The one-step process to obtain the transition curve and motion profiles improves the efficiency of the trajectory smoothing. The intersection of adjacent transition curves can also be avoided. (2) TVPM makes the calculation of kinematic functions easier and realizes the smooth axial velocity, acceleration and jerk control under chord error and drive axes constraints, noting that for high-speed machining, smooth axial motion profiles are more important than the tangential ones. (3) The look-ahead function guarantees the global feedrate profile and attainment of two corner velocities on every segment. In addition, due to the use of terminal condition, the look-ahead process can be terminated without scanning all the buffer units, which improves the efficiency of the look-ahead process.
The simulations are conducted to validate the feasibility and effectiveness of the proposed algorithm. The results show that the developed real-time and look-ahead interpolation algorithm with axial jerk-smooth transition scheme can achieve smooth trajectories and axial motion profiles and improve the smoothing process efficiency and achieve machining accuracy.
Future work will focus on two aspects. First, we are in the process of implementing the proposed algorithm on an open-source CNC 3-axis system and plan to publish the results shortly after. Second, more servo dynamics, such as jounce, is to be considered in the proposed algorithm.
Footnotes
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.
Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This work was supported by the National Science and Technology Major Project of China (Grant No. 2017ZX04001001) and the China Scholarship Council (Grant No. 201704910554).
