Local tool path smoothing based on symmetrical NURBS transition curve with look ahead optimal method: experimental and analytical study

Linear tool path with the inherent shortcoming of tangential and curvature discontinuities leads to poor machining efficiency and surface finish. A lot of local corner smoothing methods which inset a tiny spline curve at the corners have been proposed in literature. However, there exists potential overlap of the two adjacent spline curves while smoothing, and still no optimal solution to fully use the segment length of each corner while eliminating the overlaps. To optimally eliminate the overlaps and smooth the transition curve curvature in real time, a symmetrical non-uniform rational B-spline (NURBS) curve transition based on look ahead optimal method is proposed in this paper, by scanning a set of unconstrained pre-cornering transition curve information, analysing the overlap type and backward determining the optimal transition length with curvature extreme smoothness in consideration, thus fully use the linear segment length of each corner and fully increasing the feedrate at the corners. G2\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${G}^{2}$$\end{document} continuity, analytical expression of the curvature extreme, approximation error constraint, and real-time performance are considered simultaneously in this paper. Simulation and real machining experiments are made to compare with the existing symmetrical rounding algorithms, the results show that the proposed method has a significant curvature decrease of 17.64% and 4.44% improvement of efficiency, and the curvature distribution of the adjacent curves are balanced, thus improved the machining velocity smoothness. In addition, the real machining experiment results validate the proposed method can work well in 125 μs real-time control period CNC system.

The remained length of ith segment after transition d i, 0 Length of control polygon a i,0 , a i, 1 Unit tangential vector β Corner angle of two adjacent linear segments k m Curvature extreme of the ith transition curve ε i Geometric error of the ith transition curve C i (u) Transition curve P i−1 , P i , P i+1 , P i+2 Point of linear tool path Q i,0 , Q i,1 , Q i,2 , Q i,3, Q i, 4 Control points of NURBS curve w i,0 , w i,1 , w i,2 , w i,3, w i, 4 The weights of control points of NURBS L i,0 , L i,1 , L i+1, 0 Transition lengths of transition curve m The maximum allowed geometric errors

Introduction
With the rapid development of modern aviation, aerospace, and model industries, a large number of complex curve and surface modelling are used in the parts design. The parametric curves, such as polynomial splines, Bézier, B-spline, and NURBS, are usually used to describe these mechanical parts in computer aided design (CAD) software, which are also the ideal representations of the tool paths in free-form machining. However, most of tool paths are still represented as series of linear segments (G01) and circular segments (G02 or G03) which discretizing the parametric curves under the predefined tolerance in computer aided manufacturing (CAM) software [1]. Due to the tangency and curvature discontinuities of the linear and circular tool paths at the joint points, frequent decelerations and accelerations may lead to poor machining efficiency and accuracy [2]. To solve these problems, smoothing the discontinuous linear segments is very significant for ensuring the high order geometric continuity of the tool paths and then achieving good surface quality together with high processing efficiency [3]. The toolpath smoothing methods can be classified into local smoothing [4,5] and global smoothing [6,7] according to the smoothing scope, but in practical, local smoothing is much more stable, the approximation can be control accurately, and realtime implementable compared to global smoothing. Typically, the local curve-based methods, which inset a tiny parametric curve, to blend the adjacent linear segments, such as Bézier splines [8,9], B-spline [10,11], NURBS spline [5,12], Pythagorean-Hodograph (PH) spline [3,13], Clothoid curve [14], airthoid spline [15]. According to the shape of the inserted curve, the local smoothing can be classified into symmetrical methods and asymmetrical methods. However, when smoothing the short-segmented tool paths with local curve-based methods, the overlap between the two adjacent transition curves is inevitable. Most of the symmetrical methods are imposing excessive constraints on the transition lengths or by reducing proportionally their approximation error to the corners with curvature increasing sacrifice, thus, to overcome the potential overlaps, while the asymmetrical methods, which can adjust independently the transition lengths on both sides of a corner, to eliminate the overlaps and achieve a smoother tool path, but without analytical solution to obtain the curvature extreme makes it difficult to implement in real-time CNC machining.
Jin et al. [9] proposed a double G 2 continuous cubic Bézier curves for five-axis linear tool path to overcome the first-order discontinuity at the corners of linear segments, with the approximation error constraint, the parameterized synchronization constraint, and continuous curvature constraint into consideration; however, the transition length is limited no more than half the length of the corresponding segment, which is the so called fixed-length constrained rounding (FLCR) method. With the same FLCR method, Zhao et al. [16] developed an analytical decoupled corner smoothing method by inserting an asymmetric cubic B-spline for tool tip position. Zhang et al. [5] proposed a double cubic NURBS with 5 control points and related weights, which satisfies the curvature continuous and accuracy constraint for G01 tool path, the control points, and weights are parameterized to be symmetrical. To solve the overlap problem while improving the kinematics performance of machine tools, Zhang et al. [17] desired two quartic B-spline to smooth the tool tip and tool orientation respectively for five-axis linear segments; among them, the tool tip position is smoothed with fixed-length constraint symmetrical curve, while the tool orientation is asymmetrical curve. G 3 continuity is guaranteed along the entire tool path. To further consider the kinematics performance of machine tools, a quintic B-spline curve local corner smoothing with the fixed-length constraint was proposed in [10,18], which can ensure high-order continuity of transition curves and steady motion of machine tools. To solve the arclength problem, Huang et al. [15] the first time proposed a "airthoid" curve to smooth the corners of the G01 tool path. The clothoid spline is an arclength-parameterized spline; thus, the feedrate fluctuation is eliminated in feedrate scheduling phase; this is an advantage over other none arc-length parameterized spline, but the maximum transition length is also restricted to less than half length of the original linear segment. Yang et al. [19] extended the fix-length constraint quintic B-spline to tool path smoothing of robotic machining and achieved the improvement of robot motion smoothness and tracking accuracy. To achieve smaller curvature, different from the traditional corner rounding methods whose control points of transition curves lie in linear segments, Xu and Sun [20] proposed a circumscribed corner rounding method based on fixed-length constraint with a part of control points outside of the corner to modify the path curvature and feedrate at the corners. Indeed, simply constraining the transition length can avoid the overlaps between adjacent transition curves, but this FLCR method is excessively restrictive, even if the transition length exceeds half the linear tool path segment without overlaps, it also has to shrink to the fixed length, which sacrifices the freedoms of transition curve and restricts the feedrate at curvature extreme point of the transition curve to a lower one. For the purpose of alleviating the excessive constraint on transition length, Du et al. [21] reformulated a quadratic equation with respect to transition length to locally optimize the overlaps problem; the joint-point of two adjacent transition curve is obtained analytically; however, the overlaps may continually happen in the following corners; they also have effect on the previous transition curves, but this is neglected.
Different from FLCR method to solve the overlap problem, some attempts focus on eliminating the overlaps by proportionally reducing the approximation error to the corners, which is also known as the proportional adjustment (PA) strategy. Zhao et al. [22] proposed a curvature-continuous B-spline with five control points to blend the short linear tool path. By recursive half one subdivision to proportionally shorten the two adjacent transition length until the overlap eliminated, thus to obtain an suboptimal solution of transition length. To archive higher curvature continuity, Fan et al. [23] proposed a symmetrical G 3 continuously quartic Bézier curve with 9 control points to round the corners; the transition curve overlaps were eliminate with PA strategy but different from Zhao et al. [22]; a smaller than 1 but larger than 0 factor was used to recursively shorten the two adjacent transition length in same proportion other than half one subdivision, which can get more accurate result if the factor is near to 1, but in sacrifice of computing time. These PA methods only consider the adjacent two transition curve. However, the transition length adjusted proportionally also couples possibly with the next adjacent transition lengths when the overlap continuously appears in the tool path. It may happen that the linear segment would be left when dealing the overlap of the followed corner although it may seems fully used in dealing with the current overlap. Moreover, unbalanced ratio of curvature extreme of the adjacent curves may happen; this is a worse situation. Zhang et al. [24] proposed a method to search the suboptimal scaling factor of each corner, which relates to the transition length and smoothing geometric error of the transition curve, by recursively increase the scaling factor of each transition curve with a small increment until the specified constrains not be satisfied anymore, then frozen this factor, until all the factors respected to each corner have been frozen. This is a good solution for short linear segments; however, it is timeconsuming especially when dealing with long segments and large smoothing error allowance, and the algorithm accuracy is also affected by the increment.
Different from symmetrical methods that the transition length of both side of the corner must keep the same length, asymmetrical transition methods can adjust independently the transition length on both sides of corner. Shi et al. [25] proposed an asymmetrical quintic PH spline to smooth the G01 blocks for improving the feedrate fluctuation and machining efficiency, although the transitional lengths at the corners can be obtained analytically with the approximation error, but the potential overlap was not considered especially when dealing with the short-segmented tool path. Wan et al. [3] constructed an asymmetrical PH spline by introducing two steps to shorten the spline and connect the adjacent two splines. In step 1 by shorting the spline whose control polygon shares the longer segment to satisfy a specified equation, if the overlap still occurs after step 1, then in step 2, a proportional factor is implicated to shorten the splines with same proportion, thus eliminate the overlap; this step shorten the adjacent transition length, also can be called PA strategy. Yan et al. [11] proposed an unconstrained pre-cornering transition model to analyse the effect of tool path geometry on transition overlap, and classified the overlap into 3 types according to the transition length and the their position in the segments; then, two overlap eliminating strategies were adapted to adjust the control points; thus, the asymmetrical B-spline was constructed.
The approximation error was proved within the user-specified approximation error, but the curvature extreme point of the asymmetrical curve was not given; this is also an inherent short come of asymmetrical curve, no analytical solution to get the curvature extreme. Although the transition length on both sides of corner can adjust independently to eliminate the overlaps, but the following corners are not considered in the existing proposed methods, so the solution to distribute the shared segment length to the adjacent transition curve is not optimal.
Compared to asymmetrical curve, the curvature extreme of symmetrical curve is just in the middle of the curve; it can be analytically expressed. Another advantage is to estimate the spline length. An obvious difficulty of smoothing methods based on Bézier, B-spline, or NURBS is that there is no analytical relationship between the arc length and its parameters; an iterative numerical algorithm is needed to estimate the curve length before velocity scheduling [26]. Then, for symmetrical curve, the iterative algorithm only need run half of the curve; by doubling the result can get the estimate length of the curve; this is an significant advantage in real-time smoothing and interpretation. However, the existing FLCR method cannot fully use the segment length in overcoming potential overlaps; the PA strategy without taking the following corners in consideration while dealing overlaps may cannot fully use the linear segment length, and unbalanced curvature extreme ratio between the adjacent transition curves can happen, so there are still works to do in symmetrical curve transition, achieving optimal transition length solution in real time. The main contribution of this paper is proposed an optimal solution to eliminate the potential overlaps of adjacent the transition curves, by look ahead analysing the overlaps situation of a set of continuously corners, and backward optimizing the transition length of each corner with approximation error constraint, segment lengthen constraint, and curvature extreme ratio of the adjacent curves in consideration, thus fully use the linear segment length of each corner, avoid curvature extreme polarization at the same time, and decrease average curvature as much as possible under the specified approximation error constraint, thereby fully increasing the feedrate at the corners. This novel look ahead optimal method has no complex mathematical operation in look ahead scanning and backward optimization process and makes it easy to implement in real-time CNC system; the relationship of curvature extreme and transition length is mathematically analysed; the curvature extreme is also provided mathematically in this paper.

Symmetrical NURBS curve transition
In consideration of G 2 continuity which can guarantee the continuities of tangency and curvature so that the fluctuation in feed, acceleration and jerk can be improved greatly [5], a cubic NURBS is adapted in this paper to smooth the linear segment tool path, as illustrate in Fig. 1.

Construction of cubic NURBS curve
According to Les and Wayne [27], the cubic NURBS with five control points in this paper is given as: 3 are symmetrically located in linear segments P i−1 P i and P i P i+1 , and satisfy the following conditions: where L i,0 presents the transition length of the NURBS curve. According to [28], 1.4 ≤ L i,0 ∕d i,0 ≤ 1.7 gives satisfying result in terms of machining time minimization. In this paper, the radio was set to 1.5; then, Eqs. (3) and (4) can be rewritten as: then the five control points of the cubic NURBS can be given as: where the a i,0 and a i,1 are the unit vectors of two adjacent segments.

Approximation error of transition curve
As illustrate in Fig. 1, the proposed cubic NURBS curve will cause the geometric error with respect to the original G01 linear segments which known as smoothing error. Since the inserted curve is symmetrical about the bisector corner, the maximal approximation error and curvature extreme all appear at the middle of the NURBS curve C i (u), so the maximal approximation error can be expressed as i = |P i C i (0.5)| , calculated as Eq. (8); the derivation is given in Appendix A. And the curvature extreme k m can be analytically expressed as Eq. (9); the derivation is given in Appendix B.
Assume the maximum allowed geometric error of the CNC system is denoted as ε m , thus the approximation error must satisfy i ≤ m , then the transition length L i,0 is limited by: The cubic NURBS transition model Meanwhile, the sum of the transition length of the two adjacent curves must not exceed the length of the shared linear segment length as expressed in Eq. (11):

Transition length optimization
The maximal transition federate can be reached if the curvature extreme of every transition curve is the smallest. Once the transition curve type is defined, the curvature of the transition curve has to do with the constraint transition length and the corner angle of the adjacent linear segment. Normally, the corner angle of the adjacent linear segment will keep the same as the original NC, so the transition length L i,0 is limited by Eq. (10).
As illustrate in Fig. 2, in this literature, the optimal solution is to maximize the linear segments of each corner or minimize the remained linear segments as expressed in Eq. (12); at the same time, the adjacent corner will not be polarized; that is to say, one corner consumed too much linear length, while the other only very short length can be used should not happen. As can be seen from Eq. (9), the curvature extreme k m is inversely proportional to transition length. Unfortunately, this polarized case is inevitable in current PA strategy and asymmetrical methods. As illustrate in Fig. 3, according to Eq. (10), under the same approximation error, the smaller the corner angle of two adjacent linear segments requires the longer transition length, and generate the smaller curvature extreme, on contrary the larger corner angle cause larger curvature extreme, and in considering the real machining kinematic constraint, the larger curvature extreme, requires the smaller feed speed. So, in processing short linear segment smoothing, one need to keep balance the transition length and curvature distribution, so that the feed speed sharp dropping can be mitigate in the sharp corner. In this paper, to keep balance the transition length and curvature distribution is realized by minimizing the difference of the transition length of the adjacent two corners when eliminating the overlaps, as expressed in Eq. (12).

The working of optimization method
In the case of Fig. 3a, the approximation error constraint transition lengths satisfy Eq. (13); then, there no overlap happen in these adjacent two corners, so, in the proposed method, the optimal transition length in corner ① will keep as the approximation error constraint transition length, instead of shrink it to 0.5|P i P i+1 | like FLCR.
In the case of Fig. 3b, the approximation error constraint transition lengths satisfy Eq. (14); if just consider the approximation error constraint transition length, the overlap will happen here, but in the proposed method, after look ahead processing, the pre-estimate transition length in corner ② may not over than 0.5|P i+1 P i+2 | ; thus, the optimal transition length of corner ① may keep as the approximation error constraint transition length, if need shrinking; nevertheless, the segment P i P i+1 is fully used in this case.
In the case of Fig. 3c, the approximation error constraint transition lengths satisfy Eq. (15), here absolutely occurs overlap. After look ahead processing, here assume the pre-estimate transition length corner ② is L � i+1,0 , then the optimal transition length L ′ i,0 of corner ① is given by Eq. (16), thus mitigate curvature polarization of these two corners, since corner ② is first considered, unlike PA strategy give too much portion of segment P i P i+1 to corner ① since the corner angle of corner ① is smaller than corner ②.
To real time the algorithm, and practical in long and short linear segments, the look-ahead segment number must be limited; there are two factors to stop the scanning process: (1) the segment number reach the pre-defined maxim number. (2) the following segments have no more influence on the previous transition curve; it happens when the two adjacent curves satisfy L i left > 0.
In this optimal model, once factor (1) is satisfied; then, the last optimal transition length l opt was set to mim{0.5|P n P n+1 |, L n,1 } , then backward to determine the previous optimal transition length. Once the criteria (2) is satisfied, the last optimal transition length l opt was set to the approximation error constraint length L i,1 , then backward to determine the previous optimal transition length, thus can full use the linear segment, without linear parts remain. The transition length optimal algorithm is given in Appendix C.

Experimental features
The proposed method has been coded in VS2010 using C + + programming and implemented on a PC with i7-8550U CPU and 8 G RAM for simulation, and the method has been coded in Xilinx SDK using C programming and been implicated in ARM architecture-based CNC system, which runs in the CPU0 of ZYNQ7020 (667 MHz) with 125-μs control period, for real machining for testing and validation purpose. In our experiments, corner rounding for the typical Pentagram-shaped tool path and the coronal tool path is tested in simulation, and corner rounding of bat-shaped tool path is tested by real machining experiment. In these tests, the proposed method is compared with the classical FLCR method [5] and PA strategy [23] for rounding corners. The Pentagram-shaped profile as is shown in Fig. 4a, consists of 10 corners, 5 obtuse corners, and 5 acute corners, and all the linear segments with the same length. The machining starts from the top corner and in clockwise direction, so only 4 acute corners and 5 obtuse corners are rounded in this experiment. The coronal tool path is shown in Fig. 7a with 160 corners and typical short linear segments, starts from the bottom right of the top coronal and in counterclockwise direction, and because the NC tool point only keeps three decimal places, the coronals are not totally the same. The real machining butterfly tool path has 198 corners as show in Fig. 12a; the machining test starts from the most top point of the shape. To ensure the tested methods share the kinematically similar performances, a complete S-shaped federate scheduling method [29] is used to schedule the feedrate profile of the smoothed tool path. The parameters used in characterizing the kinematics performance of the tool paths for testing are listed in Table 1.

Comparison with the FLCR method
In this experiment, at the acute corners, the proposed and the FLCR obtain the same curvature extreme as can be seen in Fig. 5; it is because the approximation error constraint transition length in acute corners are less than half length of the linear segment, so while implementing segment length constraint processing, these two methods made no adjustment to the approximation error constraint transition length. For the FLCR method, the approximation error constraint transition length not exceed half length of the adjacent two linear segment, so no need to adjust it, for the proposed method, although the sum of the approximation error constraint transition length of the adjacent acute corner and obtuse corner exceed the shared linear segment, but because the approximation error constraint transition length not exceed half length of the linear segment, so the optimal transition length of the acute corners keeps the same as the approximation error constraint transition length. However, there are great difference between these two methods while rounding the obtuse corners, which can be seen in the magnified view of the NC segment and rounded tool orbit in Fig. 4c, and the curvature extremes of transition curves at each corner are showed in Fig. 5. For the FLCR method, the transition lengths cannot overpass half of the linear segments, even when there will be linear segment left, while the proposed method can fully use the linear segments to achieve lower curvature at the obtuse corners. By analysis, the proposed method achieved a significant curvature decrease of 17.64%. From the view of feedrate profile in Fig. 6, it is very clear that the decrease of curvature results in the increase of federate substantially. This makes the machining time decreased from 998.875 to 979.25 ms; without doubt, the proposed optimal method improved the machining efficiency further. In the aspect of algorithm complexity, one can see from the given pseudo code in Appendix C, there is no complex mathematical operation or recursively calculation compared to FLCR.

Comparison with the PA strategy
In this simulation comparison, a coronal tool path is used to compare the proposed method with the PA strategy in [23]. With the predefined approximation error tolerance as show in Table 1, the transition curve overlap happened in every coronal. Thus, the overlap eliminating process between the proposed method and PA strategy is compared in detail to demonstrate the advantage of the proposed method in this paper. The smoothed tool path by proposed method and PA strategy are pictured in Fig. 7b. Figure 7c shows the partial magnified view of tool path. To compare the control points distribution of PA strategy and the proposed method, two partial enlarged views of control points are pictured in   Fig. 10; it is very clear that the proposed methods in some corners have larger extreme than PA strategy, while in some corners smaller than PA strategy, but overall, the proposed curvature extreme is smaller than PA strategy, and the proposed methods have more gentle curvature distribution as can be seen in the magnified view in Fig. 10. And from the perspective of machining speed profile in Fig. 11, the largest and smallest speed of proposed method are higher than PA strategy; thus, the proposed method has higher efficiency than PA strategy. By comparison, the control points distribution of the proposed method and PA method, which are pictured in Figs. 8 and 9 respectively; it can be seen that by proposed method, there are only in segment P 11 P 12 and P 15 P 16 remained linear portion after smoothing, but by PA strategy, the linear portion appeared not only in P 11 P 12 and P 15 P 16 , but also in P 8 P 9 and P 9 P 10 . Since the machining direction is counterclockwise, by PA strategy, the sum of approximation error constraint length of corner P 8 and P 9 is exceed the length of segment P 8 P 9 , so PA strategy will shrink the transition length of corner P 8 and P 9 proportionally to eliminate the potential overlap; when smoothing corner P 9 , there is overlap in segment P 9 P 10 , so the transition length of corner P 9 and P 10 adjusted proportionally to eliminate the overlap, and corner P 9   portion from segment P 9 P 10 which is shorter than the linear segment left in segment P 8 P 9 after smoothing corner P 8 , thus found there linear part remained in segment P 8 P 9 . In our proposed method, with the pre-read processing, the transition length of corner P 9 was pre-constrained by the following corners P 10 , P 11 , etc., and while analysing the potential overlap of corner P 8 and P 9 , the pre-constrained transition length of corner P 9 is obviously less than half of the segment P 8 P 9 , because |P 9 P 10 | < |P 8 P 9 | , so here the pre-constrained transition length of corner P 9 is kept, the transition length of corner P 8 is adjusted to eliminate the overlap, and after the smoothing of corner P 8 , the remained linear part of segment P 8 P 9 will be fully used in corner P 9 smoothing; thus, no linear portion left in segment P 8 P 9 , and the proposed method get smaller curvature extreme in corner P 8 compared to PA strategy. Segment P 9 P 10 also has linear portion left by PA strategy; it is the same situation as smoothing corner P 8 and P 9 , and linear portion left in segment P 8 P 9 . In corner P 10 , our method gets smaller curvature, but in corner P 11 gets lager curvature compared to PA strategy; it is because the approximation error constraint transition lengths in corner P 10 and P 11 exceed 0.5|P 10 P 11 | , and |P 10 P 11 | < |P 9 P 10 | , and |P 10 P 11 | < |P 11 P 12 | , so corner P 11 get 0.5|P 10 P 11 | as transition length, so also the corner P 10 , but by PA strategy, while eliminating the overlap in segment |P 10 P 11 | , corner P 11 get a portion more than half of the segment P 10 P 11 ; let it be noted as L 11,0 > 0.5|P 10 P 11 | , and corner P 11 and P 12 have the same corner angle of the two adjacent linear segments, so by PA strategy, corner P 11 can get half of the segment P 11 P 12 ; let it be noted as L 11,1 = 0.5|P 11 P 12 | , but L 11,0 < L 11,1 , so the segment length constraint transition length of P 11 is L 11,0 ; thus, PA strategy get smaller curvature in corner P 11 and P 12 , but larger curvature in P 10 compared to our method. In segment P 11 P 12 , there is linear portion left because |P 10 P 11 | < |P 11 P 12 | , and the remained linear segment length of P 10 P 11 after smoothing corner P 10 is less than 0.5|P 11 P 12 | , and when smoothing corner P 12 the transition length also limited by the segment length of P 12 P 13 , corner P 12 get less than half of segment P 11 P 12 as transition length, thus has linear portion left in segment P 11 P 12 . In segment P 15 P 16 also has linear portion left after smoothing, it is the same situation as segment P 11 P 12 . By analysing magnified curvature extreme distribution in Fig. 10 and speed profile in Fig. 11, the bottom speed happens in P 10 and P 13 ; the top speed appears in segment P 15 P 16 (also can be said before P 8 ); it is clear our method has higher speed in these point, because our method get smaller curvature extreme in these corners. In corners P 11 and P 12 , and P 14 although PA strategy has smaller curvature extreme, but the linear segments in these related segments are very short, there are not enough distance to reach the curvature extreme allowed maxim speed under certain speed acceleration, that is why the whole machining time is longer than our method. By analysing the curvature extreme distribution of the corners P 8 to P 14 , it is very clear the proposed method is smoother compared to PA strategy. Thus, proposed optimal method not only fully uses the linear segments but also keeps the curvature extreme distribution balanced and makes the machining time decrease from 2.477 to 2.367 s; thus, the machining efficiency is improved 4.44% compared to PA strategy.

Real machining experiment
In this real machining test, a butterfly tool path is performed on a CNC machine to demonstrate the advantage of our method in short linear segment smoothing and the real-time performance, compared with the PA strategy, but different from the recursive function in [22,23], the proportional shrink factor is obtained mathematically in Appendix D. Thus, the PA strategy can be implicated in the real-time machining test. With the specified approximation error ε 0 = 10 μm, the transition overlaps occurred in some places where the tool points are dense. In this test, all the transition overlaps are eliminated by the proposed optimal mothed and PA strategy and the smoothed tool orbits are shown in Fig. 12a. The machining results are shown in Fig. 12b. From the magnified view of the smoothed tool orbits in Fig. 12c, it is very clear that in the sharp corner, the proposed method has smaller curvature than PA strategy, while in the adjacent corner which before the sharp one, PA strategy get smaller curvature; this is because here the transition overlap happened and the proposed method balanced the distribution of the length of the linear segments.
As shown in Fig. 13, the machining velocity profile of both PA strategy and the proposed method are pictured respectively. From the magnified view of the velocity profile of the red circle circled portion in Fig. 13a, there is fluctuation in the place where the interpolation velocity should be kept in 6000 mm/min; it is because the pulse rounding accuracy, so, 1 pulse fluctuation in the moving axis is inevitable, and in this test, 1 mm distance equals 100,000 interpolation pulses, so the maxim rounding fluctuation could be √ 2 pulse for two axis-linkage; thus, the fluctuation could be 6.78823 mm/min in one sample period, as calculated in Eq. (17). And the feedback velocity profile is always delayed to the interpolation velocity, and has fluctuation, and the amplitude is larger than the interpolation velocity profile; it is normal and also has to do with the parameter of the servo and the performance of servo system, here will not discuss about it, for it is out of the scope of the paper. From the magnified view of velocity profile in Fig. 13b, in the none-overlap corner, the PA strategy and the proposed method have the same velocity level, that means the curvature is the same, while in the overlap segments, the proposed method can obtain balanced transition length; thus, the curvature extreme will not be polarized, that means the proposed method has higher curvature extreme level in the curvature bottom, but lower curvature extreme level in the curvature top compared to PA strategy. Thus, the proposed method obtained higher machining efficiency than PA strategy, which decreased machining time from 4.9785 to 4.8985 s.

Conclusion
In this paper, a local corner rounding algorithm with look ahead optimal strategy for short and long G01 linear segments is presented. The control points of cubic NURBS transition curve are parameterized to make the curve symmetrical about the included angle bisector, and G 2 continuity of the smoothed tool path is guaranteed along the entire tool path and within specified geometric error. Based on the characteristic of symmetrical curve, the relationship of curvature extreme, transition length, approximation error, Start point Feed direction Fig. 12 Smoothing of butterfly tool path. a Butterfly linear segments and smoothed tool paths by proposed method and PA strategy; b the machining results; c magnified view of smoothed tool path and the corner angle of the two adjacent linear segments are analysed; the curvature extreme is mathematically presented, which can be used in machining velocity planning to obtain the kinematic constraint speed. The novel transition length look ahead optimal algorithm in this paper not only eliminates the transition overlap but also can fully use the linear segment and avoid polarization or unbalanced ratio of curvature extreme of the adjacent curves while eliminating the overlap, thus decreasing the curvature extreme as much as possible, at the same time get more smoothed curvature extreme distribution especially in short linear segments NC machining. In comparison with traditional FLCR, our proposed method achieved a significant curvature decrease of 17.64%. In comparison with PA strategy, the proposed method obtained balanced curvature distribution and an efficiency improvement of 4.44%. The proposed look ahead optimal method also can be used in asymmetrical curve smoothing to mitigate the polarization or unbalanced ratio of curvature extreme in adjacent transition curves. In addition, our method can work well in 125 μs control period real-time CNC system which was verified in real CNC machining experiment.  At first according to Eq. (2), the basis function N i,p (u) can be calculated as following: