## 4 Moving Head Calibration
### Determining the Moving Head Orientation  
The third and final phase of the calibration is the calculation of the moving head orientation relative to the reference coordinate system. The steps of this phase are shown in Figure 8.  
To complete the final transformation matrix between the reference and moving head coordinate system introduced in Section 3.3 (Equation (3)), the \(3\times 3\) rotation matrix \({}^{MH}_{Ref}\mathbf{R}\) must be calculated. Since the angles of the rotations are yet to be determined, it is constructed with the symbolic variables \(\alpha\) for the rotation around the \(x\) axis and \(\gamma\) for the rotation around the \(z\) axis. The rotation around the \(y\) axis has been omitted in this case as it is assumed again that the \({}^{MH}xy\) and \({}^{Ref}xy\) planes are parallel or anti-parallel, which leads to the transformation matrix shown in Equation (20). The values of \(\alpha\) are limited to \(\alpha=\{0^{\circ},180^{\circ}\}\). The angle \(\gamma\), however, can take any value in the range of \(\gamma=[-180^{\circ},180^{\circ}[\). The \(\vec{x}\) vector for the iteration, therefore, is \(\vec{x}^{\ (0)}=[\alpha,\gamma]^{T}\). Estimating initial values for the \(\vec{x}^{\;(0)}\) is trivial for \(\alpha\) in this case due to the discrete values. For \(\gamma\), a qualitative estimate is usually sufficient.  
\[\begin{split}\mathbb{R}_{Ref}^{\text{MH}}\mathbf{R}_{zx}=\mathbf{R }_{z}(\gamma)^{T}\cdot\mathbf{R}_{x}(\alpha)^{T}=\begin{bmatrix}cos\;\gamma&sin\; \gamma&0\\ -sin\;\gamma&cos\;\gamma&0\\ 0&0&1\end{bmatrix}^{T}\cdot\begin{bmatrix}1&0&0\\ 0&cos\;\alpha&sin\;\alpha\\ 0&-sin\;\alpha&cos\;\alpha\end{bmatrix}^{T}\end{split} \tag{20}\]  
With this symbolic rotation matrix, Equation (21) for the translation vector \([t_{x},\;t_{y},\;t_{z}]^{T}\) of the transformation matrix can be determined from the moving head position calculated in Section 4.1.  
\[\begin{pmatrix}t_{x}\\ t_{y}\\ t_{z}\end{pmatrix}\overset{!}{=}-\mathbb{R}_{Ref}^{H}\mathbf{R}_{zx}\cdot^{Ref} \vec{P}_{MH} \tag{21}\]  
With the rotation matrix and the translation vector, the transformation matrix \(\mathbb{R}_{Ref}^{H}\mathbf{T}\) is completely defined and can be used to transform the reference points from the reference coordinate system \({}^{Ref}\) to the moving head coordinate system \({}^{MH}\), according to Figure 4. The transformation step in Equation (22) yields the \([x_{i},\;y_{i},\;z_{i}]^{T}\) coordinates for the next calculation step.  
\[\begin{split}\mathbb{R}_{i}^{H}\vec{P}_{i}=\mathbb{R}_{Ref}^{H} \mathbf{\tau}\cdot^{Ref}\vec{P}_{i}\end{split} \tag{22}\]  
The transformed reference points can now be used with the \(pan^{\circ}\) and \(tilt^{\circ}\) values from the reference points in combination with Equations (1) and (2) to derive the second set of function Equations (23) and (24) for the next iteration. This results in \(N(N-1)\) equations for \(N\) points.  
\[\begin{split} f_{III}:& 0=sgn(^{MH}y_{i})\cdot arccos \begin{pmatrix}^{MH}\left(\dfrac{x_{i}}{\sqrt{x_{i}^{2}+y_{i}^{2}}}\right) \end{pmatrix}-pan_{i}^{\circ}\end{split} \tag{23}\]  
\[\begin{split} f_{IV}:& 0=arcsin\begin{pmatrix}^{MH}\left(\dfrac{x_{i}}{ ||\vec{P}_{i}||}\right)\end{pmatrix}-tilt_{i}^{\circ}\end{split} \tag{24}\]  
With the second set of equations and the initial estimate of the orientation angles \(\vec{x}^{\;(0)}\), the moving head orientation relative to the reference coordinate system origin can be calculated, leading to the final transformation between the moving head and the reference coordinate system, thus completing the calibration process. The final transformation matrix  
Figure 8: Flowchart for determining the moving head orientation from the reference points and the calculated position relative to the reference coordinate system orientation.  
can be found in Equation (A6). In order to verify the exactitude and applicability of the obtained transformation, and the system in general, the following section will discuss the validation of everything shown thus far.