1 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 real-time 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 time-consuming 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.

2 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.

Fig. 1
figure 1

The cubic NURBS transition model

2.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:

$${C}_{i}(u)=\frac{{\sum }_{j=0}^{4}{N}_{j,3}(u){w}_{i,j}{Q}_{i,j}}{{\sum }_{j=0}^{4}{N}_{j,3}(u){w}_{i,j}}$$
(1)
$$\left\{\begin{array}{l}N_{j,3}\left(3\right)=\frac{u-u_j}{u_{j+3}-u_j}N_{j,2}+\frac{u_{j+4}-u}{u_{j+4}-u_{j+1}}N_{j,2}\\N_{j,0}\left(u\right)=\left\{\begin{array}{lc}1,&\mathrm{if}\;u_j\leqslant u\leqslant u_{j+1}\\0,&\mathrm{otherwise}\end{array}\right.\\ \mathrm{define}\;\frac00=0\end{array}\right.$$
(2)

where \(j=\mathrm{0,1},\mathrm{2,3},4\); \({Q}_{i,j}\) are the control points; \({w}_{i,j}\) are the weights, particularly, \({w}_{i,0}={w}_{i,4}\), \({w}_{i,1}={w}_{i,3}\); and the node vector is \(U=\{\mathrm{0,0},\mathrm{0,0},\mathrm{0.5,1},\mathrm{1,1},1\}\). Meanwhile, the control point \({Q}_{i,2}\) is located on tool point Pi; \({Q}_{i,0}\), \({Q}_{i,1}\) and \({Q}_{i,4}\), \({Q}_{i,3}\) are symmetrically located in linear segments \({P}_{i-1}{P}_{i}\) and \({P}_{i}{P}_{i+1}\), and satisfy the following conditions:

$${L}_{i,0}=|{Q}_{i,0}{P}_{i}|=|{P}_{i}{Q}_{i,4}|$$
(3)
$${d}_{i,0}=|{Q}_{i,1}{P}_{i}|=|{P}_{i}{Q}_{i,3}|$$
(4)

where \({L}_{i,0}\) presents the transition length of the NURBS curve. According to [28], \(1.4\le {L}_{i,0}/{d}_{i,0}\le 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:

$${L}_{i,0}=1.5{d}_{i,0}=1.5|{Q}_{i,1}{P}_{i}|=1.5|{P}_{i}{Q}_{i,3}|$$
(5)
$$|{Q}_{i,1}{P}_{i}|=|{P}_{i}{Q}_{i,3}|={d}_{i,0}=\frac{2}{3}{L}_{i,0}$$
(6)

then the five control points of the cubic NURBS can be given as:

$$\left\{\begin{array}{l}Q_{i,0}=P_i-L_{i,0}a_{i,0}\\Q_{i,1}=P_i-\frac23L_{i,0}a_{i,0}\\Q_{i,2}=P_i\\Q_{i,3}=P_i+\frac23L_{i,0}a_{i,1}\\Q_{i,4}=P_i+L_{i,0}a_{i,1}\end{array}\right.$$
(7)

where the \({{\varvec{a}}}_{i,0}\) and \({{\varvec{a}}}_{i,1}\) are the unit vectors of two adjacent segments.

2.2 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 Ci(u), so the maximal approximation error can be expressed as \(\varepsilon_{i} =|{P}_{i}{C}_{i}(0.5)|\), calculated as Eq. (8); the derivation is given in Appendix A. And the curvature extreme km can be analytically expressed as Eq. (9); the derivation is given in Appendix B.

$$\varepsilon_{i} =\frac{2{w}_{i,1}{L}_{i,0}\mathrm{sin}(\frac{{\beta }_{i}}{2})}{3({w}_{i,1}+{w}_{i,2})}$$
(8)
$${k}_{m}=\frac{{w}_{i,2}\mathrm{sin}({\beta }_{i})}{{w}_{i,1}{L}_{i,1}{\mathrm{cos}}^{3}(\frac{{\beta }_{i}}{2})}$$
(9)

Assume the maximum allowed geometric error of the CNC system is denoted as εm, thus the approximation error must satisfy \(\varepsilon_{i} \le {\varepsilon }_{m}\), then the transition length Li,0 is limited by:

$${L}_{i,0}\le \frac{3({w}_{i,1}+{w}_{i,2}){\varepsilon }_{m}}{2{w}_{i,1}\mathrm{sin}(\frac{{\beta }_{i}}{2})}$$
(10)

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):

$$\left\{\begin{array}{c}{L}_{i-\mathrm{1,1}}+{L}_{i,0}\le |{P}_{i-1}{P}_{i}|\\ {L}_{i,1}+{L}_{i+\mathrm{1,0}}\le |{P}_{i}{P}_{i+1}|\end{array}\right.$$
(11)

3 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).

$$\left\{\begin{array}{l}\mathrm{min}{\sum }_{i=1}^{n}{L}_{left}^{i}\\ \mathrm{min}{\sum }_{i=1}^{n}({L}_{i+\mathrm{1,0}}-{L}_{i,1})\end{array}\right.$$
(12)

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.

Fig. 2
figure 2

Length constrained corner smoothing

As can be seen from Eq. (9), the curvature extreme km 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).

Fig. 3
figure 3

Transition length optimization. (a) transition curve without overlap; (b) transition curve maybe have overlap; (c) transition curve absolutely have overlap

3.1 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.

$$\left\{\begin{array}{c}{L}_{i,0}+{L}_{i+\mathrm{1,0}}<|{P}_{i}{P}_{i+1}|\\ {L}_{i,0}>0.5|{P}_{i}{P}_{i+1}|\end{array}\right.$$
(13)

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.

$$\left\{\begin{array}{l}{L}_{i,0}+{L}_{i+\mathrm{1,0}}>|{P}_{i}{P}_{i+1}|\\ {L}_{i,0}>0.5|{P}_{i}{P}_{i+1}|\\ 0.5|{P}_{i}{P}_{i+1}|>|{P}_{i+1}{P}_{i+2}|\end{array}\right.$$
(14)

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+\mathrm{1,0}}^{^{\prime}}\), then the optimal transition length \({L}_{i,0}^{^{\prime}}\) 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 PiPi+1 to corner ① since the corner angle of corner ① is smaller than corner ②.

$$\left\{\begin{array}{l}{L}_{i,0}+{L}_{i+\mathrm{1,0}}>|{P}_{i}{P}_{i+1}|\\ {L}_{i,0}>0.5|{P}_{i}{P}_{i+1}|\\ 0.5|{P}_{i}{P}_{i+1}|<|{P}_{i+1}{P}_{i+2}|\\ {L}_{i,+\mathrm{1,0}}>0.5|{P}_{i+1}{P}_{i+2}|\end{array}\right.$$
(15)
$$\left\{\begin{array}{lc}L'_{i,0}=\left|P_iP_{i+1}\right|-L'_{i+1,0},&L'_{i+1,0}<0.5\left|P_iP_{i+1}\right|\\ L'_{i,0}=0.5\left|P_iP_{i+1}\right|,&others\end{array}\right.$$
(16)

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. (1)

    the segment number reach the pre-defined maxim number.

  2. (2)

    the following segments have no more influence on the previous transition curve; it happens when the two adjacent curves satisfy \(L_{left}^i>0\).

In this optimal model, once factor (1) is satisfied; then, the last optimal transition length \(l_{\mathrm{opt}}\) was set to \({\text{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_{\mathrm{opt}}\) was set to the approximation error constraint length Li,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.

4 Experimental works and result

4.1 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.

Fig. 4
figure 4

Smoothing the Pentagram-shaped tool path. a Pentagram-shaped linear segments for testing. b NC segments and smoothed tool paths by proposed method and FLCR method. c Magnified view of smoothed tool path

Table 1 Parameters used in path smoothing and characterizing the kinematics performance

4.2 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.

Fig. 5
figure 5

Curvature extreme of transition curves of the proposed method and FLCR method in Pentagram-shaped tool path smoothing

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.

Fig. 6
figure 6

Feedrate profiles of proposed method and FLCR method in Pentagram-shaped tool path smoothing

4.3 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 Figs. 8 and 9. The smoothed curvature extreme of each corner is 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.

Fig. 7
figure 7

Smoothing of coronal tool path. a coronal linear segments; b NC segments and smoothed tool paths by proposed method and PA strategy; c magnified view of smoothed tool path

Fig. 8
figure 8

Partial magnified view of control points distribution of PA strategy in coronal tool path smoothing

Fig. 9
figure 9

Partial magnified view of control points distribution of proposed method in coronal tool path smoothing

Fig. 10
figure 10

Curvature extreme of transition curves of the proposed method and PA strategy in coronal tool path smoothing

Fig. 11
figure 11

Feedrate profiles of proposed method and PA strategy in coronal tool path smoothing

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 P11P12 and P15P16 remained linear portion after smoothing, but by PA strategy, the linear portion appeared not only in P11P12 and P15P16, but also in P8P9 and P9P10. Since the machining direction is counterclockwise, by PA strategy, the sum of approximation error constraint length of corner P8 and P9 is exceed the length of segment P8P9, so PA strategy will shrink the transition length of corner P8 and P9 proportionally to eliminate the potential overlap; when smoothing corner P9, there is overlap in segment P9P10, so the transition length of corner P9 and P10 adjusted proportionally to eliminate the overlap, and corner P9 get a portion from segment P9P10 which is shorter than the linear segment left in segment P8P9 after smoothing corner P8, thus found there linear part remained in segment P8P9. In our proposed method, with the pre-read processing, the transition length of corner P9 was pre-constrained by the following corners P10, P11, etc., and while analysing the potential overlap of corner P8 and P9, the pre-constrained transition length of corner P9 is obviously less than half of the segment P8P9, because \(|{\text{P}}_{9}{\text{P}}_{10}|<|{\text{P}}_{8}{\text{P}}_{9}|\), so here the pre-constrained transition length of corner P9 is kept, the transition length of corner P8 is adjusted to eliminate the overlap, and after the smoothing of corner \({\mathrm{P}}_{8}\), the remained linear part of segment P8P9 will be fully used in corner P9 smoothing; thus, no linear portion left in segment P8P9, and the proposed method get smaller curvature extreme in corner P8 compared to PA strategy. Segment P9P10 also has linear portion left by PA strategy; it is the same situation as smoothing corner P8 and P9, and linear portion left in segment P8P9. In corner P10, our method gets smaller curvature, but in corner P11 gets lager curvature compared to PA strategy; it is because the approximation error constraint transition lengths in corner P10 and P11 exceed \(0.5|{\text{P}}_{10}{\text{P}}_{11}|\), and \(|{\text{P}}_{10}{\text{P}}_{11}|<|{\text{P}}_{9}{\text{P}}_{10}|\), and \(|{\text{P}}_{10}{\text{P}}_{11}|<|{\text{P}}_{11}{\text{P}}_{12}|\), so corner P11 get \(0.5|{\text{P}}_{10}{\text{P}}_{11}|\) as transition length, so also the corner P10, but by PA strategy, while eliminating the overlap in segment \(|{\text{P}}_{10}{\text{P}}_{11}|\), corner P11 get a portion more than half of the segment P10P11; let it be noted as \({L}_{\mathrm{11,0}}>0.5|{\text{P}}_{10}{\text{P}}_{11}|\), and corner P11 and P12 have the same corner angle of the two adjacent linear segments, so by PA strategy, corner P11 can get half of the segment P11P12; let it be noted as \({L}_{\mathrm{11,1}}=0.5|{\text{P}}_{11}{\text{P}}_{12}|\), but \({L}_{\mathrm{11,0}}<{L}_{\mathrm{11,1}}\), so the segment length constraint transition length of P11 is L11,0; thus, PA strategy get smaller curvature in corner P11 and P12, but larger curvature in P10 compared to our method. In segment P11P12, there is linear portion left because \(|{\text{P}}_{10}{\text{P}}_{11}|<|{\text{P}}_{11}{\text{P}}_{12}|\), and the remained linear segment length of P10P11 after smoothing corner P10 is less than \(0.5|{\text{P}}_{11}{\text{P}}_{12}|\), and when smoothing corner P12 the transition length also limited by the segment length of P12P13, corner P12 get less than half of segment P11P12 as transition length, thus has linear portion left in segment P11P12. In segment P15P16 also has linear portion left after smoothing, it is the same situation as segment P11P12.

By analysing magnified curvature extreme distribution in Fig. 10 and speed profile in Fig. 11, the bottom speed happens in P10 and P13; the top speed appears in segment P15P16 (also can be said before P8); it is clear our method has higher speed in these point, because our method get smaller curvature extreme in these corners. In corners P11 and P12, and P14 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 P8 to P14, 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.

4.4 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.

Fig. 12
figure 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

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 \(\sqrt{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.

Fig. 13
figure 13

Velocity profile in butterfly tool path smoothing. a Interpolation and feedback velocity profile. b Magnified view of velocity profile

$$60\times (\sqrt{2}/100000)\times 8000=6.78823$$
(17)

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.

5 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 G2 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, 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.