## 3 Robot Error Prediction and Accuracy Compensation Method
### Spatial-Interpolation-Based Unbiased Error Estimation Method with Joint Weights Optimization  
The x-, y-, and z-axis error components are treated as three independent features in configuration space, and, for each, a spatial-interpolation-based unbiased error estimate model is constructed. Taking the x-axis error component \(e_{x}\) as an example, the joint angle distances \(\mathbf{H}\) for all elements of \(\mathbf{Q}^{std}\) are first calculated and divided into equal-interval regions for semivariogram calculation, as shown in Equations (12) and (13). Then, the Gaussian semivariogram function for a distance \(h\) of any two joint angles is defined as  
\[\gamma(h)=Cn+Cs\left(1-\exp\left(-3h^{2}/Cr^{2}\right)\right),h\in\mathbf{H} \tag{14}\]  
where \(Cn\) is the nugget effect, \(Cs\) is the sill parameter, and \(Cr\) is the range parameter. During the model training process, initial values for the semivariogram parameters \(Cn\), \(Cs\), and \(Cr\) are defined, and the least squares method is used to fit the semivariogram parameters by minimizing the difference between the empirical semivariance obtained from Equation (13) and the model semivariance. Then, the covariance matrix \(\mathbf{C}\) of the sampling point errors is calculated as  
\[\mathbf{C}=\{C_{ij}|C_{ij}=(\sigma^{error})^{2}\exp\left(-\frac{3\left(\left\|\mathbf{ Q}_{i}-\mathbf{Q}_{j}\right\|\right)^{2}}{{\rm{C_{r}}}^{2}}\right),0\leq i,j<n\} \tag{15}\]  
where \((\sigma^{error})^{2}\) is the variance of the robot errors distributed in configuration space. In the error prediction process for the target joint angles \(\mathbf{Q}_{target}\), the covariance vector \(\mathbf{c}\) between \(\mathbf{Q}_{target}\) and the sampling points is first calculated as  
\[\mathbf{c}=\{c_{i}|c_{i}=(\sigma^{error})^{2}\exp\left(-\frac{3\left(\left\|\mathbf{ Q}_{target}-\mathbf{Q}_{i}\right\|\right)^{2}}{{\rm{C_{r}}}^{2}}\right),0\leq i<n\} \tag{16}\]  
Subsequently, the unbiased estimation error weights \(\mathbf{w}_{error}\) for the errors at \(\mathbf{Q}_{target}\) is calculated by solving the equation  
\[\mathbf{w}_{error}=(\mathbf{C}+\lambda\mathbf{I})^{-1}\mathbf{c} \tag{17}\]  
Finally, the unbiased estimation value \(\mathbf{e}_{x}^{target}\) for the x-axis error component is obtained as follows:  
\[\mathbf{e}_{x}^{target}=\mathbf{w}_{error}^{T}\mathbf{e}_{x}^{std} \tag{18}\]  
Utilizing the spatial-interpolation-based unbiased estimation method, as shown in Equations (14)-(18), separately to the x-, y-, and z-axis error components, the robot error prediction model for any target joint angles \(\mathbf{Q}_{target}\) is denoted as  
\[\mathbf{E}^{target}=F\left(\mathbf{Q}_{target}\right) \tag{19}\]Due to the significant anisotropy in the distribution of robot errors across each joint dimension in configuration space and the notable differences among the x-, y-, and z-axis error components, the construction of the error model for each error component must consider the distribution characteristics of the error component across the six joint dimensions. This approach involves enhancing the dimensions with significant spatial similarity and weakening those with strong nugget effects that may introduce random noise, which will significantly improve the prediction accuracy of the error model. A method for unbiased estimation using configuration space interpolation with joint weights optimization is proposed to achieve higher precision in robot error prediction. Taking the calculation process of the x-axis error component estimate as an example, a set of joint weights \(\mathbf{W}_{x}=\{w_{1},w_{2},w_{3},w_{4},w_{5},w_{6}\}\in\mathbb{R}^{6}\) is defined, and the standard joint angles \(\mathbf{Q}^{std}\) are first weighted using \(\mathbf{W}_{x}\):  
\[\mathbf{Q}^{weighted}=\mathbf{Q}^{std}\;diag(\mathbf{W}_{x}) \tag{20}\]  
In this process, some dimensions of the joint angles can be amplified or reduced based on \(\mathbf{W}_{x}\) to better adapt to the anisotropic distribution of positioning errors in configuration space.