Axis Path Planning of Five-axis Surface Machining by optimizing Differential Vector of the axis movement considering tool posture limits

Two rotating axes of the five-axis machine tools complicate the kinematics, which increases the difficulty of trajectory planning of five-axis CNC machining. In the process of machining a free-form surface with a ball-head cutter, the tool is required to follow the tool tip path of the surface and the restriction of tool orientation is only constrained within a certain range. This paper proposes a planning algorithm based on differential vector optimization for generating a smooth trajectory of each axis for five-axis machining. Firstly, the kinematic model of the five-axis CNC machine tool and the Jacobian matrix are built. Secondly, the optimization objectives combined with the smoothness optimization requirements and the limits of the tool axis vector are established. Then, the trajectory of the moving axis by integrating the optimized differential vector is generated. At last, a waveform surface is machined based on VERICUT software and a five-axis machine with the trajectory generated by the proposed method. To prove the feasibility and superiority of the method, a simulation


Introduction
Compared to the three-axis machine, the five-axis machine tool has two additional rotary axes that can change the tool posture, which makes it more flexible and productive.However, the change of the tool axis vector in the workpiece coordinate system (WCS) will be mapped to the machine coordinate system (MCS) and affect the motion of each axis [1][2].
Due to the machining process requirements, the tool vector is limited to a certain area.At the same time, the tool axis vector should prevent the abrupt change from causing the reduction of machining quality and machining efficiency [3].Meanwhile, avoiding interference collision among the tool, the machining part surface, and the machine body must be considered in the tool axis vector optimizing process.
Stejskal M et al. [4] proposed a method based on calculating the actual cutting diameter and the cutting speed during the toolpath.Fu M et al. [5] proposed a novel five-axis contour evaluation index TCCE to simplify the calculation of five-axis contour error considering the synchronization between tool tip position and orientation.Suzuki T et al. [6] proposed a method for obtaining the cutting points that render cusp heights below the target value and generating an interference-free tool path in which the tool posture changes constantly.Yadav D K et al. [7] proposed a method for generating an interference-free tool path in which the tool posture changes continuously.Wang et al. [8] proposed a method by using five-axis ball-head tool machining to improve the motion of the rotary axis of a five-axis machine tool and maintain the expected cutting performance of the tool when adjusting the tool axis vector.Liu et al. [9] proposed a method of optimizing the tool axis vector through the feed coordinate system to solve the problem of drastic changes in the tool axis vector in five-axis CNC machining to avoid global interference.Ye et al. [10] proposed a second-order kinematic performance-based optimization of the tool axis vector for five-axis machining to improve the kinematic performance of the kinematic axes during five-axis machining.Tang et al. [11] proposed a novel master-based feedrate scheduling approach with real-time and drive constraints to generate smooth trajectories along five-axis linear tool paths.Fountas NA et al. [12] proposed a new method based on a virus-evolutionary genetic algorithm to enhance the surface tool path planning by automatically selecting the machining parameters of the 5-axis end milling strategy.
The researchers have proposed various methods for generating interference-free tool paths and optimizing tool orientation and position to minimize errors and achieve optimal cutting performance.
Zou et al. [13] proposed a spatial tractrix that generalizes the classic tractrix to set up the geometric model of the tool orientation kinematics in the part coordinate system.Zhu et al. [14] proposed a tool axis vector optimization method based on multiple projection planes, which divided the free surface into nine sub-surfaces, and then found the optimal tool axis vector.Min et al. [15] proposed an equal scallop curve tool path generation algorithm combining the existing circular for five-axis CNC machining to generate the optimal tool axis vector.Wang [16] proposed an algorithm that optimizes the tool path of five-axis machining in a singular area considering a table-tilting type machine tool with two rotational axes, A and C. Li et al. [17] proposed a five-axis TR tool path planning algorithm for machining an arbitrary 3D curved cavity tending to all the required constraints, such as the threshold on the cutting force.Duan et al. [18] proposed a tool position optimization model that includes the effect of deflection error caused by cutting forces to achieve better machining accuracy control in five-axis impeller surface milling.Yuan et al. [19] proposed a method to generate smooth tool paths for the workpiece surface of the flush milling cutter in two stages to ensure that no collisions and grooves occur.Chu et al. [20] proposed a new scheme of tool path planning for five-axis flank milling based on meta-heuristics, ant colony system (ACS), which significantly improves the efficiency of dynamic programming to obtain the best tool path.Xiao et al. [21] proposed a new method to optimize the tool orientation to reduce the maximum tool tip and tool orientation contour errors.Ibaraki S et al. [22] proposed a method based on using a contact-type touch-trigger probe installed on the machine's spindle to improve the motion accuracy of the five-axis CNC machine tool.
Although many scholars have carried out tool-axis vector optimization methods to improve the machining process, the following problems still exist for tool-axis vector optimization.Most of the existing tool axis vector optimization is carried out under the WCS to generate the optimal tool path directly.However, the tool axis vector optimized under the WCS still needs to be transferred to the MCS.At the same time, the smoothness of the machine tool motion in each axis is ignored in most research [23][24].This paper presents an axis path planning of five-axis surface machining by optimizing the differential vector of tool posture to solve the above problems.First, the kinematic model and Jacobian matrix of the A-C double turntable five-axis CNC machine tool are established.Secondly, the relationship between the differential vector in the MCS and the WCS is established according to the Jacobian matrix.Then, the minimal differential vector in the MCS is optimized considering the constraints of the tool-axis vector boundary in the WCS.In the end, the whole tool path trajectory is integrated by the optimized differential vector in the MCS.The effectiveness of this algorithm is verified by machining complex surfaces with VERICUT software and a five-axis machine.

Mathematical modeling of the five-axis CNC machine
The A-C double turntable five-axis CNC machine tool is the research object of this paper.The proposed method is also applicable to other types of five-axis machine tools.The A-C double turntable five-axis CNC machine tool and its transmission chain are shown in Fig. 1.         is the TCS (tool coordinate system),         is the MCS and         is the WCS.The entire machine tool transmission chain starts from the workpiece and reaches the tool through the C-axis, A-axis, Y-axis, machine tool body, X-axis, and Z-axis.
where A is the rotation angle of coordinate system         around its own X-axis, while C is the rotation angle of coordinate system         around its own Z-axis.
,   ,   are expressed as: where X is the translation of         along the X-axis, Y is the translation of         along the Y-axis and Z is the translation of         along the Z-axis.
(  ,   ,   ) is the relative coordinate of the origin of         in the MCS.
(  ,   ,   ) is the relative coordinate of the origin of the WCS in         .
The relationship of the cutting tool in the WCS and the TCS is: where   (  ,   ,   ) is the position of the tool point in the WCS,   (  ,   ,   ) is the vector direction of the tool axis in the WCS,   (0,0,0) is the position of the tool point in the TCS, and   (0,0,1) is the vector direction of the tool axis in the TCS.
Normally, if the origin of the WCS, the MCS, and the TCS is set to be in the same Z-axis direction,   =   =  =  =0, the tool axis vector and position coordinates of the tool tip point under the WCS can be expressed as: In this paper, the axis path of five-axis surface machining is planned by optimizing the differential vector of axis movement considering the tool-axis vector limits.It is necessary to transform the differential move of position and posture of the tool in the TCS into the WCS to generate the Jacobian matrix.According to the structure of the model of the A-C double turntable five-axis machine tool, the Jacobian matrix of the machine tool is constructed as follows: where  1  2  3  4  5 are: The Jacobian matrix of the machine tool represents the mapping relationship of the machine's each moving axis between the differential move in the MCS and the differential move of the tool relative to the table, which is:

Generation of the smoothness optimization objective
The relationship between the tool differential move and the machine differential move in each axis is established by the Jacobian matrix.As shown in Eq. ( 8), for the five-axis machining process, the smaller the current machine differential vector   = [, , , , ] T for each axis movement, the smoother the machining movement process.Therefore, in this paper, the differential vector   for each axis movement is set as the optimization variable.For the five-axis machining process, the dimension of the differential vector   is five.
When there are no singularity points in the whole machining process, the tool posture differential vector  = [, , , , , ] T to the differential vector   for each motion axis at the current tool tip point can be obtained by machine tool Jacobian matrix inversions as: Designing a parametric curve () =[x, y, z] for a surface machining process, when the five-axis machine tools driven ball-end cutter moving along the path (), the point differential vector expression of point location is provided as follows: The tool tip position differential vector is the tangent vector ′() = [′(), ′(), ′()] of the tool tip path curve, and then the five-dimensional optimization variable  is constrained by Eq. ( 10) and simplified to a twodimensional optimization variable.

The Differential Vector of the axis movement considering tool posture limits
To maintain consistent machining conditions and avoid machining interference, the tool axis vector should be limited to a feasible domain.In this paper, the differential move of the tool axis is optimized to let the tool axis vector movement away from the boundary of the feasible domain.

The tool axis vector angles in the local coordinate system
In the five-axis actual machining process, the LCS (local coordinate system) is constructed at the tool tip point to control the cutting conditions, as shown in Fig. 2.

Fig. 2 The local coordinate system
After the tool tip path () is planned, the normal vector  at any position of the tool tip path can be obtained.The unit vector  of the feed vector is: The unit vector  can be determined as: In the LCS, as shown in Fig. 2, the tool axis vector   has a tilt angle  (around the axis ) relative to the surface normal vector .The rotation angle  with the feedrate  is the angle between the tangent vector  and the projection vector of the tool axis vector   on the c-f plane formed.
In the LCS, , ,   are: = acos ((  , )) ( 14) where   is the projection vector of the tool axis vector   on the  −  plane, and  is the tool radius.

Generation of the rotation angle and tilt angle optimization objectives
Establish the transformation relationship between the LCS and the WCS.The tool axis vector under the LCS is converted to the WCS through the transformation matrix   .The tool axis vector under the WCS is expressed as: In the process of surface machining, the tool tip moves along the tool path.
Supposing the tool tip point  to the tool tip point  + 1 is under the differential move  , the homogeneous transformation matrix of the tool axis vector (D) can be established with the tool posture differential vector , as shown in Fig. 3.

Fig. 3 Toolpath in the workpiece coordinate system
The homogeneous coordinate transformation matrix () of the tool posture differential vector  is: The tool axis vector at the  + 1 point is: The tilt angle and the rotation angle optimization objective are designed to make the tilt angle  and rotation angle  at the next point move towards the center of their respective feasible regions.According to Eq. ( 13), the tilt angle  can be determined by the tool axis vector and the normal vector of the current point in the LCS.Similarly, the rotation angle  at the next tip point can also be determined.The angle change ∆ from the point  to the point  + 1 is: Supposing the tool axis vector at the point  is known and the differential move  is optimized, the tool axis vector at the point  + 1 can be determined by ().At the same time, ∆ is also combined with the change of the tool axis vector.∆ can be converted into: Similarly, the rotation angle  at the next tool tip point can also be determined, and the angle change ∆ from the point  to the point  + 1 is: Then, the change in rotation angle ∆ is also determined by the differential move  and represented as follows: In this paper, the ∆ and ∆ are optimized to move away from the boundaries, i.e.
the ∆ and ∆ are optimized to let the tool orientation angle move to the centre of the feasible region.Then the optimization objective ∆  = (∆) and ∆  = (∆) should be designed, i.e. when the ∆  and ∆  become smaller, the tool orientation angle would move to the center of the feasible region.
The optimization objective of tilt angle ∆  is designed as: The optimization objective of rotation angle ∆  is designed as: where  ℎ_ and  ℎ_ are the median values of the angular reasonable deflection range of the tool attitude at the current point.According to the Eq. ( 23) and Eq. ( 24), no matter whether ∆ and ∆ at the current point are within the left or right range of the feasible region center, the minimum value of ∆  and ∆  will make ∆ and ∆ move towards the feasible region center.

Combining the differential vector optimization objectives
According to the above equation, there are three optimization objectives: the smoothness optimization objective ‖    −1 ‖ 2 , the tilt angle optimization objective ∆  and the rotation angle optimization objective ∆  .These three optimization objects should be combined and must be balanced according to their characteristics.Therefore, the smoothness, tilt and rotation angle optimization objective models should be first normalized.
The smoothness optimization objective model is established as: The tilt angle optimization objective model is established as: Creating the differential vector optimization objective model as follows: According to the combined optimization objective () , when the tool orientation angles are in the center of the feasible region, the influence of  2 and  3 should be small; on the contrary, when the tool orientation angles are near the boundaries, the influence of the  2 and  3 should be larger to let tool orientation angle move away from the boundaries.The design influence factor  1 and  2 are: where  max _ and  min _ are the boundary values of   ,  max _ and  min _ are the boundary values of   .In order to display the trend of changes of the influencing factors  1 and  2 , the schematic of the influence factors is shown in Fig. 4.
As shown in Fig. 4, it can be found from the influence factor diagram that when the rotation angle  changes towards the center of the feasible region, the influence factor  2 will tend to 0, and when the rotation angle  moves towards the boundary of the feasible region, the influence factor  2 will grow exponentially.After the first point is given, the moving axis path could be integrated by the optimized differential vector . the flowchart of the whole path planning method is provided in Fig. 5.

Fig. 5 Flow chart of optimization algorithm 7. Simulation experiments based on VERICUT
To verify the proposed method, a 3D model of the corresponding A-C doubletable five-axis CNC machine is built.The coordinate system of each axis is set according to the actual machining conditions.The work-piece blank and fixture are set according to the machining surface.Finally, the machining is simulated on VERICUT, and the machining results are analyzed.

The Waveform Surface Simulation Case
To verify the effectiveness of the proposed axis path planning method, the tool path is generated from the parametric surfaces.When the tool posture angle is kept constant during machining, the tool path information of the wavy surface and the vector distribution of the tool axis of a certain section curve are shown in Fig. 6.The advantages of the proposed method are demonstrated by comparing with other methods.
Fig. 6 Tool path and tool orientation of curve

Analysis of machine axes motion and tool posture angle
Based on the moving axis path planning, the fmincon function in MATLAB is used to calculate the final optimization objective model.Here define three algorithms.
Algorithm A is the traditional algorithm, which maintains a constant tool tilt angle and rotation angle.Algorithm B is defined as the algorithm that takes smoothness as the only optimization objective.Algorithm C is the optimization algorithm proposed in this paper, which not only considers smoothness as the optimization objective, but also optimizes the differential vector of the axis movement considering tool posture limits.
One of the continuous trajectories for the surface machining, as shown in Fig. 6, is selected to generate the axis trajectory by the above algorithms.The generated axis trajectories are provided in Fig. 7.As shown in Fig. 7 and Table 1, the optimization algorithm in this paper significantly reduces the motion of translating and rotating axis in the machining process compared with the traditional algorithm.The rotation angle and the tilt angle of the cutting tool with the axis trajectories planned by those methods are also provided in Fig.The simulation results based on VERICUT and the no-load experiment show that the optimization algorithm proposed in this paper greatly shortens the machining time.
Meanwhile, it ensures no interference between the tool and the machining surface.

Conclusion
In order to satisfy higher efficiency and smooth surface machining requirements, an axis path planning of five-axis surface machining by optimizing the differential vector of the axis movement considering tool posture limits is proposed.After establishing the relationship of the differential move between the tool and axis motion for the five-axis CNC machine based on the Jacobian matrix, the smoothness optimization objective is calculated to generate continuous and smooth motion axis trajectories.In order to avoid interference between the tool and the machining surface, the differential move of the tilt and rotation angles are optimized to let the tool axis vector move away from the boundaries.And then, those different optimization objectives are combined and balanced, and the differential move of the axis is optimized under the combined optimization objective.Finally, the moving axis paths are integrated by the optimized differential move of the axis.The superiority of the of the method proposed in this paper is demonstrated by the simulation analysis and the no-load machining experiment.
Lu and Sicong Wang performed the validation and supervision.All authors commented on previous versions of the manuscript.All authors read and approved the final manuscript.

Fig. 1 A
Fig. 1 A' -C' 5-axis CNC machine tool and its transmission chain optimization objective model is established as:  3 = ∆  −∆ _ ∆ _ −∆ _ (27) Because multiple optimization objectives need to be balanced, it is necessary to combine the smoothness optimization objective model  1 , tilt angle optimization objective model  2 , and rotation angle optimization objective model  3 into a differential vector optimization objective model.The influence factors  1 and  2 are set to combine with the optimization objective model of tilt angle and rotation angle.

Fig. 4
Fig. 4 Schematic of the influence factors

Fig. 7
Fig. 7 Three trajectory planning of motion axis for the motion of each axis of the

Fig. 9 Fig. 10
Fig. 9 The processing result of VERICUT simulation and the no-load machining

Table 1
Motion distance of each axis for the three trajectory planning methods

Table 2
No-load processing time.