1 Introduction

Multi-axis computer numerical control (CNC) machine tools are currently widely used to manufacture parts with complex features. The part quality mainly depends on the machining accuracy of the CNC machine tools, which is affected by the tool errors. By measuring and compensating various geometric errors of CNC machine tools, it is possible to improve their performance.

Geometric errors are one of the critical factors responsible for machine tool errors and are divided into two categories: position-dependent geometric errors (PDGEs) and position-independent geometric errors (PIGEs). The former, PDGEs, are mainly caused by the defects of the components, while the latter, PIGEs, are caused by the part-dependent machining errors and the assembly errors. In the error modeling process, PIGEs are treated as constants and remain constant regardless of the position changes. In a three-axis machine tool scenario, the PIGEs of the translational axes are mainly the squareness errors between the three translational axes. That means the difference between the reference straight line inclination of the functional point trajectory (reference trajectory) in a linear moving component with respect to its corresponding principal axis, and about the reference trajectory of another linear moving component with respect to its corresponding linear motion principal axis [1].

The machine tool geometric errors are generally caused by the dimensional errors, shape errors of the components in the tool kinematics chain, and the misalignment of their position references [2]. Aiming to establish an accurate mathematical relationship between the basic error terms of each machine tool component and the final machining error, it is necessary to model the geometric errors systematically. Various modeling methods were developed to mitigate the problem, such as Homogeneous Transformation Matrices (HTMs), Denavit-Hartenberg (D-H) matrix, screw theory, and product of exponential (POE). Kim et al. [3] analyzed the linear displacement, rotation, and squareness errors of the machine tool translational axes and established the corresponding geometric error model. The authors applied the fourth-order homogeneous error matrix based on the small-angle hypothesis. Chen et al. [4] established the volume error model of the five-axis machine tool based on rigid body kinematics and HTMs. Jiang et al. [5] used the HTMs to establish a comprehensive error model for a five-axis machine tool to represent its PIGEs. It can be concluded that most of the modeling methods are based on rigid body kinematics and HTMs. However, in order to apply those methods, it is necessary to define the local coordinate system for each axis, making the modeling very tedious. Thus, it is important to establish a universal geometric error model in the global coordinate system to improve the modeling method generality.

The screw theory based on Chasles’ theorem [6] is a mathematical tool used to simulate the CNC machine tool kinematics. The typical screw theory calculation method is the result of the exponential formula. The kinematics model based on the screw theory is also known as the method based on POE. The advantage of the screw theory method is that it can describe the rigid body motion globally, meaning that there is no need to establish a local coordinate system (as in the HTMs method). Building on the screw theory, Moon et al. [7] proposed an inverse Jacobian matrix approximate error compensation method to compensate for the machine tools error. Fu et al. [8] used a calculation method based on the POE to predict the five-axis machining errors caused by geometric errors; the resulting research is of great significance for geometric error modeling using the POE theory. For this reason, this paper aims to identify the machine tool squareness errors by using the POE theory to establish the machine tools model.

There are many methods available to measure the machine tool errors, mainly including both the direct and indirect measurements. Additionally, some of the methods were developed to measure geometric errors. The direct measuring instruments include the high-precision linear encoder [9], step gauges [10], and laser interferometers [11]. Their indirect counterparts are R test [12], double ball bar (DBB) [5], cutting test pieces [13], and SAMBA [14]. Due to their higher efficiency, indirect measurement methods have received more attention in recent years. Weikert [15] used R test equipment to measure the three-dimensional error along the circular or spherical path. The errors were separated from the rotation axes and then used to estimate the five-axis machine error. Fu et al. [8] used laser interferometers to measure both the CNC machine tool squareness errors and the squareness errors between the translational axes. However, adjusting the optical paths is a lengthy process, requiring expertise in setting the laser measurement accessories. Guo [16] used Renishaw checking gauge to detect the squareness errors in the XY and YZ CNC machine tool planes. The squareness error can be evaluated with a single measurement, but the positioning process accuracy and efficiency can make the method time consuming. Hong et al. [17] used R test equipment to perform the error identification of both the rotational and translational axes. However, the errors between these two axes had to be separated. Xing et al. [14] used the SAMBA to measure the positioning errors of the translational axis, but the measurement process lasted 194 min and required repeated testing. Jiang et al. [5] used the DBB to measure the PIGEs of rotational axes. Xu [18] identified the 18 PDGEs of the translational axis by non-integer exponential method using DBB. However, in the experiment process, the experimental data is obtained by using different DBB lengths and adjusting the installation angle many times. This undoubtedly affects the obtained data and cannot directly indicate the correctness of the recognition results, which is an indirect reference. Finally, Lee et al. [19] used the DBB to measure the spherical deviation and squareness errors.

The demand for CNC machine tools testing is increasing. Some other equipment needs to be measured in steps. For example, the laser interferometer needs to be repeatedly installed to measure the errors of the machine tool [11, 20]. Li [21] measured the geometric errors of the translational axes by using the 13-line method through the laser interferometer. However, the process is complicated and requiring operational specialties. Additionally, a laser tracker is a good means of testing the dynamic performance of a CNC machine tool. Nonetheless, the testing results need to be more accurate compared with the machine tool resolution. DBB is widely used in the diagnostic testing of CNC machine tools, mostly due to its simple structure and straightforwardness, thus simplifying the testing process. For this reason, this article uses the DBB for experimental measurement. In the past, the squareness error measurement mostly used the method of two parallel motions of three translational axes. The required measurements were then performed in the plane trajectory, which is a circular error [19]. In order to better illustrate the impact of machine tool errors on the accuracy, the authors have presented a novel test condition, aiming to simplify the measurement experiment. Through one experimental setting, the three translational axes are linked to perform error identification in the spherical trajectory, meaning that three CNC machine tool squareness errors can be identified at one time. The joint movement of the three translation axes was proven to have sufficient influence on the tool accuracy. Thus, when using the DBB for error detection, it is necessary to solve the DBB acquisition rate and machine tools operation asynchronicity. Only when synchronous and coordinated motion is achieved, the data is considered valid. This article adopts the coordinate transformation method and the method for dividing experimental path evenly. Finally, the acquisition rate is synchronized with the machine tool operation, guaranteeing the data validity.

In this study, a novel method for measuring the squareness error is proposed. It is different from the previously known circular path–based method as the tool moves together with three translational axes under the spherical trajectory. The second section briefly introduces the POE model; based on the POE error definition method, a CNC machine tool error model is established. The experimental design, including the installation of DBB, is presented in the third section. The experimental path and the error solution are proposed in the same section. In the fourth part, the NC compensation method is used to correct the tool path trajectory, aiming to verify the three squareness errors obtained in the spherical spiral path. Finally, the conclusions are presented in the fifth section.

2 Machine tool error modeling

2.1 Target machine tool

The machine tool used in the experiment (please see Fig. 1) has three translational (X, Y, and Z) and two rotation axes (B and C). The machine bed is connected to the Z-axis and X-axis, while the B-axis is located above the Y-axis. Finally, the C-axis is located above the Z-axis.

Fig. 1
figure 1

Solid model of a five-axis CNC machine tool

The CNC machine tool includes two kinematic chains: the workpiece and the tool chain. The global coordinate system is established and positioned on the workbench (Fig. 2). The tool kinematic chain is bed—X-axis—Y-axis—B-axis—tool, while the machine tool kinematic chain is bed—Z-axis—C-axis—workpiece. In this paper, the B- and C-axes of the machine tool remain static, meaning that only the translational axis errors will be considered.

Fig. 2
figure 2

Target five-axis CNC machine tool topology

2.2 Basic theory of the POE model

The kinematic machine tool modeling based on POE is presented in this subsection. A movement of the rigid body moving between two positions can be divided into two parts: rotation and translation. Thus, the twist \( \hat{\xi} \) can be used to represent the motion of a rigid body:

$$ \hat{\xi}=\left[\begin{array}{cc}\hat{\omega}& v\\ {}0& 0\end{array}\right] $$
(1)

where v = [v1v2v3]T, \( \hat{\omega} \) is a skew-symmetric matrix. If \( \omega ={\left[{\omega}_1\kern0.5em {\omega}_2\kern0.5em {\omega}_3\right]}^T \), then the twist \( \hat{\xi} \) can be expressed as:

$$ \hat{\xi}=\left[\begin{array}{cc}\begin{array}{c}0\\ {}{\omega}_3\end{array}& \begin{array}{c}-{\omega}_3\\ {}0\end{array}\\ {}\begin{array}{c}-{\omega}_2\\ {}0\end{array}& \begin{array}{c}{\omega}_1\\ {}0\end{array}\end{array}\kern0.5em \begin{array}{cc}\begin{array}{c}{\omega}_2\\ {}-{\omega}_1\end{array}& \begin{array}{c}{v}_1\\ {}{v}_2\end{array}\\ {}\begin{array}{c}0\\ {}0\end{array}& \begin{array}{c}{v}_3\\ {}1\end{array}\end{array}\right] $$
(2)

Furthermore, a six-dimensional twist vector coordinate can also be given to represent a twist:

$$ \xi ={\left[{\omega}^T\kern0.5em {v}^T\right]}^T={\left[\begin{array}{cc}\begin{array}{ccc}{\omega}_1& {\omega}_2& {\omega}_3\end{array}& \begin{array}{ccc}{v}_1& {v}_2& {v}_3\end{array}\end{array}\right]}^T $$
(3)

As noted earlier, when using a twist to represent the motion, both the rotation and translation are included. The variable ω represents the direction vector of the rotation axis, while v represents the position vector of the translation axis relative to the reference system. Finally, ξ is used to represent the unit twist transformation.

The twisted exponential matrix is a common homogeneous transformation matrix, represented by variable T; usually \( T={e}^{\hat{\xi}\theta } \), where θ is the amount of exercise. If ω = 0, the rigid body has only translational movement, and its transformation matrix can be expressed as:

$$ T={e}^{\hat{\xi}\theta }=\left[\begin{array}{cc}{I}_{3\times 3}& v\theta \\ {}0& 1\end{array}\right] $$
(4)

where the matrix I3 × 3 is the identity matrix. If ω ≠ 0, a rotational motion exists and the transformation matrix can be expressed as follows:

$$ {e}^{\hat{\xi}\theta }=\left[\begin{array}{cc}{e}^{\hat{\omega}\theta }& \left({I}_{3\times 3}-{e}^{\hat{\omega}\theta}\right)\left(\omega \times v\right)+\omega {\omega}^T v\theta \\ {}{0}_{1\times 3}& 1\end{array}\right] $$
(5)

For the analysis of the kinematic mechanism position, Eqs. 4 and 5 are used to represent the unit twist transformation. When ω ≠ 0, \( \theta =\sqrt{{\omega_1}^2+{\omega_2}^2+{\omega_3}^2} \) is used to represent the rigid body rotation angle. On the other hand, if ω = 0, \( \theta =\sqrt{{v_1}^2+{v_2}^2+{v_3}^2} \) is used to represent the translational distance.

The POE matrix can be used to represent the forward kinematics model of an open-chain robot. For an n-DOF robot mechanism, its forward kinematics can be expressed as follows [8]:

$$ T={e}^{{\hat{\xi}}_1{\theta}_1}\cdotp {e}^{{\hat{\xi}}_2{\theta}_2}\cdotp {e}^{{\hat{\xi}}_3{\theta}_3}\dots {e}^{{\hat{\xi}}_n{\theta}_n}\cdotp {T}_0 $$
(6)

where T0 represents the initial transformation matrix, and Eq. 6 is a POE model; therefore, Eq. 6 can be used to establish the CNC machine tool error model.

2.3 Error model

The POE model is applied to establish the CNC machine tool error models, as it can express both the rotational and translational movements of each axis, while also introducing geometric errors. When the rotational axis is at rest, there is no geometric error. The 21 geometric errors of the translation axis include 18 PDGEs and 3 PIGEs. According to previous research [22, 23], PDGEs and PIGEs have a different effect on the machine tool accuracy. Andolfatto has shown that PIGEs account for around 86% of the errors, while PDGEs account for the remaining 14% [22]. Thus, it can be concluded that the PIGEs have detrimental influence on machine tool accuracy. For this reason, this paper is focused on the analysis of the translational axis PIGEs.

The three squareness errors of the machine tool represent the angular deviation between each two translational axes. This error representation method is established with respect to the so-called relative error notation [24]. The relative error notation simplifies the description of the kinematics model compared with the absolute error notation given in ISO 230-1 [1]. According to relative error notation, three squareness errors of the translational axis need to be identified to evaluate the geometric accuracy of the NC machine tool. For translational axes, there are three squareness errors. Since the actual and the nominal axis do not coincide, the angle between the two axes is not 90°. It should be noted that PIGEs are labeled with the letter S, followed by a two-character subscript. The squareness errors are defined as follows (as shown in Fig. 3):

  • the X-axis is defined to align with the reference coordinate system. Thus, for the X-axis, there is no squareness error;

  • the plane through X-axis and the actual Y-axis is called the reference X-Y plane, meaning that there is only squareness error Sxy for actual Y-axis;

  • for the actual Z-axis, there are two squareness errors, Syz between Y-axis and Z-axis, and Sxz between X-axis and Z-axis.

Fig. 3
figure 3

Squareness errors of the translational axis

Additionally, the Z-axis includes another error—the linear zero positioning error of the axis. However, since the said error occurs along the nominal direction of the axis and can be compensated by adjusting the numerical parameters, according to ISO 230-1 [1] it can be ignored.

In actual measurement, one axis should be selected as the main reference; in this paper, the authors selected the X-axis (Fig. 1). Therefore, the X-axis itself has no squareness error and the three squareness machine tool errors Sxy, Syz, and Sxz are measured using the X-axis as a reference. ISO 230-1 [1] specifies that the squareness error direction meets the right-hand screw rule. In other words, if the right-hand screw rule is met by turning from the position of the average actual axis to the position where the average axis and its ideal counterpart coincide, the sign is positive; otherwise, it is negative.

The geometric errors of the three translational axes are described next. The translational axes only include translational motion, meaning that six-dimensional twist vector coordinates can be expressed as:

$$ \xi ={\left[{\omega}^T\kern0.5em {v}^T\right]}^T={\left[\begin{array}{cc}\begin{array}{ccc}0& 0& 0\end{array}& \begin{array}{ccc}{S}_{\mathrm{x}}& {S}_{\mathrm{y}}& {S}_{\mathrm{z}}\end{array}\end{array}\right]}^T $$
(7)

where \( S={\left[{S}_{\mathrm{x}}\kern0.5em {S}_{\mathrm{y}}\kern0.5em {S}_{\mathrm{z}}\right]}^T \) represents the translation axis movement direction, and the exponential matrix of the translation axis is equal to:

$$ {e}^{\hat{\xi}}=\left[\begin{array}{cc}{I}_{3\times 3}& S\\ {}0& 1\end{array}\right]=\left[\begin{array}{cc}\begin{array}{c}1\\ {}0\end{array}& \begin{array}{c}0\\ {}1\end{array}\\ {}\begin{array}{c}0\\ {}0\end{array}& \begin{array}{c}0\\ {}0\end{array}\end{array}\kern0.5em \begin{array}{cc}\begin{array}{c}0\\ {}0\end{array}& \begin{array}{c}{S}_{\mathrm{x}}\\ {}{S}_{\mathrm{y}}\end{array}\\ {}\begin{array}{c}1\\ {}0\end{array}& \begin{array}{c}{S}_{\mathrm{z}}\\ {}1\end{array}\end{array}\right] $$
(8)

Within the field of the CNC machine tools, the six-dimensional twist vector coordinates of the X-axis can be expressed as\( {\xi}_{\mathrm{x}}={\left[\begin{array}{ccc}0& 0& 0\end{array}\kern0.5em \begin{array}{ccc}1& 0& 0\end{array}\right]}^T \), while the six-dimensional twist vector coordinates of the Y- and Z-axes are expressed as \( {\xi}_{\mathrm{y}}={\left[\begin{array}{ccc}0& 0& 0\end{array}\kern0.5em \begin{array}{ccc}0& 1& 0\end{array}\right]}^T \),\( {\xi}_{\mathrm{z}}={\left[\begin{array}{ccc}0& 0& 0\end{array}\kern0.5em \begin{array}{ccc}0& 0& 1\end{array}\right]}^T \). The resulting exponential matrix can be written as follows:

$$ {e}^{{\hat{\xi}}_{\mathrm{x}}}=\left[\begin{array}{cc}\begin{array}{c}1\\ {}0\end{array}& \begin{array}{c}0\\ {}1\end{array}\\ {}\begin{array}{c}0\\ {}0\end{array}& \begin{array}{c}0\\ {}0\end{array}\end{array}\kern0.5em \begin{array}{cc}\begin{array}{c}0\\ {}0\end{array}& \begin{array}{c}X\\ {}0\end{array}\\ {}\begin{array}{c}1\\ {}0\end{array}& \begin{array}{c}0\\ {}1\end{array}\end{array}\right]\ {e}^{{\hat{\xi}}_{\mathrm{y}}}=\left[\begin{array}{cc}\begin{array}{cc}\begin{array}{c}1\\ {}0\end{array}& \begin{array}{c}0\\ {}1\end{array}\\ {}\begin{array}{c}0\\ {}0\end{array}& \begin{array}{c}0\\ {}0\end{array}\end{array}& \begin{array}{cc}\begin{array}{c}0\\ {}0\end{array}& \begin{array}{c}0\\ {}Y\end{array}\\ {}\begin{array}{c}1\\ {}0\end{array}& \begin{array}{c}0\\ {}1\end{array}\end{array}\end{array}\right]\ {e}^{{\hat{\xi}}_{\mathrm{z}}}=\left[\begin{array}{cc}\begin{array}{cc}\begin{array}{c}1\\ {}0\end{array}& \begin{array}{c}0\\ {}1\end{array}\\ {}\begin{array}{c}0\\ {}0\end{array}& \begin{array}{c}0\\ {}0\end{array}\end{array}& \begin{array}{cc}\begin{array}{c}0\\ {}0\end{array}& \begin{array}{c}0\\ {}0\end{array}\\ {}\begin{array}{c}1\\ {}0\end{array}& \begin{array}{c}Z\\ {}1\end{array}\end{array}\end{array}\right] $$
(9)

For the Y-axis of the CNC machine tool, in the ideal case (no error), the six-dimensional twist vector coordinate can be expressed as \( {\xi}_{\mathrm{yi}}={\left[\begin{array}{ccc}0& 0& 0\end{array}\kern0.5em \begin{array}{ccc}1& 0& 0\end{array}\right]}^T \). However, due to the existence of squareness error, the actual six-dimensional torsion twist coordinate should be taken as \( {\xi}_{\mathrm{ys}}={\left[\begin{array}{ccc}0& 0& 0\end{array}\kern0.5em \begin{array}{ccc}{S}_{\mathrm{xy}}& 0& 0\end{array}\right]}^T \). Finally, the actual exponential matrix of the Y-axis is given as:

$$ {e}^{{\hat{\xi}}_{\mathrm{ys}}}=\left[\begin{array}{cc}\begin{array}{c}1\\ {}0\end{array}& \begin{array}{c}0\\ {}1\end{array}\\ {}\begin{array}{c}0\\ {}0\end{array}& \begin{array}{c}0\\ {}0\end{array}\end{array}\kern0.5em \begin{array}{cc}\begin{array}{c}0\\ {}0\end{array}& \begin{array}{c}{yS}_{\mathrm{xy}}\\ {}0\end{array}\\ {}\begin{array}{c}1\\ {}0\end{array}& \begin{array}{c}0\\ {}1\end{array}\end{array}\right] $$
(10)

The X-axis \( {e}^{{\hat{\xi}}_{\mathrm{xs}}} \) is an identity matrix since it is based on the X-axis, Z-axis squareness errors are based on the Y-axis error modeling method; there is no error, and six dimensions twist vector coordinates can be expressed as \( {\xi}_{\mathrm{zi}}={\left[\begin{array}{ccc}0& 0& 0\end{array}\kern0.5em \begin{array}{ccc}0& 0& 1\end{array}\right]}^T \). However, because of the existence of squareness error, the actual six dimensions twist vector coordinates should be deduced \( {\xi}_{\mathrm{zs}}={\left[\begin{array}{ccc}0& 0& 0\end{array}\kern0.5em \begin{array}{ccc}{S}_{\mathrm{xz}}& {S}_{\mathrm{yz}}& 0\end{array}\right]}^T \); therefore, the actual index matrix of Z-axis is represented as:

$$ {e}^{{\hat{\xi}}_{\mathrm{zs}}}=\left[\begin{array}{cc}\begin{array}{c}1\\ {}0\end{array}& \begin{array}{c}0\\ {}1\end{array}\\ {}\begin{array}{c}0\\ {}0\end{array}& \begin{array}{c}0\\ {}0\end{array}\end{array}\kern0.5em \begin{array}{cc}\begin{array}{c}0\\ {}0\end{array}& \begin{array}{c}{zS}_{\mathrm{xz}}\\ {}z{S}_{\mathrm{yz}}\end{array}\\ {}\begin{array}{c}1\\ {}0\end{array}& \begin{array}{c}0\\ {}1\end{array}\end{array}\right] $$
(11)

According to the topological machine tool structure, the ideal POE model order is Y → X → Z expressed as:

$$ {T}_{\mathrm{i}}={e}^{y{\hat{\xi}}_{\mathrm{yi}}}\cdotp {e}^{x{\hat{\xi}}_{\mathrm{xi}}}\cdotp {e}^{-z{\hat{\xi}}_{\mathrm{zi}}} $$
(12)

In Eq. 13, x, y, and z represent the moving distance of the translational X-, Y- and Z-axes, respectively. The coordinate value of the Z-axis is negative since the global coordinate system is located on the machine table. In practice, while also considering the geometric error, the actual POE model Ta can be expressed as:

$$ {T}_{\mathrm{a}}={e}^{{\hat{\boldsymbol{\xi}}}_{\mathrm{y}}}\cdotp {e}^{{\hat{\xi}}_{\mathrm{y}\mathrm{s}}}\cdotp {e}^{\hat{\xi}\mathrm{x}}\cdotp {e}^{{\hat{\xi}}_{\mathrm{xs}}}\cdotp {\left({e}^{{\hat{\boldsymbol{\xi}}}_{\mathrm{z}}}\cdotp {e}^{{\hat{\xi}}_{\mathrm{z}\mathrm{s}}}\right)}^{-1} $$
(13)

3 Experimental design

3.1 Experimental settings

In this section, a novel measuring method is proposed to measure the three CNC machine tool squareness errors by using DBB through a specific test path. The parameters are shown in Table 1.

Table 1 Experimental parameters

As shown in Fig. 4, two precision DBB test balls are attached to the two tool cups. One tool cup is mounted on the workbench fixture, while the other is located in a spindle tool holder. Before the experiment, the machine tool probe was used to locate the base of the workpiece tool cup. Then the cross sliding platform (additional fixture) is fine-tuned to adjust the position of the workpiece tool cup. This can effectively avoid the installation error of the workpiece tool cup and ensure that the coordinate system of the base position coincides with the coordinate system of the machine tool.

Fig. 4
figure 4

Setting of the DBB on the machine

As shown in Fig. 5, the measuring coordinate system origin is set on the workpiece tool cup center. Its X-, Y-, and Z-axes are coinciding with the directions of the machine tool motion axes. The experimental paths 1 and 2 are illustrated in Fig. 5 in pink and blue, respectively. In measurement paths 1 and 2, the placement of the DBB is shown in Fig. 5. The coordinate system O-XYZ is the basic coordinate system, and O″ is the origin of the auxiliary coordinate system. Path 1 (marked as a pink curve) illustrates that the spindle drives the DBB from the negative of the X-axis to its positive. Path 2 (marked as a blue curve) also shows that the spindle drives the DBB from the negative of the X-axis to its positive, but in a different direction of the Y-axis. The nominal DBB length is 100 mm.

Fig. 5
figure 5

Experimental measurement paths

3.2 Experimental measurement path equalization method

Before the experiment, the machine is preheated according to the standard preheating procedure. One end of the DBB is placed at the measuring coordinate system origin, while the other is placed 100 mm away from the origin. The measuring path first carries out the initial position of the DBB level with the negative direction of the X-axis (coordinate system O-XYZ). During the experiment, the machine tool X-axis moves from − 100 to 0 mm and 0 to 100 mm. The Y-axis moves from 0 to \( 50\sqrt{2} \) mm, \( 50\sqrt{2} \) to 0 mm, 0 to -\( 50\sqrt{2} \) mm, and finally, from -\( 50\sqrt{2} \) to 0 mm. The Z-axis moves from 0 to 100 mm, followed by the movement from 100 to 0 mm. As shown in Fig. 6, the red line is measurement path 1, and the blue line is measurement path 2. In order to ensure that each cutter location points are located on a spherical trajectory with radius R = 100 mm, the cutter location points of the machine tool must satisfy the following expression:

$$ {X}^2+{Y}^2+{Z}^2={100}^2 $$
(14)
Fig. 6
figure 6

Experimental measurement path of the spherical trajectory

It can be seen from the oblique 45° view of the negative X-axis trajectory (please see Fig. 6), the tool position trajectory is located in a \( 50\sqrt{2} \) radius semicircle (2D coordinate system o-xy). The auxiliary view is shown in the dotted line, and the actual motion trajectory is shown using the solid line. Therefore, the positional relationship between the x- and y-axes can be obtained from \( {x}^2+{y}^2={\left(50\sqrt{2}\right)}^2 \).

As shown in Fig. 6, the coordinate points (x, y) on the 2D coordinate system of o-xy are transformed into the 3D coordinate points (X, Y, Z). In the coordinate transformation, the rotation transformation matrix along the Y-axis is obtained by rotating the Y-axis by 45°. It is expressed as:

$$ \mathrm{Rot}\left({\theta}_{\mathrm{y}}\right)=\left[\begin{array}{cc}\begin{array}{cc}\cos {\theta}_{\mathrm{y}}& \kern0.75em 0\\ {}0& \kern0.75em 1\end{array}& \begin{array}{cc}\sin {\theta}_{\mathrm{y}}& 0\\ {}0& 0\end{array}\\ {}\begin{array}{cc}-\sin {\theta}_{\mathrm{y}}& 0\\ {}0& 0\end{array}& \begin{array}{cc}\cos {\theta}_{\mathrm{y}}& 0\\ {}0& 1\end{array}\end{array}\right],{\theta}_{\mathrm{y}}=-45/180\times \pi $$
(15)

The translation transformation matrix is located 50 mm to the positive semi-axis of the X-axis and 50 mm to the negative semi-axis of the Z-axis; therefore, the 2D coordinate system coincides with the 3D coordinate system. As shown below, the coordinate (X, Y, Z) is:

$$ \left[\begin{array}{c}\begin{array}{c}X\\ {}Y\end{array}\\ {}\begin{array}{c}Z\\ {}1\end{array}\end{array}\right]=\left[\begin{array}{cc}\begin{array}{cc}\cos {\theta}_{\mathrm{y}}& \kern0.5em 0\\ {}0& \kern0.5em 1\end{array}& \begin{array}{cc}\sin {\theta}_{\mathrm{y}}& 50\\ {}0& 0\end{array}\\ {}\begin{array}{cc}-\sin {\theta}_{\mathrm{y}}& 0\\ {}0& 0\end{array}& \begin{array}{cc}\cos {\theta}_{\mathrm{y}}& -50\\ {}0& 1\end{array}\end{array}\right]\left[\begin{array}{c}\begin{array}{c}X^{\prime}\\ {}Y^{\prime}\end{array}\\ {}\begin{array}{c}Z^{\prime}\\ {}1\end{array}\end{array}\right] $$
(16)

where (X′, Y′, Z′) is the auxiliary view coordinate point. After the coordinate transformation, the 3D coordinate points constitute the experimental code.

3.3 Synchronous sampling of machine tool motion

Since the DBB data acquisition speed is constant, it is critical to ensure the uniform machine tool movement. The synchronization of machine movement and sampling can be achieved by the equal path division, as shown in Fig. 7. When a single-line of G code is used to express the motion of multiple axes, the feed rate specified in this G code is the tangential direction of the complex motion of the multiple axes. Although the feed rate is a constant value, the feed rate in tangential direction may fluctuate according to the shape of the motion path [25]. The experimental path in this paper consists of several discrete points, providing sufficient points on the synthetic motion path of the three translational axes. Since the DBB collects data at a constant sampling rate (1000 Hz), the distance between adjacent points of the DBB should be less than the resolution of the LVDT (linear variable differential transformer) in the DBB, which in this case is 0.1 μm. Therefore, for the convenience of calculation, this method divides the experimental path coordinate points into 1000 parts. Figure 7 shows that two adjacent coordinate points are equidistant, satisfying the synchronization of the acquisition rate and machine movement.

Fig. 7
figure 7

Achieving path sharing after coordinate transformation

In order to make the experimental data more comprehensive and the error calculation more accurate, four experimental groups were carried out. The four experimental paths are shown in Fig. 8. Figure 8 a shows that the cutter location point starts from point − 100 mm (X-axis), and finally reaches the position of + 100 mm on the same axis. Figure 8b shows that the cutter location point starts at coordinate − 100 mm (Y-axis), and finally reaches the position of + 100 mm on the same axis. The additional three groups of experiments performed path planning with the first group.

Fig. 8
figure 8

Experimental measurement paths. a Starting from X-axis. b Starting from Y-axis

3.4 Error calculation

Following its collection, the experimentally obtained DBB data requires error calculation. According to the comprehensive error model proposed in the second section (Eq. 13), the second- and higher-order terms are approximated and ignored as small angles. The resulting simplified equation is written as follows:

$$ {T}_{\mathrm{a}}^{\prime }={T}_{\mathrm{a}}\cdotp {\left[\begin{array}{cc}0& 0\end{array}\kern0.5em \begin{array}{cc}0& 1\end{array}\right]}^T=\left[\begin{array}{c}\begin{array}{c}x+y\sin \left({S}_{\mathrm{xy}}\right)-z\sin \left({S}_{\mathrm{xz}}\right)\\ {}y-z\sin \left({S}_{\mathrm{yz}}\right)\end{array}\\ {}\begin{array}{c}z\\ {}1\end{array}\end{array}\right] $$
(17)

where x, y, and z are the coordinate points after the path is evenly divided.

Since the DBB measurement path and the acquisition error variation are all carried out in the spherical coordinates, the equation is established by using the relation with the sphere radius. The relationship between\( {T}_{\mathrm{a}}^{\prime } \)and LDBB data can be expressed as:

$$ {L}_{\mathrm{DBB}}=\sqrt{\left({X}_{\mathrm{actual}}^2+{Y}_{\mathrm{actual}}^2+{Z}_{\mathrm{actual}}^2\right)}-100 $$
(18)

where\( {X}_{\mathrm{actual}}^2 \), \( {Y}_{\mathrm{actual}}^2 \), and \( {Z}_{\mathrm{actual}}^2 \) correspond to the first three rows of\( {T}_{\mathrm{a}}^{\prime } \), respectively, and LDBB is the data collected by the DBB. The LDBB data is also used to establish the overdetermined equations. Equation 18 is used to determine the relationship between the measurement data and the geometric errors, with the higher-order error terms eliminated [26]. The pseudo-inverse method is used to solve the three translation axis errors. Since the DBB data is composed of the clockwise and counter-clockwise data, the three translation axis squareness errors are calculated based on the clockwise and counter-clockwise DBB data in the experimental paths (see Fig. 9).

Fig. 9
figure 9

Comparison of squareness errors of the DBB clockwise and counter-clockwise

Due to the influence of the machine tool thermal stability and similar factors, the slight differences in the clockwise and counter-clockwise DBB data collection are expected. Furthermore, the three squareness translation axis errors (shown in Fig. 9) are compared by using clockwise and counter-clockwise data. The results were similar, and the NC compensation can be performed separately.

4 Compensation through modifying NC data

4.1 Proposed compensation path

The compensation experiment was based on a spherical spiral path, while the compensation was performed by modifying the NC data. The compensation method effectiveness was evaluated by comparing the error data detected by the DBB before and after the compensation.

Tsutsumi et al. [27] and Zargarbashi et al. [28] designed a circular path measurement method for identifying PIGEs of CNC machine tools. This method enabled the authors to effectively identify some PIGEs of CNC machine tools. However, the test paths are special trajectories in a limited processing area. For this reason, the measurement results were used to distinguish the individual machine tool errors, rather than combining as many errors as possible to reflect the overall accuracy. Lee et al. [19] defined the spherical error as the range of maximum radial deviation around the least square sphere, which is jointly affected by the accuracy of all the three translation axes. The machine tool accuracy is then expressed by quantifying the influence of each translation axis accuracy. However, to explore the spherical error, the circular paths in the three planes generated through the joint motion of the two translation axes were combined into the spherical surface. Unfortunately, it could not reflect the three translation axes linkage situation more effectively. Ding [29] uses the same paths for both error measurement and compensation using a DBB, and the residual error will inevitably be reduced. Instead, in this paper, two different spatial paths lying on the sphere are used for error measurement and error compensation, which effectively avoids the above weakness.

The path used in this experiment is the spherical spiral trajectory. Through the form of three translation axes linkage, all the error combinations are considered; therefore, it is more comprehensive. Since the trajectory is on a spherical surface, the spherical coordinate system was used to describe the spherical spiral more conveniently and directly. The coordinate system origin was placed at the sphere center; the resulting coordinate system is shown in Fig. 10.

Fig. 10
figure 10

Spherical coordinate system

A spherical coordinate system is a 3D orthogonal coordinate system that uses spherical coordinates (γ, θ, φ) to indicate the point position in a 3D space. The figure shows the geometric meaning of spherical coordinates: γ represents the distance from the origin to point P, φ is the angle between OP and Z-axis, whereas the azimuth between the projection line of OP on the XY plane and the X-axis is denoted as θ. The spherical coordinate equation of the spherical spiral is written as follows:

$$ \rho =\gamma, \theta =t\times 180\times k,t\in \left[0,1\right],\theta \in \left[0,0.5\right],\varphi =t\times 360\times n\times k $$
(19)

where γ is the radius of the sphere; n is the number of the spiral rotations; k is the sphere height coefficient (in a hemisphere, k = 0.5).

The experimental path of the compensation experiment is shown in Fig. 11. The experimental device is installed as defined in Section 3. One end of the DBB is set at the coordinate system origin, while the other end departs from the negative semi-axis of the X-axis (− 100, 0, 0) and reaches the final position of the positive semi-axis of the Z-axis (0, 0, 100) three times around the sphere.

Fig. 11
figure 11

Spherical spiral experimental measurement path

Through the spherical surface spiral path, the experimental data collected by the DBB is the variation of the sphere radius; therefore, the deviation range of the sphere radius is under the influence of the three translation axes. In this paper, the experimental path used in both error measurement and error compensation experiments is spherical. Thus, it is different from the previously used circular path. The comparison between the two is shown in Fig. 12. Figure 12a shows the experimental paths including the motion of two linear axes. Figure 12b is the three-axis linkage experiment compensation path proposed in this paper. The three translational axes are coordinated along the spherical spiral path, so that the change of the spherical radius is affected by the three translational axes.

Fig. 12
figure 12

Comparison of experimental paths. a Circular paths. b Spherical path

In Eq. 19, the value t ranges between 0 and 1, and is divided into 361 parts. The value k is 0.5 in the hemisphere, and the number of the spherical spiral turns n = 3. Calculation using the above parameters found that the acquisition points could not be made uniform, and there were only 361 path acquisition points. The motion points were unable to synchronize machine motion with the DBB acquisition rate. The shortest distance between the two cutter location points on top of the sphere is 0.436 mm. The experimental path is divided into one million points, and adjacent meeting the distance between the two points is 0.436 mm. Furthermore, the adjacent points with a distance of 0.436 mm between the two points were found; 1446 coordinate points could satisfy the DBB acquisition rate and the machine tool synchronization, constituting the experimental path code. Figure 13 shows the distance comparison between the two points before and after the path is equally divided.

Fig. 13
figure 13

Comparison of distances between two points

4.2 Experimental error compensation procedure and results

After the paths are evenly divided, the original path code for acquisition rate synchronization is obtained. The three squareness errors obtained in Section 3 are included in the overall machine tool error model to generate the actual operation code containing errors. The error values are found by subtracting the average G code from the actual running code. The obtained error values were then added to the original path code to generate the compensated G code. The machine tool error calculation and NC compensation process are shown in Fig. 14.

Fig. 14
figure 14

Machine tool error calculation and NC compensation flowchart

Figure 14a gives the incorporation of the machine tool errors into the ideal error model of the machine tool. The actual error model helps to establish the equations containing the three squareness errors. The next step is to carry out experiments through the evenly divided experimental path, and the experimental data were substituted into the actual error model of the machine tool. The overdetermined equations were established and solved using the pseudo-inverse method. Finally, the three squareness errors of the machine tool were obtained. Figure 14b is a flowchart of NC compensation process including two experiments. The comparison experiments are constructed as two routes: the left route is the NC code that has not been compensated after equalization of the spherical path; the right route is the second experiment that the errors have been compensated for by the solved squareness errors.

The experimental installation is identic to the error measurement experiment shown in Section 3.1, meaning that the second installation is not needed. Before the experiment, the machine must be preheated according to the pre-defined preheating procedure. Both experiments were performed using the average and the compensated G code, whereas the DBB collected data were compared, aiming to verify the compensation effectiveness. The comparison results are shown in Fig. 15.

Fig. 15
figure 15

Comparison of the DBB data after spherical spiral path compensation (unit: mm)

The error of the data collected by the DBB with the trajectory angle can be seen in Fig. 15; it shows the difference in the DBB collected data before and after the compensation. The blue line represents the original machine tool geometric errors (the data collected by DBB before compensation), whereas the red line represents the data collected by DBB after using the NC compensation method. It can be seen that the NC compensation method reduces the geometric errors, while the residual errors cannot be compensated. The residual error is caused by position-dependent geometric errors (PDGEs) and other error sources, such as dynamic and thermal errors. For this reason, the machine tool still has some residual errors. Different from Lee’s work [30], he uses a DBB to construct a virtual regular tetrahedron within the workspace of a machine tool and measures the length of the six sides to evaluate the scale and squareness errors of the machine tool. Although the maximum deviation after the final compensation is reduced, some compensated results increase rather than decrease. In this paper, the maximum and average error values before compensation and the residual errors after the compensation are shown in Table 2.

Table 2 Comparison of geometric errors of machine tools (unit: mm)

Based on the presented table and figures, it can be concluded that the difference in the error detection data of the DBB before and after the error compensation is significant; the overall error compensation effect is improved. Therefore, the spherical spiral experiment has verified that the spherical S-shaped path can effectively detect the machine tool squareness error.

5 Conclusions

The contribution of this paper is to propose a novel method for measuring the machine tool squareness error. By experimentally comparing the states before and after the compensation, the authors have proven the effectiveness of the squareness error detection method using the proposed spherical S-shaped paths. Some conclusions are given as follows:

  • In the previous studies, the error was measured on planar circular paths, carrying out multiple experimental measurements, while the error measurements and experimental verification in this article are carried out in spherical coordinates. The presented method does not require repeated installation settings, and three translation axes are linked. Thus, the presented method is convenient and gives results promptly.

  • The article uses different methods to solve the problem that the DBB acquisition rate is not synchronized with the machine tool movement.

  • In this paper, the spherical spiral paths are proposed for error compensation. It is different from the method of using the original path for experimental compensation verification in the reference.

  • By experimentally comparing the states before and after compensation, the residual error after compensation is 75% less than that before compensation. Therefore, the effectiveness of measuring the squareness error by spherical S-shaped paths is verified.