## 4 Residual Error Optimization Strategy Based on Root-Mean-Square and Peak-to-Valley Maps
### Variable Pitch Spiral Path Planning Method  
In order to realize the optimization process of the spiral polishing path efficiently and quickly, this paper proposes to plan the variable pitch spiral polishing path on a two-dimensional plane. Moreover, the path pitch along the radial direction of the spiral path is iteratively optimized according to the proposed path spacing optimization model in Section 4.2. At the same time, when the variable pitch 2D path is projected onto a 3D target surface, in order to avoid as much as possible the impact of slope change on the pitch of the projected path, a path spacing compensation factor based on the gradient change distribution of the target surface is introduced. After several iterative optimizations, the final variable pitch spiral-polishing path with seamless transition will be obtained. Figure 7a gives the complete planning flowchart for the optimized path with variable pitch. Although practical fluid jet polishing is hardly affected by the polishing edge effect [21], the edge-up phenomenon occurs when performing polishing removal simulations, which is a common problem that is difficult to avoid when solving the dwell time [22; 23]. In this algorithm, to avoid the influence of this phenomenon on the solution in the region of interest, the polished surface and its form error will extend outward by a specified distance, and so does the planned polishing path, as shown in Figure 7b. Through several simulation experiments, it was found that when the extension distance is specified as \(1.5R_{tif}\), the influence of the edge-up phenomenon on the region of interest can be effectively avoided and a better removal effect obtained. In this algorithm, we first determine the range of path spacing changes according to Equation (7) and give the corresponding path optimization model specified by Equations (5) or (6). Then, the initial planned Archimedes spiral path can be given by Equation (8) as follows:  
\[\left\{ \begin{array}{l}r_{0}=0.075R_{tif};p_{0}=P_{\min};\theta_{m}=m\Delta \theta,m=0,\ldots,M\\ M=\text{INT}\left(\frac{2\pi R_{\max}}{\Delta\theta P_{0}}\right);r_{m}=r_{0}+ p_{0}\times\frac{\theta_{m}}{2\pi}\end{array} \right. \tag{8}\]  
where \(\gamma_{0}\) represents the starting spiral radius; \(p_{0}\) represents the pitch of the Archimedean spiral path; \(\Delta\theta\) represents the angular coordinate increment of adjacent path points in the initial planned path; \(R_{\max}\) represents the limit of the radius of the circular area of the initial planned Archimedes spiral path; INT represents the operation of rounding down. For a rectangular workpiece and a circular workpiece, Equation (9) gives the calculation method of \(R_{\max}\) in two cases. The initial Archimedes spiral path bounded by the maximum radius calculated by Equation (9) can ensure fast convergence of the iterative optimization process. \(\theta_{m}\), \(r_{m}\) represent the angular coordinate and radial coordinate of the \(m\)-th path point of the initially planned path in polar coordinates, respectively. \[\left\{ \begin{array}{l}R_{\max}=\sqrt{\left(\frac{L_{x}+3R_{if}}{2}\right)^ {2}+\left(\frac{L_{y}+3R_{if}}{2}\right)^{2}},\text{for rectangular shape}\\ R_{\max}=\frac{2R+3R_{if}}{2},\text{for circular shape}\end{array} \right. \tag{9}\]  
in which \(L_{x}\), \(L_{y}\) represent the length and width of the original rectangular workpiece, respectively, and \(R\) represents the radius of the original circular workpiece. The algorithm extracts the boundary curve of the projection of the target surface on the \(xoy\) plane, and the new curve obtained by offsetting the distance of 1.5\(R_{if}\) outward is used as the constraint boundary of the subsequent path planning.