Asymmetrical pythagorean-hodograph spline-based C4 continuous local corner smoothing method with jerk continuous feedrate scheduling along linear toolpath

In computer numerical control systems, linear segments, which are generated by computer-aided manufacturing software, are the most widely used toolpath format. Since the linear toolpath is discontinuous at the junction of two adjacent segments, the fluctuations on velocity, acceleration and jerk are inevitable. Local corner smoothing is widely used to address this problem. However, most existing methods use symmetrical splines to smooth the corners. When any one of the linear segments at the corner is short, to avoid overlap, the inserted spline will be micro, thereby increasing the curvature extreme of the spline and reducing the feedrate along it. In this article, the corners are smoothed by a spline. The curvature extreme of the proposed spline is investigated first, and 𝐾 = 2.5 is determined as the threshold to constarin the asymmetry of the spline. Then a two-step strategy is used to generate a blended toolpath composed of asymmetric PH splines and linear segments. In the first step, the PH splines at the corners are generated under the premise that the transition lengths do not exceed half of the length of the linear segments. In the second step, the splines at the corners are re-planned to reduce the curvature extremes, if the transition error does not reach the given threshold and there are extra linear trajectories on both sides of the spline trajectory. Finally, the bilinear interpolation method is applied to determine the critical points of the smoothed toolpath, and a jerk-continuous feedrate scheduling scheme is presented to interpolate the smoothed toolpath. Simulations show that, under the condition of not affecting the machining quality, the proposed method can improve the machining efficiency by 7.84% to 23.98% compared to 𝐺 3 and 𝐺 4 methods.


Introduction
To machine 3D products with freeform surfaces, they are designed in computeraided design (CAD) software first, then the cutter location (CL) paths are generated by the computer-aided manufacturing (CAM) software. Since the linear interpolation (G01) is supported by all multi-axis computer numerical control (CNC) machining, the CL paths are usually divided into a large number of linear trajectories as the toolpath to guide the movement of machine axes [1]. However, linear trajectories can not be used in machining processes directly. Since the derivatives are not the same at the junction of two adjacent linear segments, the feedrate changes abruptly when the tool moves across the junction, which will lead to violent vibrations of machine tool and destroy the surface finish [2]. If the tool completely stops at the corners to change the feed direction, frequent acceleration and deceleration processes are inevitable, which will increase machining time significantly [2]. Therefore, to improve machining efficiency and quality, the toolpath should be processed to get higher order continuity [4]. The approaches can be divided into global smoothing [6][7][8][9][10][11] and local smoothing [4][5] methods.
The global smoothing methods usually utilize one or several smooth spline curves, such as B-splines, polynomial splines and NURBS curves to approximate the discrete G01 points. The high order continuity of the proposed curves makes they can guarantee smoothness along the entire toolpath [5]. However, they have shortages such as numerical instability, lack of chord error constraint, and lack of assurance result [6].
The local smoothing methods usually replace the shape corners with one or a pair of micro-curves [12], such as circle and spline trajectory. Since the circle trajectory brings about the greater machining error [13], the spline trajectory, such as B-spline and Bezier spline are more concerned by researchers.
B-spline and Bezier spline are the most widely used transition curves to achieve Second-order geometric ( 2 ) continuity or second-order parametric ( 2 ) continuity.
Zhao et al. [14] adopted a cubic B-spline with five control points to smooth the adjacent linear segments, which made the overall smoothed path is 2 continuous. Sencer et al. [15] employed a quintic Bezier curve to blend the adjacent straight lines and the curvature extreme was minimized for higher machining efficiency. In [16], a two-step strategy was proposed to generate 2 continuous toolpath, where the curvature energy of the cubic Bezier curve was minimized first, then the optimal transition length was determined by minimizing the sum of two curvature extremes. Jin et al. [17] proposed a transition method for five-axies machining in workpiece coordinate system (WCS), which utilized a dual-Bezier splines as transition curves. Bi et al. [18] developed a 2 continuous transition method with a cubic Bezier curve, the approximation error at the segment junction can be accurately guaranteed and the curvature extreme was analytically computed and optimized. These method [14][15][16][17][18] above can only guarantee that the toolpath is 2 or 2 continuous, however, higher continuity is desired to obtain smooth feedrate profile. Tulsyan et al. [19] inserted a quintic B-spline with seven control points for tool tip at the adjacent linear segments, and a heptic B-spline with nine unit control vectors for the tool-orientation. The optimal control points and vectors are calculated to generate 3 continuous toolpath. Zhang et al. [20] applied a quintic B-spline with nine control points to blend the corners and achieved 3 continuity, and the control points were determined by regarding the corner feedrate as the optimal objective. In [21], two symmetric quartic Bezier curves were proposed to generate 3 interpolative toolpath, and a jerk-continuous feedrate scheduling was given. Zhang et al. [22] proposed a symmetric quartic B-spline curve to smooth the tool tip position in WCS, and an asymmetric quartic B-spline curve to smooth the tool orientation in machine coordinate system (MCS), which constrained both errors of tool tip position and tool orientation in WCS. In addition, Xie et al. [23] employed a single quintic Bspline with seven control points to achieve 3 continuity and applied it to five degrees of freedom (5-DoF) machining robot. In [4], by adopting a quintic B-spline with nine control points, the toolpath was improved to 4 continuous and a corresponding jerksmooth feedrate scheduling scheme was presented.
Although B-spline and Bezier spline can smooth the toolpath, their arc lengths have no analytical solutions with spline parameters, which make it difficult to calculate the next parameter in the fine interpolation. To overcome this problem, the clothoid spline based methods [24][25][26][27][28][29] and Pythagorean-hodograph (PH) spline based methods [5,[30][31][32][33][34][35][36] have been developed. Shahzadeh et al. [26] usesd biclothoid fillets as transition curves to smooth the corners and ensure the 2 continuity of the toolpath. The main advantage of this fillet fitting method was that it was not limited to line to line transitions, it can smooth two arcs or a line and arc as well. In [27], the traditional clothoid was extended from 2-dimension to 3-dimension, which can achieve a higher degree of continuity, i.e. 3 continuity. Huang et al. [28] proposed a novel curve ''airthoid'' based on clothoid spline, then the biairthoid was involved to smooth the corners of the tool position in the WCS and the corners of the tool orientation in the MCS. In [29], a novel smoothing method based on a pair of clothoid splines was proposed to realize the integral planning of the geometrical curve and the feedrate profile, which can achieve the adaptive contour accuracy. Since the clothoid is defined with respect to the Fresnel integral, which can not be calculated analytically, these methods can only be carried out off-line. Jahanpour et al. [31] used real-time PH curve CNC interpolators for high speed corner machining. In [32], the sharp corners on the toolpath were interpolated with PH interpolation, which minimized the geometric and interpolator approximation errors simultaneously. Farouki et al. [33] replaced the sharp corner by a quintic PH curve which met the incoming/outgoing path segments with 2 continuity, and the deviation and extremum curvature can be controlled precisely. Shi et al. [36] proposed a smoothing method by using a pair of quintic PH curves to round the corners of linear five-axis tool path. Hu et al. [5] applied a quintic PH spline with twelve control points to achieve 3 continuity. However, they were limited to the second-order or third-ordor continuity. When the fourth-order continuity is reached, the first and second curvature derivatives are both continuous along the combined toolpath, the jerk and jounce are both continuous if a smooth jerk profile is proposed in feedrate scheduling, which can reduce vibration and tracking error [37][38].
In this paper, an asymmetric PH spline with sixteen control points is developed and inserted among linear toolpath segments. The control points are optimized to decrease the curvature extreme of the proposed PH spline and achieve 4 continuity of the combined toolpath. A corresponding jerk-continuous feedrate scheduling scheme is also presented to interpolate the toolpath. The remainder of this paper is organized as follows. In section 2, the basic concepts of the proposed PH spline are introduced, and the curvature extreme is investigated. Section 3 provides a PH spline curve transition method to generate 4 smooth path. In section 4, a jerk-continuous feedrate scheduling scheme is given. Section 5 presents the simulations, and the results are compared with two conventional works. Finally, Section 6 gives the conclusions and future works.
where ( ) is a polynomial and also the parametric speed of ( ). To get a PH curve, The cumulative arc length function ( ) of ( ) can be obtained by integrating ( ), and its Bernstein basis functions gives As can be seen from Eq. (3), ( ) is a polynomial in , which makes PH spline of great application value in interpolation.

Design of the PH transition curve
In this research, a 4 continuous PH spline is inserted to smoothly transition two successive linear segments. It has been proved that only when ≥ 7 can a 4 continuous PH spline be designed [34]. For simplicity, Let . The designed 4 continuous PH spline is written as: where ( = 0,1,2, … ,15) are control points, which will be determined later. As shown in Fig. 1, the corner is formed by two linear segments, i.e. 0 1 and 1 2 , their unit directions are 1 = 0 1 ⃗⃗⃗⃗⃗⃗⃗⃗ /| 0 1 ⃗⃗⃗⃗⃗⃗⃗⃗ | and 2 = 1 2 ⃗⃗⃗⃗⃗⃗⃗⃗ /| 1 2 ⃗⃗⃗⃗⃗⃗⃗⃗ | . is the angle between these two unit directions, which can be calculated by: { 0 , 1 , … , 15 } are the sixteen control points of the proposed PH curve. From Ref.

The curvature extreme of the proposed PH spline
In feedrate scheduling, the feedrate is constrained by the curvature of the tool path, and the tool path is divided into several blocks according to critical points, where the points with local curvature extreme are usually regarded as critical points [39]. As can be seen from Fig. 2, even for different corner angles, the curvature extreme of the proposed PH spline has the same change trend: as the feature length 2 is increased, the curvature extreme is first reduced and then increased. For a given corner angle , the feature length 2 is limited by the length of the linear trajectory in the corner smoothing process. In most cases, 2 cannot equal to the value(the abscissa of the red points in Fig.2) that makes the curvature extreme of the proposed PH spline minimal. As an alternative, an optimal value for 2 is determined by the following steps: Step 1: Initialize 2 = 1 , Calculate the curvature extreme 1 .
Step 3: Calculate the curvature extreme 2 , where is a small scalar and = 0.08% is chosen in the searching algorithm, then 1 = 2 , go to Step 2; otherwise, go to Step 4.
Step 4: the optimal value equals to 2 − ∆ , terminate the algorithm.
Step 5: the optimal value equals to 2 , terminate the algorithm.
Follow the above algorithm, the optimal value for 2 and corresponding curvature extreme for three different corner angles are obtained and shown as the blue points in Fig. 2. Similarly, the curvature extreme of the proposed PH spline with different feature length 2 and corner angle are calculated and shown in Fig. 3. The blue curve represents the optimal value for 2 and its corresponding curvature extreme at different angles. The red curve represents the value for 2 that makes the curvature extreme of the proposed PH spline minimal and its corresponding curvature extreme at different angles. It can be observed that at different angles, the optimal value for 2 is between From Eq. (10) Combining Eqs. (14) and (15) can be obtained and Theorem 3 is proved. Proof: If 1 = 2 , ( ) is the same as ( ) and = . Without loss of generality, translate, rotate, and if necessary, reflect transition PH spline such that 1 is at the origin, 0 is on the negative x-axis, 2 is above the x-axis, and 1 > 2 . Replace 1 and 2 in Eq. (10) with 0 = max( 1 , 2 ) = 1 to get the control points of ( ), which is denoted by ̅ ( = 0,1,2, … , 15). Subtract from ̅ , we arrive at where ≤ 0 and ≥ 0 , the specific derivation process of which is provided in

Length constraint
In Fig. 6, are 01 points, 1, and 2, are two transition lengths at point , which can be obtained by: where 1, and 2, are two feature lengths of the transition PH spline at point , and is the corner angle. Let be the length of linear segment +1 and denote the maximum index of 01 points (i.e. the 01 points are presented by { 0 , 1 , … , }). To preserve the shape of the toolpath, the sum of two adjacent transition lengths should be less than the linear segments, that is, satisfies the following inequalities: From section 2.3, to make full use of the linear lengths, the following equation also needs to be satisfied: The goal is to construct a transition spline that satisfies the above constraints and has the smallest curvature extreme. Since the expression of the curvature extreme of the transition spline is too complicated, it is not practical to construct such a transition spline. Considering that the curvature extreme is almost inversely proportional to the feature lengths, instead, the goal here is simplified to make the feature length as big as possible, which means the first four inequalities in Eq. (23) can take as many equal signs as possible. An algorithm proposed to achieve such a goal is shown below: Step 1: Let the first two inequalities in Eq. (23) take equal sign, solve this twodimensional quadratic equations to get 1 and 2 .
The pseudocode of this algorithm is also shown as follows: Our method consists of two steps, where STEP I guarantees that the length constraint will not be violated, and STEP II makes full use of the length of the linear trajectory to make the curvature extreme of the transition curve as small as possible.
The flow chart of the proposed method is illustrated in Fig. 7. Fig. 7. The flow chart of the proposed method.

A simple case
To demonstrate the advantages of our corner smoothing method, our method and other two B-spline based methods in [4] (denoted by 4 method) and [22] (denoted by 3 method) are applied to the same 01 toolpath, which is shown as Fig. 8. To show the geometric properties of the three smooth paths generated by these methods, the curves with the arc length as the abscissa value and the curvature value as the ordinate value corresponding to it are shown in Fig. 9. It can be seen that our method has the smallest arc length and curvature extreme, which leads to shorter machining time in most cases. To further verify whether our method can reduce the machining time, a feedrate scheduling scheme is introduced in section 4, and the simulation is shown in section 5. Fig. 8. A polygonal shape 01 toolpath and its three smooth paths. Fig. 9. Curvature as a function of arc length for these three smoothing algorithms.

Feedrate planning of smooth path
In this section, the critical points of the smooth path and their maximum allowable feedrate are determined first, then the division of the smooth path is presented, and the jerk-continuous feedrate scheduling scheme in Ref. [40] is adopted finally.

Determination of critical points and their feedrate
When planning the federate along a PH spline, the chord error, centripetal acceleration and jerk limitations should be taken into account. From Ref. [39], the maximum allowable federate can be calculated by: where is the command federate, is the interpolation period, is the curvature, is the chord error limitation, and are the acceleration and jerk limitations respectively. From Eq. (24), the local minimum federate occurs at the local curvature extreme points of the smooth path, which are also the curvature extreme points of all inserted PH splines. However, the parameter of the curvature extreme point of the inserted PH spline can't be given analytically because the PH spline is asymmetric.
Instead, the bilinear interpolation method is applied to estimate the parameter of the curvature extreme point.
Step 6: Calculate the curvature of the inserted PH spline at parameter and ( = 0,1,2, … , ), and denote they as and . Let = max ( , ) and equals to the parameter whose curvature is .
The critical point of this PH spline can be obtained by substituting into the parametric equation ( ), and the maximum allowable federate can be calculated by Eq. (24).

2 The division of the smooth path
For the toolpath presented by { 0 , 1 , … , }, denote the inserted PH spline at point as ( ) ( = 1,2, … , − 1). The parameter of the curvature extreme point of ( ) and its maximum allowable federate can be obtained by the bilinear interpolation method in section 4.1, which are denoted as and respectively. Then the smooth path is split into blocks based on the critical points ( ).
The first block contains the remainder of the first linear segment and part of 1 ( ).
The start point and end point of this block are 0 and 1 ( 1 ), the start velocity and end velocity of this block are 0 and 1 , and the length of this block can be calculated as follows: where is the length of the remainder of the ℎ linear segment, (t) is the cumulative arc length function of ( ).
The last block contains part of −1 ( ) and the remainder of the last linear segment. The start point and end point of this block are −1 ( −1 ) and , the start velocity and end velocity of this block are −1 and 0, and the length of this block can be calculated as follows: where is the length of the remainder of the ℎ linear segment, (t) is the cumulative arc length function of ( ).
It is worth noting that the remainder of linear segment may degenerate into a point when it is completely replaced by two adjacent inserted PH splines. At this time, in Eqs. (25)(26)(27) equals to 0, which will not have an essential effect on the division of the smooth path.

The jerk-continuous feedrate scheduling scheme
Since the start and end velocity of blocks are obtained only considering the chord error limitation, the acceleration limitation and the jerk limitation, when the length is too short, the feedrate may not be able to smoothly transition from the start velocity to the end velocity. To guarantee the continuity of the feedrate at the junctions between successive blocks, the bidirectional scanning module in [40] is applied to adjust the start velocity and the end velocity if necessary. Then the velocity scheduling module in [40] is used to plan the feedrate along every block. Combining the feedrate along every block together, a jerk-continuous feedrate profile along the 4 smooth path is obtained.

Simulation
In this section, the proposed corner smoothing method is validated by three different types of toolpaths. As a comparison, other two B-spline based methods in [22] (denoted by 3 method) and [4] (denoted by 4 method) are also applied to the same toolpaths. After the toolpaths are rounded by different smoothing methods, the feedrate scheduling scheme in section 4 is proposed to interpolate the smooth paths. Then the contour errors, federate, acceleration and jerk profiles are analyzed to compare the above three smoothing methods in machining quality and efficiency. The related parameters used in this section are listed in Table 1. Chord error δ 0.001 Interpolation period 1

Simulation 1
In this section, a 2D NURBS curve named butterfly-shaped curve is discretized to linear segments as a toolpath to evaluate the performance of the proposed corner smoothing method. The degrees, control points, knot vectors, and weight vectors of butterfly-shaped curve are given in Appendix B.
As shown in Fig. 10, the linear trajectories near the corners are replaced by PH splines, which makes the toolpath 4 continuous. To clearly illustrate the generated corner transition curve, two regions are enlarged as shown in Fig. 11 (b, c). The federate, acceleration, jerk and chord errors profiles of the proposed method, 4 method and 3 method can be calculated by interpolation points, which are presented in Fig. 11-14.
From Fig. 11 and Fig. 12, the feedrate and acceleration are all subjected to the given limitations. However, it can be noted from Fig. 13 (b) that the jerk profile of 3 method excesses the maximum allowable jerk in some interpolating points, which will lead to violent vibration of the machine tool, and the machining quality will be affected.
As can be seen from Fig. 14, although the chord errors of the proposed method are larger than 4 method and 3 method, they are all smaller than the given threshold, so the machining quality is not significantly affected.  In machining efficiency, the machining time of these three different methods are 5.848 , 6.678 and 6.445 respectively. The machining time of the proposed method is 12.53% shorter than 4 method and 9.27% shorter than 3 method, which means the propose method can improve the machining efficiency when the machining parameters are set as in Table 1. To further validate the machining efficiency of the proposed method, the machining time of these three different methods when the federate, tangential acceleration, centripetal acceleration, tangential jerk and centripetal jerk constraints take different values are calculated and compared. As listed in Table 2, based on the machining time of the proposed method, the machining time of

Simulation 2
In this section, a 3D parametric curve named spherical helix curve is discretized to linear segments as a toolpath to evaluate the performance of the proposed corner smoothing method. The parametric equation of this curve are given as follows: where = , = 20 and ∈ [0,1].
Form Fig. 15-19, in terms of machining quality of spherical helix toolpath, we can get the same conclusion as in Simulation 1. However, in machining efficiency, the machining time of these three different methods are 4.125 , 5.022 and 5.114 respectively. The machining time of the proposed method is 17.86% shorter than 4 method and 19.34% shorter than 3 method. As listed in Table 3

Simulation 3
In this section, a compound freeform surface composed of two NURBS patches, which presented in Fig. 20, is tested. The toolpath of this freeform surface is generated by Su's method [41], which is composed of 58 linear toolpaths with corner points number ranging from 32 to 224. The transition error is 0.02 and other related parameters are the same as in Table 1.
It can be seen from Fig. 20-23, for the toolpath of freeform surface, the proposed method can replace the sharp corners with transition curves, and generate smooth velocity, acceleration, jerk profiles whose extremes do not exceed the given limitations.
While the jerk extreme of 4 method and 3 method excesses the maximum allowable jerk in some interpolating points, which will affect the machining quality.
From Fig. 24, although the chord errors of the proposed method are larger than 3 method and 4 method, they are all subjected to the given limitations, so the machining quality is not significantly affected.
In machining efficiency, the machining time of these three different methods are 79.436 , 319.090 and 85.860 respectively. The machining time of the proposed method is 75.11% shorter than 4 method and 7.48% shorter than 3 method. It can be noted that in the previous two simulations, the machining time of the proposed method, 3 method and 4 method are similar. However, in this simulation, the machining time of 4 method is much higher than the other two methods. Actually, in the order of magnitude, it is more closer to the machining time of point-to-point method, which is 545.177 . The reason is that the toolpath of the freeform surface consists of a large number of dense and short linear segments, while 4 method requires longer transition lengths for the same transition error, which makes the curvature extreme at the corners larger, so that the maximum allowable velocity at the corners are close to zero. From the previous two simulations, it can be seen that the proposed method is more efficient than 3 method and 4 method even the federate, tangential acceleration, centripetal acceleration, tangential jerk and centripetal jerk constraints take different values, so only the cases with the same parameters as in Table 1 are compared.

Conclusions and future work
This study presents a novel local corner transition method based on asymmetrical 4 continuous PH spline curve and a jerk-continuous feedrate scheduling scheme. Due to the asymmetry of PH spline curve, the construction of transition curve is more flexible. Although the asymmetry leads to unanalytical curvature extreme and corresponding parameter, a matrix which stored the parameters of curvature extreme points of different PH spline curves can be pre-calculated to solve this problem.
Advantages of our method are summarized as follows: (1) The corner transition method guarantees the curvature continuity, 4 continuity and maximum transition error of the smoothed toolpath. Furthermore, the cumulative arc length is a polynomial with respect to parameter of the transition curve, which makes the calculation of interpolation points more efficient.
(2) The curvature extreme of the smoothed toolpath is greatly reduced. Compared with two existing method, it has been decreased by 59.63% and 86.14%.
(3) The proposed method generates a smooth feedrate profile, continuous acceleration curve, and continuous jerk curve. Meanwhile, the actual maximum acceleration and jerk are under the confined range strictly.
(4) Machining efficiency is greatly improved. Compared with two conventional method, the machining time have decreased by 7.27% to 19.34%.
To further improve machining quality and efficiency, future work will focus on analytical one-step corner for linear toolpath. In addition, to increase the universality of the local corner transition method, the toolpath composed of lines and arcs will also be considered.