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

Fig. 1
figure 1

Mirror milling system

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.

Fig. 2
figure 2

Overall processing flow chart

2 Kinematic transformation of the mirror milling system

Mirror milling is a mirror-synchronized motion of dual five-axis. 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 C1-A1 double swing head structure machine tool, and there are travel constraints on the rotation axes A1 and C1, which are [− 90°, 90°] and [− 360°, 360°], respectively. The support side is a B2-A2 double swing head structure, and the travel constraints of the rotation axes A2 and B2 are [− 65°, 65°] and [− 65°, 65°], respectively. Shown in Fig. 3 are the model of the machine tool and its transmission chain in the process of mirror milling of thin-walled parts where OwXwYwZw is the coordinate system of the workpiece in the initial state, Ot1Xt1Yt1Zt1 is the coordinate system position of the tool movement on the milling side during the machining process, and Om1Xm1Ym1Zm1 is the position of the rotary coordinate system of the tool movement on the milling side during the machining process. Correspondingly, Ot2Xt2Yt2Zt2 is the position of the driving point coordinate system of the support side during the movement process, and Om2Xm2Ym2Zm2 is the rotary coordinate system of the support side.

Fig. 3
figure 3

Machine simulation model and kinematic chain for mirror milling

2.1 C1-A1 milling side machine kinematics conversion

The milling side is a C1-A1 five-axis double swing head structure machine tool, and the rotation axes of the milling side are recorded as A1 and C1, 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

$$\left[\begin{array}{c}i\\ j\\ k\end{array}\right]=\left[\begin{array}{c}{\mathrm{sinA}}_{1}{\mathrm{sinC}}_{1}\\ -{\mathrm{sinA}}_{1}{\mathrm{cosC}}_{1}\\ {\mathrm{cosA}}_{1}\end{array}\right]$$
(1)

According to the vector expression of the cutter axis on the milling side, the solutions of the angles A1 and C1 can be obtained through the inverse kinematics transformation of the milling side:

$$\left.\begin{array}{c}A_1=k_{A1}\cdot\arccos(\mathrm k)\\C_1=\arctan\left(\frac i{-j}\right)+k_{C1}\pi\end{array}\right\}$$
(2)

In the equation, the value range of A1 is \([-90^\circ ,90]\), and the value range of C1 is \([-360^\circ ,360^\circ ]\), \({k}_{A1}=\pm 1\), \({k}_{C1}=0\), or \({k}_{C1}=\pm 2\).

According to Eq. (2), k determines the amount of change in the rotation axis A1, while i and j determine the amount of change in the rotation axis C1. 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.

Fig. 4
figure 4

Solving for rotation axes A1 and C1

From Fig. 4, it can be analyzed that there are two groups of corresponding basic solutions, \(({A}_{11},{C}_{11})\) and \(({A}_{12},{C}_{12})\) or \(({A}_{11},{{C}_{11}}^{^{\prime}})\) and \(({A}_{12},{{C}_{12}}^{^{\prime}})\), and \({A}_{11}+{A}_{12}=0^\circ\), \({C}_{11}-{C}_{12}=\pm 180^\circ\) in the range of \({A}_{1}\in [90^\circ ,90^\circ ]\) and \({C}_{1}\in [-180^\circ ,180^\circ ]\) for the rotation axis, while in the actual solution process, the value range of the rotation axis C1 is \([-360^\circ ,360^\circ ]\), one more cycle than the interval where the basic solution C1 axis is located, so there are two more sets of solutions for the C1 axis, and finally there are four sets of solutions for the A1 and C1 angles.

2.2 B2-A2 structural machine tool kinematics transformation

The support side is a double head pivoting machine B2-A2, and the rotation amount of its rotating shaft is recorded as A2 and B2, respectively. Then, on the support side in the mirror milling process, the expression of the tool axis vector \({(i,j,k)}^{T}\) is

$$\left[\begin{array}{c}i\\ j\\ k\end{array}\right]=\left[\begin{array}{c}\mathrm{cos}{A}_{2}\mathrm{sin}{B}_{2}\\ \mathrm{sin}{A}_{2}\\ \mathrm{cos}{A}_{2}\mathrm{cos}{B}_{2}\end{array}\right]$$
(3)

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=\pm 1\), the solutions for angles A2 and B2 are obtained as

$$\left.\begin{array}{c}{A}_{2}=\mathrm{arcsin}(j)\\ {B}_{2}=undefined\end{array}\right\}$$
(4)

Then, when \(j=\pm 1\), the obtained solutions of the A2 and B2 angles are

$$\begin{array}{c}{A}_{2}=\mathrm{arcsin}(j)\\ {B}_{2}=\mathrm{arctan}\left(\frac{i}{k}\right)+{k}_{B2}\pi \end{array}$$
(5)

The value range of \({A}_{2}\) is \([-65^\circ ,65^\circ ]\), and the value range of B2 is \([-360^\circ ,360^\circ ]\), \({k}_{B2}=0\), or \({k}_{B2}\pm 2\). For the multi-solution problem of the rotation axis, the inverse trigonometric function image is also used to solve the problem, as shown in Fig. 5.

Fig. 5
figure 5

Solving for rotation axes A2 and B2

According to Fig. 5, during the mirror milling process, there are two groups of corresponding basic solutions, \(({A}_{21},{B}_{21})\) and \(({A}_{22},{B}_{22})\) or \(({A}_{21},{{B}_{21}}^{^{\prime}})\) and \(({A}_{22},{{B}_{22}}^{^{\prime}})\), and \({B}_{21}-{B}_{22})=\pm 180^\circ\) within the range satisfying \(\in [-65^\circ ,65^\circ ]\) and \({B}_{2}\in [-180^\circ ,180^\circ ]\) for the rotation axis on the support side, while in the actual solution process the value range of the middle rotation axis B2 is \([-360^\circ ,360^\circ ]\), which is one cycle longer than the range where the B2 axis of the base solution is located. Therefore, there are two additional series of solutions for the B2 axis. Finally, there are four sets of solutions for the A2 and B2 angles.

3 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,\({P}_{i}({x}_{i},{y}_{i},{z}_{i},{i}_{i },{j}_{i},{k}_{i})\), 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.

3.1 Workpiece geometry

A series of point cloud data,\({D}_{m}({x}_{m},{y}_{m},{z}_{m},{i}_{m },{j}_{m},{k}_{m})\), is exported from the obtained digital model to be processed in CATIA, as shown in Fig. 6 below.

Fig. 6
figure 6

Point cloud data

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

$$z={a}_{1}x+{a}_{2}y+{a}_{3}{x}^{2}+{a}_{4}{y}^{2}+{a}_{5}xy+{a}_{6}$$
(6)
$$A=\left[\begin{array}{l}\begin{array}{ccc}{x}_{1}& {y}_{1}& \begin{array}{ccc}{x}_{1}^{2}& {y}_{1}^{2}& \begin{array}{cc}{x}_{1}{y}_{1}& 1\end{array}\end{array}\end{array}\\ \begin{array}{ccc}{x}_{2}& {y}_{2}& \begin{array}{ccc}{x}_{2}^{2}& {y}_{2}^{2}& \begin{array}{cc}{x}_{2}{y}_{2}& 1\end{array}\end{array}\end{array}\\ \begin{array}{c}\begin{array}{ccc}\vdots & \vdots & \begin{array}{ccc}\vdots & \vdots & \begin{array}{cc}\vdots & \vdots \end{array}\end{array}\end{array}\\ \begin{array}{ccc}{x}_{m}& {y}_{m}& \begin{array}{ccc}{x}_{m}^{2}& {y}_{m}^{2}& \begin{array}{cc}{x}_{m}{y}_{m}& 1\end{array}\end{array}\end{array}\end{array}\end{array}\right],X=\left[\begin{array}{c}{a}_{1}\\ {a}_{2}\\ \begin{array}{c}{a}_{3}\\ {a}_{4}\\ \begin{array}{c}{a}_{5}\\ {a}_{6}\end{array}\end{array}\end{array}\right],L=\left[\begin{array}{c}{z}_{1}\\ {z}_{2}\\ \begin{array}{c}\vdots \\ {z}_{m}\end{array}\end{array}\right]$$
(7)

In Eq. (7), A is the coefficient matrix of m × (m + 1), L is the observation value vector of m × 1, and X is the model parameter vector to be solved. Then, the equation can be written in the form of solving the least squares adjustment equation, and the adjustment effect is performed by MATLAB, as shown in Fig. 7.

Fig. 7
figure 7

Point cloud fitting renderings

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

Fig. 8
figure 8

Tool path design

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.

Fig. 9
figure 9

Effective cutting conditions

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:

$$r<l<2r$$
(8)

where r is the radius of the bottom edge of the tool.

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

Fig. 10
figure 10

Tool point distribution map

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:

$$\overrightarrow{V}={\overrightarrow{n}}_{z}$$
(9)

In the equation, \(\overrightarrow{V}={({i}_{i},{j}_{i},{k}_{i})}^{T}\) represents the tool axis vector, which belongs to the position of the current tool point; \({\overrightarrow{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 \({Q}_{i}\left({x}_{i}^{^{\prime}},{y}_{i}^{^{\prime}},{z}_{i}^{^{\prime}},{i}_{i}^{^{\prime}},{j}_{i}^{^{\prime}},{k}_{i}^{^{\prime}}\right)\), 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.

Fig. 11
figure 11

Preliminary optimization of tool paths

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}_{i}^{^{\prime}},{y}_{i}^{^{\prime}},{z}_{i}^{^{\prime}})\) and the tool axis vector \(({i}_{i}^{^{\prime}},{j}_{i}^{^{\prime}},{k}_{i}^{^{\prime}})\) of the tool position data while satisfying the Eq. (8) constraints on the cutting step length:

$$F\left({\omega }_{s}\right)={\lambda }_{a}{f}_{a}\left({\omega }_{s}\right)+{\lambda }_{t}{f}_{t}({\omega }_{s})$$
(10)
$$\mathrm{min}\sum_{s,1}^{s,m}F({\omega }_{s})$$
(11)
$$s.t.r<l<2\mathrm{r}$$
(12)

In Eq. (10), \(F({\omega }_{s})\) is the weighted sum of the tool nose point and the tool axis vector smoothness measurement value, \({\lambda }_{a}\) is the tool axis vector smoothing weight, \({\omega }_{s}=[{\omega }_{s,1},\cdots {\omega }_{s,t},\cdots {\omega }_{s,m}]\) is the shape control parameter of the s-th tool path, m is the number of nodes, \({f}_{a}\left({\omega }_{s}\right)\) is the tool axis vector smoothness measurement value, \({\lambda }_{t}\) is the tool nose point smoothing weight, and \({f}_{t}({\omega }_{s})\) is the tool nose point smoothness measurement value, which is generally set to \({\lambda }_{t}>5{\lambda }_{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 \({\omega }_{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 \({\omega }_{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}_{i}^{c},{y}_{i}^{c},{z}_{i}^{c})\) 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 \({P}_{i}^{c}({x}_{i}^{c},{y}_{i}^{c},{z}_{i}^{c},{i}_{i}^{c},{j}_{i}^{c},{k}_{i}^{c})\) of the adjusted curved surface can be obtained according to the following equation:

$$F\left(x,y,z\right)={a}_{1}{x}^{2}+{a}_{2}{y}_{2}+{a}_{3}xy+{a}_{4}x+{a}_{5}y+{a}_{6}$$
(13)
$${F}_{x}^{^{\prime}}=0,{F}_{y}^{^{\prime}}=0,{F}_{z}^{^{\prime}}=0$$
(14)

In Eq. (14), \({F}_{x}^{^{\prime}}\) is \(F\left(x,y,z\right)=0\) for partial derivatives of x, \({F}_{y}^{^{\prime}}\) is for \(F\left(x,y,z\right)=0\) of partial derivatives of y, and \({F}_{z}^{^{\prime}}\) is for \(F\left(x,y,z\right)=0\) of partial derivatives of z. Then, we solve the equation according to the surface normal vector to get \({(i}_{i}^{c},{j}_{i}^{c},{k}_{i}^{c})\)

$$\left\{\begin{array}{c}i_i^c\frac{F'_x}{\left(F_x^{'2}+F_y^{'2}+F_z^{'2}\right)^{0.5}}\\j_i^c\frac{F'_y}{\left(F_x^{'2}+F_y^2+F_x^2\right)^{0.5}}\\k_i^c\frac{F'_z}{\left(F_x^{'2}+F_y^{'2}+F_z^{'2}\right)^{0.5}}\end{array}\right.$$
(15)

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.

Fig. 12
figure 12

Final adjustment of the surface cutter point

4 Tool axis vector optimization under kinematic constraints

For the tool position point \({P}_{i}^{c}({x}_{i}^{c},{y}_{i}^{c},{z}_{i}^{c},{i}_{i}^{c},{j}_{i}^{c},{k}_{i}^{c})\) determined in 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.

4.1 Mirror milling post processing

In combination with Fig. 3 drive chain and the obtained cutter position \({P}_{i}^{c}\), the cutter position on the milling side is expressed as \({-(x}_{i}^{c},{y}_{i}^{c}-{z}_{i}^{c},{i}_{i}^{c}-{j}_{i}^{c},{k}_{i}^{c})\), the offset length from the midpoint of the A1 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 A1 axis to the central position of the C1 axis is \(({L}_{x},{L}_{y},{L}_{z})\). At the same time, the cutter position of the supporting side can be set to \({(x}_{i}^{c},{y}_{i}^{c}{z}_{i}^{c},-{i}_{i}^{c}-{j}_{i}^{c},{-k}_{i}^{c})\), so the offset length from the midpoint of the A2 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 B2 axis to the central position of the C2 axis is \(({L}_{ax},{L}_{ay},{L}_{az})\). Then, the coordinate point data on both sides can be expressed as follows:

$$\left\{\begin{array}{l}X_1=x_i^c-L_x-m_x+\left(L_x+m_x\right)\;cosC_1+\left(m_zsinA_1-L_y-m_ycosA_1\right)\;sinC_1\\Y_1=y_i^c-L_y-m_y+\left(L_x+m_x\right)\;sinC_1+\left(m_ycosA_1-m_zsinA_1+L_y\right)\;cosC_1\\Z_1=z-m_z+m_zcosA_1+m_ysinA_1\end{array}\right.$$
(16)
$$\left\{\begin{array}{l}X_2={-x}_i^c+L_{ax}+L_{tx}-\left(L_{ax}+L_{tx}\right)\;cosB_2-\left(L_{az}+L_{ty}sinA_2+L_{tz}cosA_2\right)\;sinB_2\\Y_2=y_i^c+L_{ty}-L_{ty}cosA_2+L_{tz}sinA_2\\Z_2={-z}_i^c+L_{az}+L_{tz}+\left(L_{ax}+L_{tx}\right)\;sinB_2+\left(L_{az}-L_{ty}sinA_2-L_{tz}cosA_2\right)\;cosB_2\end{array}\right.$$
(17)

In Eqs. (16) and (17), X1, Y1, and Z1 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 X2, Y2, and Z2 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 A1 and C1 on the milling side can be obtained from Eqs. (1) and (2), and the values of the rotary axes A2 and B2 on the support side can be obtained from Eqs. (3), (4), and (5).

4.2 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 A1 and C1 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}_{i}^{c},{j}_{i}^{c},{k}_{i}^{c})\) 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 C1 rotational axis. The specific variation is illustrated in Fig. 13.

Fig. 13
figure 13

Angle of rotation axis C1

In Fig. 13,\({P}_{i-1}^{c}\),\({P}_{i}^{c}\), \({P}_{i+1}^{c}\), and \({P}_{i+2}^{c}\) are four consecutive tool points of a section of the path. The angle between \({OP}_{i}^{c}\) and \(OI\) is the location of the C1 axis. The values of the C1 axis of the four tool points can be expressed as \({O}_{i}^{{c}_{1}}\), \({O}_{i-1}^{{c}_{1}}\), \({O}_{i+1}^{{c}_{1}}\), and \({O}_{i+2}^{{c}_{1}}\), and \({\Delta O}_{i}^{{c}_{1}}\) is the change of the C1 axis from \({P}_{i}^{c}\) to \({P}_{i+1}^{c}\). 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 C1 axis, so the relationship is as follows:

$$\frac{\left|{P}_{i}^{c}-{P}_{i-1}^{c}\right|}{f}=\frac{\left|{\theta }_{i}^{{C}_{1}}-{\theta }_{i-1}^{{C}_{1}}\right|}{{v}_{i}^{{C}_{1}}}$$
(18)

In the equation, \({v}_{i}^{{C}_{1}}\) is the speed of the C1 axis, so the speed of the rotating axis can be calculated according to Eq. (18), and then the acceleration and jerk of the rotating axis can be obtained as follows:

$${v}_{i}^{{C}_{1}}=\frac{\left|{\theta }_{i}^{{C}_{1}}-{\theta }_{i-1}^{{C}_{1}}\right|}{\left|{P}_{i}^{c}-{P}_{i-1}^{c}\right|}f$$
(19)
$${a}_{i}^{{C}_{1}}=\frac{2({v}_{i}^{{C}_{1}}-{v}_{i-1}^{{C}_{1}})}{\left|{P}_{i+1}^{c}-{P}_{i}^{c}\right|/f+\left|{P}_{i}^{c}-{P}_{i-1}^{c}\right|/f}$$
(20)
$${j}_{i}^{{C}_{1}}=\frac{3({a}_{i+1}^{{C}_{1}}-{a}_{i}^{{C}_{1}})}{\left|{P}_{i+2}^{c}-{P}_{i+1}^{c}\right|/f+\left|{P}_{i+1}^{c}-{P}_{i}^{c}\right|/f+\left|{P}_{i}^{c}-{P}_{i-1}^{c}\right|/f}$$
(21)

The kinematic performance parameters obtained by the above equation serve as constraints. Assume that under the kinematic constraints, the maximum angular velocity, maximum angular acceleration, and maximum angular jerk that can be reached by the rotating axis are \({v}_{\mathrm{max}}^{{C}_{1}}\), \({a}_{\mathrm{max}}^{{C}_{1}}\), and \({j}_{\mathrm{max}}^{{C}_{1}}\), respectively. When the machine tool reaches the kinematic performance constraints, the maximum feed rate that the machine tool can achieve can be derived by Eqs. (19), (20), and (21):

$${f}_{v,i}=\frac{\left|{P}_{i}^{c}-{P}_{i-1}^{c}\right|}{\left|{\theta }_{i}^{{C}_{1}}-{\theta }_{i-1}^{{C}_{1}}\right|}{v}_{\mathrm{max}}^{{C}_{1}}$$
(22)
$${f}_{a,i}=\sqrt{\frac{{a}_{\mathrm{max}}^{{C}_{1}}(\left|{P}_{i+1}^{c}-{P}_{i}^{c}\right|+\left|{P}_{i}^{c}-{P}_{i-1}^{c}\right|)}{2\left(\left|{\theta }_{i+1}^{{C}_{1}}-{\theta }_{i}^{{C}_{1}}\right|/\left|{P}_{i+1}^{c}-{P}_{i}^{c}\right|-\left|{\theta }_{i}^{{C}_{1}}-{\theta }_{i-1}^{{C}_{1}}\right|/\left|{P}_{i}^{c}-{P}_{i-1}^{c}\right|\right)}}$$
(23)
$${f}_{j,i}=\left\{\left[{j}_{max}^{{C}_{1}}\left(\left|{P}_{i+2}^{c}-{P}_{i+1}^{c}\right|+\left|{P}_{i+1}^{c}-{P}_{i}^{c}\right|+\left|{P}_{i}^{c}-{P}_{i-1}^{c}\right|\right)\right]/\left[6\left(\left|{P}_{i+1}^{c}-{P}_{i}^{c}\right|\left|{\theta }_{i+2}^{{C}_{1}}-{\theta }_{i+1}^{{C}_{1}}\right|-\left|{P}_{i+2}^{c}-{P}_{i-1}^{c}\right|\left|{\theta }_{i+1}^{{C}_{1}}-{\theta }_{i}^{{C}_{1}}\right|\right)\left(\left|{P}_{i+1}^{c}-{P}_{i}^{c}\right|+\left|{P}_{i}^{c}-{P}_{i-1}^{c}\right|\right)-\left(\left|{P}_{i}^{c}-{P}_{i-1}^{c}\right|\left|{\theta }_{i+1}^{{C}_{1}}-{\theta }_{i}^{{C}_{1}}\right|-\left|{P}_{i+1}^{c}-{P}_{i}^{c}\right|\right)\left|{\theta }_{i}^{{C}_{1}}-{\theta }_{i-1}^{{C}_{1}}\right|\right]\right\}$$
(24)

The \({f}_{v,i}\),\({f}_{a,i}\), and \({f}_{j,i}\) in Eqs. (22), (23), and (24) are the maximum feed rates that the rotation axis C1 reaches under the constraints of the machine tool kinematics performance. To ensure efficient treatment, the optimal feed rate is selected while respecting the kinematic performance constraints of the A1 and C1 axes. The feed rate can be obtained by the following equation:

$${f}_{\mathrm{max},{\theta }_{C1}}=\mathrm{min}[{f}_{v,i},{f}_{a,i},{f}_{j,i}]$$
(25)

In the same way, the optimal feed rate \({f}_{\mathrm{max},{\theta }_{A1}}\) of the rotary axis A1 can be obtained. Because the rotation axes A1 and C1 have a certain correlation in the movement process, the final selected machine tool feed rate can be expressed as:

$${f}_{\mathrm{max}}=\mathrm{min}[{f}_{\mathrm{max},{\theta }_{A1}},{f}_{\mathrm{max},{\theta }_{C1}}]$$
(26)

4.3 Multi-objective tool axis vector optimization

Since the variation of the axes A1 and C1 of each cutter location is different, the variation of the axis A1 of some cutter locations is larger; at the same time, the variation of the axis C1 of some cutter locations is larger, so the fluctuation of the axes A1 and C1 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 of the mirror milling machine, the following constraints are established based on both:

$$\left\{\begin{array}{l}v_{i}^{\theta}\leq\left|v_{\max}^{\theta}\right|\\a_{i}^{\theta}\leq\left|a_{\max}^{\theta}\right|\\\begin{array}{l}j_{i}^{\theta}\leq\left|j_{\max}^{\theta}\right|\\\theta\in rotation\;axis\;variation\;range\;space\end{array}\end{array}\right.$$
(27)

In Eq. 27, \({v}_{i}^{\theta }\) is the angular velocity at any rotation axis, \({a}_{i}^{\theta }\) is the angular acceleration of any rotation axis, \({j}_{i}^{\theta }\) is the angular jerk of any rotation axis, \({v}_{\mathrm{max}}^{\theta }\) is the maximum angular velocity of the corresponding rotation axis, \({a}_{\mathrm{max}}^{\theta }\) is the maximum angle of the corresponding rotation axis acceleration, and \({j}_{\mathrm{max}}^{\theta }\) 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}+\nabla\), and \(\nabla\) is the iteration of time change. Therefore, the objective function of tool axis vector optimization is

$$\left\{\begin{array}{cc}\min&\sum\limits_i\left|v_{i,ori}^\theta-v_{i,opt}^\theta\right|\\\min&\sum\limits_i\left|a_{i,ori}^\theta-a_{i,opt}^\theta\right|\\\min&\sum\limits_i\left|j_{i,ori}^\theta-j_{i,opt}^\theta\right|\\s.t.&t_i\leq T_i\leq t_i+\nabla\end{array}\right.$$
(28)

In Eq. (28), \({v}_{i,ori}^{\theta }\) is the original angular velocity of the rotating shaft, \\({v}_{i,opt}^{\theta }\) is the optimized angular velocity of the rotating shaft, \({a}_{i,ori}^{\theta }\) is the original angular acceleration of the rotating shaft, \({a}_{i,opt}^{\theta }\) is the optimized angular acceleration of the rotating shaft, and \({j}_{i,opt}^{\theta }\) is the original angle of the rotating shaft. \({j}_{i,opt}^{\theta }\) is the optimized angular jerk, and \({T}_{i}\) is the optimized rotation axis change time.

Due to the linkage relationship between the rotation axes A1 and C1, 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 A1 and C1 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.

Fig. 14
figure 14

Flowchart of two optimizations

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

Fig. 15
figure 15

Mirror milling experiment platform

The workpiece material used in this paper is the TC4 titanium alloy, the rigidity of the workpiece is poor, the size of the workpiece is 1000 mm × 800 mm, and the arch height of the workpiece is 100 mm. The cutter used in this paper is a flat-bottomed milling cutter with a diameter of 16 mm and a fillet radius of 3 mm. The material of the cutter is cemented carbide and the number of cutting edges is 4. The clamping mode of the cutter is a spring shank. The wear condition of the cutter is good, and the movement accuracy of the mirror milling machine tool is 0.02 mm. The experimental parameters are shown in Table 1.

Table 1 Experimental parameters

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 A1 and C1 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 A1 axis is \([-0.20^\circ /s,0.20^\circ /s]\), the angular acceleration limit of the A1 axis is \([-2.35^\circ /{s}^{2},2.35^\circ /{s}^{2}]\), the angular jerk limit of the A1 axis is \([-10.35^\circ /{s}^{3},10.35^\circ /{s}^{3}]\), the angular velocity limit of the C1 axis is \([-1.20^\circ /s,1.20^\circ /s]\), the angular acceleration limit of the C1 axis is \([-8.05^\circ /{s}^{2},8.05^\circ /{s}^{2}]\), and the angular jerk limit of the C1 axis is \([-35.75^\circ /{s}^{3},35.75^\circ /{s}^{3}]\). The optimization goal is to minimize the sum of the motion fluctuation values of the rotary axis and the minimum tool travel time, as shown in Eq. (28), which constrains the kinematic parameters of the rotary axis within a given range, as shown in Figs. 17 and 18.

Fig. 16
figure 16

Workpiece geometry

Fig. 17
figure 17

Velocity, acceleration, and jerk profiles of the A1 axis

Fig. 18
figure 18

Velocity, acceleration, and jerk profiles of the C1 axis

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 A1 and C1 axes, as shown in Figs. 20 and 21.

Fig. 19
figure 19

Machining surface comparison

Fig. 20
figure 20

Unit change of rotation axis A1

Fig. 21
figure 21

Unit change of rotation axis C1

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 C1 axis after optimization is more obvious than that in the rotation axis A1, so the optimized rotation axis C1 has a higher proportion in the optimization process, and the maximum unit arc length C1 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.

Table 2 Comparison of experimental results

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.

6 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 thin-walled 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.