Optimization of tool axis vector for mirror milling of thin-walled parts based on kinematic constraints

In mirror milling of thin-walled parts, the machining path and change in tool axis vector will affect the surface quality of the workpiece and machining efficiency. Reasonable planning of the tool axis vector can avoid the occurrence of overcutting and undercutting and prevent a collision between the tool and the workpiece and damage of the spindle. At the same time, the rapid change in tool axis vector will also affect the machining quality, so optimization of the tool axis vector is very important in mirror milling. In this paper, the optimization of the tool axis vector for titanium alloy skin processing is divided into two steps. The first optimization is carried out on the basis of the planning of the machining path. First, the machining path is obtained according to constraints of mirror milling, and the iterative algorithm of the tool position is used. The tool location point is obtained, and then the tool location point is projected onto the parameter plane to optimize the tool axis vector. The second optimization is to optimize the tool axis vector based on kinematic constraints. The rotation axis of the machine tool needs to meet the constraints of the maximum angular velocity, the maximum angular acceleration, and the maximum angular jerk. First, the optimal feed rate of the mirror milling machine tool is obtained. The tool axis vector is optimized for optimization goals with minimum motion fluctuation stop and minimum adjacent machining time. Subsequently, the optimized machining path and the tool axis vector were simulated and tested. Finally, the simulation and experimental results were determined by an analysis that proved the feasibility of the optimized model proposed in this paper. At the same time, the results of the experimental measurements also showed that the optimized machining path had been greatly improved in terms of quality and efficiency.


Introduction
In modern engineering, the technology of machining complex curved surfaces has become one of the important standards for assessing the level of development of a country's machinery manufacturing industry. In particular, in the aerospace sector, large thin-walled parts are widely used as aircraft exterior parts [1]. Especially in the processing of large-scale skins on the surface of aircraft due to large size, weak rigidity, small thickness, and large removal amount of parts, the parts are easily deformed during processing, which affects the processing quality [2]. For the processing of the skin, traditional methods [3] often adopt the method of chemical milling, but this method had serious pollution and low processing precision, which cannot meet the processing quality requirements of aircraft skin. Mirror milling is a new green processing method proposed over the past few years [4]. The mirror milling system consists of two symmetric horizontal machine tools with five axes, one of which is the milling side and the other is the support side. It can be indicated from Fig. 1 that the milling side is responsible for removal of materials, while the support side locally maintains the processing position of thin-walled parts and reduces small deformations. In comparison to chemical milling, mirror milling can improve processing efficiency and quality, reduce pollution, and further reduce costs. It is a developing trend in skin processing at the present time.
The mirror milling technology belongs to the multi-axis digital control processing. The processing path planning of the surface and the tool axis vector planning of the tool position has a very important influence on the processing quality and processing efficiency of the skin surface. Reasonable planning of the tool axis vector can avoid the occurrence of overcutting and undercutting and prevent a collision between the tool and the workpiece and damage of the spindle. At the same time, a rapid change in the tool axis vector will also affect the machining effect. Unreasonable path planning will not only seriously affect the stability of surface processing but also damage the workpiece and affect the accuracy of the machine tool. Therefore, the operating axes of the machine can move smoothly through reasonable path planning. Similarly, the optimization of the machine is particularly important to improve the quality and efficiency of mirror milling.
Scholars at home and abroad have carried out extensive research to improve the five-axis digital curve machining technology. First, in terms of path-planning technology, He et al. [5] studied the tool path generated by spline curves for complex surfaces and obtained better surface quality and processing efficiency. Ding et al. [6] proposed to select unequal section plane spacing for different processing areas. This method can avoid redundant tool positions and improve efficiency. Xiao [7] generated a five-axis machining path based on the equal residual height algorithm, which reduced the path length and shortened the machining time. In terms of planning of the feasible direction of the tool, Zhu et al. [8,9] modified the rake angle of the tool at the same time and modified the side angle of the tool to a certain extent to ensure the local optimal matching of the tool and the workpiece, which not only improved the machining process efficiency and guarantee the machining accuracy. The rolling ball method [10,11] and the arc length intersection method [12,13] proposed by Gray et al. solved the phenomenon of local interference and over-cutting in the machining of flat and circular cutters, thereby improving the surface quality of the workpiece. To further improve the smoothing of the tool direction, Ho et al. [14] and Ji et al. [15] used spline interpolation to plan a smooth and interference-free tool axis vector. Hu et al. [16] and Lu et al. [17] optimized the feed rate from the point of view of the kinematics of each axis. Wang et al. [18] further improved the stability of the machine tool based on the constraints of angular velocity and acceleration. Hu et al. [19] also further improved the smoothness of tool movement by optimizing the tool axis direction of the tool movement. Affouard et al. [20], Yang et al. [21], and Wan et al. [22] fitted the tool axis vector of each tool position point to a spline curve and adjusted the control points of the spline curve to ensure the smoothness of the tool axis vector. Hu et al. [23] integrated the kinematic performance of each axis of the machine tool and the effective cutting width to further improve the processing efficiency while obtaining a more efficient planning path.
To further improve the mirror milling efficiency and the surface quality of the assembled workpiece, the complete tool path planning process in this study is shown in Fig. 2.
The key research object in Fig. 2 is "optimization of tool axis vector," which combines discrete geometric methods, fitting the surface and the spline curve. The tool position and processing path are initially obtained by using the above method. After the kinematic transformation of mirror milling and milling, the feed rate of the machine tool is further optimized according to the kinematic constraints of the maximum angular velocity, maximum angular acceleration, and maximum angular jerk of the rotary axis. Then, a model is established whose optimization objective is the minimum sum of the motion fluctuation of the rotary axis and the processing time. Finally, the feasibility and efficiency of the model proposed in this paper were verified by simulation and actual processing.

Kinematic transformation of the mirror milling system
Mirror milling is a mirror-synchronized motion of dual fiveaxis. The cutting axis and the supporting axis are distributed mirror-symmetrically on both sides of the skin. During the cutting process, the support shaft follows the movement of the cutting shaft to prevent deformation of the workpiece.
In the double five-axis mirror milling process, the milling side is a C 1 -A 1 double swing head structure machine tool, and there are travel constraints on the rotation axes A 1 and  O w X w Y w Z w is the coordinate system of the workpiece in the initial state, O t1 X t1 Y t1 Z t1 is the coordinate system position of the tool movement on the milling side during the machining process, and O m1 X m1 Y m1 Z m1 is the position of the rotary coordinate system of the tool movement on the milling side during the machining process. Correspondingly,  O t2 X t2 Y t2 Z t2 is the position of the driving point coordinate system of the support side during the movement process, and O m2 X m2 Y m2 Z m2 is the rotary coordinate system of the support side.

C 1 -A 1 milling side machine kinematics conversion
The milling side is a C 1 -A 1 five-axis double swing head structure machine tool, and the rotation axes of the milling side are recorded as A 1 and C 1 , respectively. Then, for the milling side of the double five-axis machine tool, the expression of the tool axis vector (i, j, k) T is According to the vector expression of the cutter axis on the milling side, the solutions of the angles A 1 and C 1 can be obtained through the inverse kinematics transformation of the milling side: In the equation, the value range of A 1 is [−90 • , 90] , and the value range of According to Eq. (2), k determines the amount of change in the rotation axis A 1 , while i and j determine the amount of change in the rotation axis C 1 . For the problem of multiple solutions in the solution process of the rotation axis, the inverse trigonometric function image is used here. The solution can be indicated from the following Fig. 4.
From Fig. 4, it can be analyzed that there are two groups of corresponding basic solutions, (A 11 , C 11 ) and (1) (A 12 , C 12 ) or (A 11 , C 11 � ) and (A 12 , C 12 � ) , and A 11 + A 12 = 0 • , for the rotation axis, while in the actual solution process, the value range of the rotation axis C 1 is [−360 • , 360 • ] , one more cycle than the interval where the basic solution C 1 axis is located, so there are two more sets of solutions for the C 1 axis, and finally there are four sets of solutions for the A 1 and C 1 angles.

B 2 -A 2 structural machine tool kinematics transformation
The support side is a double head pivoting machine B 2 -A 2 , and the rotation amount of its rotating shaft is recorded as A 2 and B 2 , respectively. Then, on the support side in the mirror milling process, the expression of the tool axis vec- According to the kinematic transformation of the mirror milling, there are several solutions in the solution of the rotating axis on the support side. When j = ±1 , the solutions for angles A 2 and B 2 are obtained as Then, when j = ±1 , the obtained solutions of the A 2 and B 2 angles are

Determination of tool position under the constraints of kinematics
In the mirror milling process, which is used for the planning of the tool position trajectory in aircraft skin machining, the boundary of the surface to be machined is used as the benchmark and adopts the method of "first outside and then inside," the method of first machining the outer contour and then the inner contour. Moreover, the constant parametric method is used to generate the initial machining tool path. A series of tool location points, , is given at a certain angular interval on the generated path to tool location. The tool location point data includes the tool nose point coordinate (x i , y i , z i ) and the tool axis vector (i i , j i , k i ) in the corresponding position.

Workpiece geometry
, is exported from the obtained digital model to be processed in CATIA, as shown in Fig. 6 below.
According to the surface fitting based on the overall least-squares proposed in the literature [24], the point cloud data is fitted by the quadratic surface equation, and the quadratic surface function equation can be expressed as

Tool path design for machining area
On the surface to be machined, after matching the point cloud data with the boundary as the constraint, the tool path is generated on the surface using the equal parameters method. Additionally, this method prioritizes the outer contour and then the inner contour, as shown in Fig. 8.   In the mirror milling process, to ensure that the thickness measured by the measuring instrument on the support side is the remaining thickness after machining in the current tool position, the step length of the machining tool path must meet the effective cutting width condition of the tool. As shown in Fig. 9, the step length of the tool must be greater than the radius of the bottom edge of the tool.
In the process of mirror milling, to guarantee that the thickness measured by the measuring instrument on the support side is the remaining thickness after machining in the current tool position, the step length l of the tool movement needs to be guaranteed to match the conditions of the actual cutting width of the tool, as shown in Fig. 9, that is, the conditions that need to be met for the tool step l are as follows: where r is the radius of the bottom edge of the tool.

Determination of tool position
In the tool positioning path generated in Fig. 8, a set of tool positioning points is given at a certain interval. Due to the complex change in the curvature of the thin-walled part, it is difficult to determine the relationship between the cutting step length and tool position points. Priority is given to organization of tool paths along the direction of the curvature change law, and then under this premise, the tool position points are planned. In this paper, the tool position points are distributed equally over each curve segment. The new tool localization point is based on the tool localization point iteration algorithm specified and given in the literature [25]. The tool location diagram for the entire machining path is shown in Fig. 10.
During the mirror milling process, the milling head and the support head travel symmetrically and synchronously, and an ultrasonic measuring sensor is installed on the support gauge. During the machining process, the remaining wall thickness of the machining location can be measured in real time. During the machining process, the tool axis vector of the current tool position point and the normal direction of the workpiece surface where the current tool position point is located should be consistent, namely: In the equation, �� ⃗ V = (i i , j i , k i ) T represents the tool axis vector, which belongs to the position of the current tool point; � ⃗ n z represents the normal vector of the workpiece surface, which also belongs to the position of the current tool point.
Under the constraints of Eq. 9, a series of tool position data, P i (x i , y i i i , j i , k i ) , is obtained. The tool locations and the surface of the 3D are projected onto the UV parameter plane of the curved surface for further optimizing the existing tool paths and improving the machining quality. The tool position points are denoted as , and these tool position points are fitted to a cubic B-spline curve. For the tool position points on the B-spline curve, the curvature of each tool path developed in this paper changes regularly, so there is a one-to-one correspondence between the node parameters and the corresponding tool position point intervals. It is approximately proportional, that is, the trajectory of the tool position point with approximately equal steps can be obtained by the equal parameter method. Take the s-th tool path as an example, as shown in Fig. 11.
According to the method for measuring the smoothness of the tool path proposed in the literature [26], the goal is to minimize the sum of the weights of the smoothness measurement values of the tool tip point (x In Eq. (10), F( s ) is the weighted sum of the tool nose point and the tool axis vector smoothness measurement value, a is the tool axis vector smoothing weight, s = [ s,1 , ⋯ s,t , ⋯ s,m ] is the shape control parameter of the s-th tool path, m is the number of nodes, f a s is the tool axis vector smoothness measurement value, t is the tool nose point smoothing weight, and f t ( s ) is the tool nose point smoothness measurement value, which is generally set to t > 5 a here but in the process of practical application, it is properly adjusted according to the requirements of the smoothness weight, and then we obtain the shape control parameter s of each curve node through Eqs. (11) and (12). In this paper, Eq. (10) is used as the objective function; under the effective cut width constraint of Eq. (12), the differential evolution algorithm is used to solve the problem, and the curve node shape control parameter s is obtained in the case of the minimum weighted sum.  According to the obtained control parameters, the control point (x ε i , y ε i , z ε i ) on the new parameter plane can be obtained, and the corresponding point position on the fitting plane can be reversely obtained through the UV parameter plane, that is, the control point (x ε i , y ε i , z ε i ) on the parameter plane can be brought into Eq. (6). and the point-to-plane solution principle can obtain the node (x c i , y c i , z c i ) on the corresponding surface. At the same time, in the mirror milling process, the tool axis vector of the machining tool position is always perpendicular to the workpiece surface, so the tool position  Then, the tool position point of the fitted surface tool is finally obtained, which can be expressed by MATLAB, and the result is shown in Fig. 12 below.

Tool axis vector optimization under kinematic constraints
For the tool position point P c Determination of tool position under the constraints of kinematics, to further improve the efficiency, it is also necessary to comply with the constraints of the kinematic characteristics of the machine tool, that is to say the rotation axis of the machine tool meets the maximum velocity limit, maximum acceleration limit, and maximum jerk limit. Therefore, when the velocity, acceleration, and jerk at certain points of the tool position exceed the limit by adjusting the feed rate, a model is established with the minimum sum of the motion fluctuations of the rotary axis and the minimum processing time as the optimization goals to ensure machining quality and machining efficiency.

Mirror milling post processing
In combination with Fig. 3 drive chain and the obtained cutter position P c i , the cutter position on the milling side is expressed as −( , the offset length from the midpoint of the A 1 axis to the zero position of the machine tool is (m x , m y , m z ) , and the offset length from the central position of the A 1 axis to the central position of the C 1 axis is (L x , L y , L z ) . At the same time, the cutter position of the supporting side can be set to ( the offset length from the midpoint of the A 2 axis to the zero position of the machine tool is (L tx , L ty , L tz ) , and the offset length from the central position of the B 2 axis to the central position of the C 2 axis is (L ax , L ay , L az ) . Then, the coordinate point data on both sides can be expressed as follows: In Eqs. (16) and (17), X 1 , Y 1 , and Z 1 are the coordinate point data on the milling side, the complete tool position point on the milling side is (X 1 , Y 1, Z 1 , A 1 , X 1 , C 1 ) , and X 2 , Y 2 , and Z 2 are the coordinate point data on the supporting side. The position is (X 2 , Y 2, Z 2 , A 2 , B 2 ) ; the values of the rotary axes A 1 and C 1 on the milling side can be obtained from Eqs.

Determination of machine tool feed speed
Since the five-axis motion on both sides of mirror milling is synchronous; that is, the rate of change of motion on both sides is consistent, and the coordinate point data on both sides processed by the post-processing of the milling head and the support head system are based on the transformation of the tool position point data. Therefore, the milling side treatment is used as an example to for optimizing the motion changes of the A 1 and C 1 rotation axes.
According to the kinematic transformation of mirror milling in Kinematic transformation of the mirror milling system, it can be known that if the tool axis vector (i c i , j c i , k c i ) is projected to the IJ plane, the angle of the tool axis vector between the forward and backward positions determines the amount of change in the C 1 rotational axis. The specific variation is illustrated in Fig. 13.
In Fig. 13,P c , and P c i+2 are four consecutive tool points of a section of the path. The angle between OP c i and OI is the location of the C 1 axis. The values of the C 1 axis of the four tool points can be expressed as O . Because the distance between the tool positions is small enough and the feed rate is continuous during the machining process, the default feed rate between the tool positions is a constant value of f , and theoretically, the running time between adjacent cutter locations is the same as the C 1 axis, so the relationship is as follows: performance. To ensure efficient treatment, the optimal feed rate is selected while respecting the kinematic performance constraints of the A 1 and C 1 axes. The feed rate can be obtained by the following equation: In the same way, the optimal feed rate f max, A1 of the rotary axis A 1 can be obtained. Because the rotation axes A 1 and C 1 have a certain correlation in the movement process, the final selected machine tool feed rate can be expressed as:

Multi-objective tool axis vector optimization
Since the variation of the axes A 1 and C 1 of each cutter location is different, the variation of the axis A 1 of some cutter locations is larger; at the same time, the variation of the axis C 1 of some cutter locations is larger, so the fluctuation of the axes A 1 and C 1 can be minimized to improve machining efficiency. The minimum sum of the movement fluctuation of the rotating axis and the minimum machining time is used as the optimization objective, and we establish a model based on the kinematic performance constraints; that is to say, the angular velocity, angular acceleration, and angular acceleration of the rotation axis are required to satisfy the respective maximum ranges. According to Eqs. (22), (23), and (24), the kinematic performance constraints of each axis can be known. In addition to the range of motion of the rotation axis In Eq. 27, v i is the angular velocity at any rotation axis, a i is the angular acceleration of any rotation axis, j i is the angular jerk of any rotation axis, v max is the maximum angular velocity of the corresponding rotation axis, a max is the maximum angle of the corresponding rotation axis acceleration, and j max is the maximum angular jerk corresponding to the rotation axis.
While satisfying the smooth movement of the rotating axis, the kinematic performance of the original tool position points of the tool is maintained at the maximum measurement. The objective function is determined by the minimum sum of the rotational axis motion fluctuation values. The motion change time is optimized, the time change amount of the rotary axis of the adjacent tool position point is set to t i as the minimum value of the time change amount of the rotary axis of the next tool position point, the maximum value of the change time is t i + ∇ , and ∇ is the iteration of time change. Therefore, the objective function of tool axis vector optimization is In Eq. (28), v i,ori is the original angular velocity of the rotating shaft, \ v i,opt is the optimized angular velocity of the rotating shaft, a i,ori is the original angular acceleration of the rotating shaft, a i,opt is the optimized angular acceleration of the rotating shaft, and j i,opt is the original angle of the rotating shaft. j i,opt is the optimized angular jerk, and T i is the optimized rotation axis change time.
Due to the linkage relationship between the rotation axes A 1 and C 1 , it is impossible to achieve their respective optimal values in the same tool position at the same time, so the optimization weights should be reasonably allocated. Finally, a reasonable machining condition can be achieved to improve the calculation efficiency. In this paper, the method of equal distribution is adopted, so the kinematic performances of the A 1 and C 1 rotational axes are limited. In order to better reflect the optimization process of the research method in this paper, flowchart 14 is given. The detailed process of the first optimization and the second optimization is included in Fig. 14.

Simulation and experiment
To verify the validity of the method proposed above, processing experiments are conducted on a dual five-axis mirror milling platform, as shown in Fig. 15. In this paper, processing time and wall thickness are used as evaluation targets. The processing time is the actual running time of the machine tool; the monitoring and recording data based on the time interval can be derived in the mirror milling processing control platform, and it includes acquisition time, thickness measurement before filtering, thickness measurement after filtering, water pressure measurement, eddy current distance and so on. In this paper, the tool path design trajectory is continuous, no tool lifting, no cross, and the acquisition time starts from the starting point of the tool to start the acquisition, the middle process of no tool lifting time, until the complete path run, when the collection time stops, the processing time can be obtained. Reasonable planning of the cutter axis vector can avoid the over-cutting and under-cutting phenomenon and prevent a collision between the cutter and the workpiece and damage of the spindle. At the same time, the fast change of tool axis vector will also affect the machining effect, and the tool axis vector will have some influence on the wall thickness, so the wall thickness is used as the evaluation target.
The workpiece material used in this paper is the TC4 titanium alloy, the rigidity of the workpiece is poor, the   Table 1.
Depending on the part geometry model suggested in Determination of tool position under the constraints of kinematics, the fitting surface must be machined, as shown in Fig. 16. At the same time, the tool position data is obtained, and through the optimization method proposed in Tool axis vector optimization under kinematic constraints, the rotation axes A 1 and C 1 on the milling side are selected for optimization research in the simulation. Following the calculation, the feed rate for CNC machines selected in this paper is 360 mm/min, and the spindle speed is 1600 r/min. The angular velocity limit of the A 1  As a matter of fact, to confirm the validity of the calculation results, the machined surfaces before and after optimization through actual machining are compared, as can be seen in Fig. 19. At the same time, we compare the unit changes in the A 1 and C 1 axes, as shown in Figs. 20 and 21. Figure 19 (a) shows the machined surface before optimization. On the one hand, the vibration of the tool caused by the problem of overshooting motion leads to the phenomenon of chatter marks. On the other hand, because of the unit change in the rotation axis during the movement, the larger size results in significant tool marks on the surface of the workpiece, both of which increase the wall thickness error and affect the processing quality. On the optimized surface of the workpiece, it can be seen in Fig. 19 (b) that chatting lines and tool marks have been eliminated and that the machining quality has been significantly improved. It is represented in the Figs. 20 and 21 that the unit change in the C 1 axis after optimization is more obvious than that in the rotation axis A 1 , so the optimized rotation axis C 1 has a higher proportion in the optimization process, and the maximum unit arc length C 1 axis rotation is reduced from 0.215 to 0.0465°/mm, which is a decrease of 78.37%. The final experimental results can be seen in Table 2 below.
By comparing the processing time and the wall thickness error in Table 2, the machining results before and after optimization can be clearly visible. First, the processing time is reduced by 17.5%, the minimum wall thickness error is decreased by 44.4%, and the maximum wall thickness error has a 33.3% reduction. Moreover, the total error range has a 38.1% reduction compared to without using the optimization method. In short, this method can be applied to actual machining, and the resulting surface quality and machining efficiency are significantly improved.

Conclusion
With the discrete fitting of the digital model, under the constraints of effective cutting width and mirror milling, the tool path is generated, and then the tool position data was preliminarily optimized based on the spline curve. On this basis, the tool axis vector was further optimized, that is, the rotary axis of the machine tool meets the kinematic performance of each axis of the machine tool, and by optimizing the feed rate of the machine tool, the minimum sum of the motion fluctuations of the rotary axis and the processing time was used as the optimized target to establish a model. Finally, the validity of the method presented in this paper has been demonstrated by simulation and experiments of thinwalled workpieces. In addition, by comparing the machining area, machining time, and wall thickness error, the proposed method was verified as superior to the previous method.