## 2 Geometric Error of Five-axis CNC Machine Tool
### Establishment of Geometric Error Model of Rotary Axis  
Using the coordinate transformation relationship among the motion axes of the machine tool, X, Y, and Z were used to represent the position coordinates of the tool tip along the three directions in the workpiece coordinate system (WCS), and I, J, and K were used to represent the posture vectors of the tool in WCS. Position expressions \(p=(X,Y,Z,1)^{T}\) of the tool tip and posture \(v=(I,J,K,0)^{T}\) of the tool in an ideal state were established, as stated in Equations (1) and (2):  
\[p_{1}=\left[T(x)\cdot T(y)\cdot T(z)\right]^{-1}\cdot R(a)\cdot R(c)\cdot p_{2} \tag{1}\]  
\[v_{1}=\ R(a)\cdot R(c)\cdot v_{2} \tag{2}\]  
where  
\[T(x)\cdot T(y)\cdot T(z)=\left[ \begin{array}{cccc}1&0&0&x\\ 0&1&0&y\\ 0&0&1&z\\ 0&0&0&1\end{array} \right],R(a)=\left[ \begin{array}{cccc}1&0&0&0\\ 0&\cos(a)&-sin(a)&0\\ 0&sin(a)&\cos(a)&0\\ 0&0&0&1\end{array} \right]R(c)=\left[ \begin{array}{cccc}cos(c)&-sin(c)&0&0\\ sin(c)&\cos(c)&0&0\\ 0&0&1&0\\ 0&0&0&1\end{array} \right]\]  
When the starting position of tool tip was \(p_{1}\) = (0,0,0,1)\({}^{T}\), and the starting posture of the tool was \(v_{1}\) = (0,0,1,0)\({}^{T}\). The tool position and posture under ideal conditions could be obtained through coordinate transformation, as expressed in Equations (3) and (4):  
\[p=R(-c)\cdot R(-a)\cdot T(x)\cdot T(y)\cdot\ T(z)\cdot p_{1} \tag{3}\]  
\[v=R(-c)\cdot R(-a)\cdot v_{1}. \tag{4}\]  
Equations (3) and (4) were expanded to obtain Equation (5):  
\[\left\{ \begin{array}{l}X=x\cdot\cos(c)+y\cdot\sin(c)\cdot\cos(a)+z\cdot\sin (c)\cdot\sin(a)\\ Y=-x\cdot\sin(c)+y\cdot\cos(c)\cdot\cos(a)+z\cdot\cos(c)\cdot\sin(a)\\ Z=-y\cdot\sin(a)+z\cdot\cos(a)\\ I=\sin(c)\cdot\sin(a)\\ J=\cos(c)\cdot\sin(a)\\ K=\cos(a)\end{array} \right. \tag{5}\]  
Equation (5) gave the tool position and posture in ideal or error-free states in the established WCS. Equation (5) showed that the position of the tool tip (\(X\), \(Y\), and \(Z\)) and posture of tool (\(I\), \(J\), and \(K\)) were functions of translations of straight axes x, y, and z and the rotations a and c of the rotary axis. Under special situations, \(X^{\prime}\), \(Y^{\prime}\), and \(Z^{\prime}\) were used to represent the actual position coordinates of the tool tip along the three directions in WCS, and \(I^{\prime}\), \(J^{\prime}\) and \(K^{\prime}\) were employed to represent the actual posture vectors of tool. Due to the geometric error of the rotary axis, error transformation matrices \(E_{A}\) and \(E_{\mathbb{C}}\) of two rotating axes were brought into the solution of the transformation matrix of actual position and posture of tool in WCS, as stated in Equations (6) and (7):  
\[p_{1}=\left[T(x)\cdot T(y)\cdot T(z)\right]^{-1}\cdot T_{EA}\cdot R_{EA}\cdot R (a)\cdot T_{\mathbb{C}}(A_{i})\cdot R_{EC}(A_{i})\cdot R(c)\cdot p_{2} \tag{6}\]  
\[v_{1}=R_{EA}\cdot R(a)\cdot R_{EC}(A_{i})\cdot R(c)\cdot v_{2} \tag{7}\]  
where \(E_{A}\) and \(E_{\mathbb{C}}\) were obtained by assuming small errors and ignoring higher order terms. \[E_{A}=T_{EA}\cdot R_{EA}\approx\left[ \begin{array}{cccc}1&-\varepsilon_{Y \lambda}&\varepsilon_{PA}&\delta x_{A}\\ \varepsilon_{Y\lambda}&1&-\varepsilon_{EA\lambda}&\delta y_{A}\\ -\varepsilon_{PA}&\varepsilon_{\alpha\lambda}&1&\delta z_{A}\\ 0&0&0&1\end{array} \right]E_{C}=T_{EC}(A_{i})\cdot R_{EC}(A_{i})\approx\left[ \begin{array}{cccc}1&-\varepsilon_{Y\lambda}(A_{i})&\varepsilon_{F\lambda}(A_ {i})&\delta x_{C}(A_{i})\\ \varepsilon_{Y\lambda}(A_{i})&1&-\varepsilon_{\alpha\lambda}(A_{i})&\delta y_{C }(A_{i})\\ -\varepsilon_{F\lambda}(A_{i})&\varepsilon_{\alpha\lambda}(A_{i})&1&\delta z_{C }(A_{i})\\ 0&0&0&1\end{array} \right] \tag{8}\]When the starting position of tool tip was \(p_{1}\) = (0,0,0,1)\({}^{T}\), and the starting posture of the tool was \(v_{1}\)=(0,0,1,0)\({}^{T}\). Using coordinate transformation, the position and posture of the tool were obtained in the presence of errors. \[