# A Virtual Reality Soldier Simulator with Body Area Networks for Team Training
## 4 Performance Analysis
### Rotation Matrix  
According to [36], given a unit quaternion \(\mathbf{q}=q_{r}+q_{x}i+q_{y}j+q_{z}k\), the quaternion-driven rotation can be further described by the rotation matrix \(\mathbf{R}\), which yields  
\[\mathbf{R}=\left[\begin{array}{ccc}1-2\big{(}{q_{y}}^{2}+{q_{z}}^{2}\big{)}&2q_ {x}q_{y}-2q_{r}q_{z}&2q_{x}q_{z}+2q_{r}q_{y}\\ 2q_{x}q_{y}+2q_{r}q_{z}&1-2\big{(}{q_{x}}^{2}+{q_{z}}^{2}\big{)}&2q_{y}q_{z}- 2q_{r}q_{x}\\ 2q_{x}q_{z}-2q_{r}q_{y}&2q_{y}q_{z}+2q_{r}q_{x}&1-2\big{(}{q_{x}}^{2}+{q_{y}} ^{2}\big{)}\end{array}\right]. \tag{21}\]  
Figure 14: The kinematic chain of a human body.  
Let \(\hat{\mathbf{q}}\) be an estimate of the true attitude quaternion \(\mathbf{q}\). The small rotation from the estimated attitude, \(\hat{\mathbf{q}}\), to the true attitude is defined as \(\mathbf{q}_{err}\). The error quaternion is small but non-zero, due to errors in the various sensors. The relationship is expressed in terms of quaternion multiplication as follows:  
\[\mathbf{q}=\hat{\mathbf{q}}\otimes\mathbf{q}_{err}. \tag{22}\]  
Assuming that the error quaternion, \(\mathbf{q}_{err}\), is to represent a small rotation, it can be approximated as follows:  
\[\mathbf{c}=\begin{bmatrix}q_{r}\ q_{x}^{(err)}\ q_{y}^{(err)}\ q_{z}^{(err)}\end{bmatrix} ^{T}=\begin{bmatrix}q_{r}\stackrel{{\rightarrow}}{{\mathbf{q}}}_{err} \end{bmatrix}^{T}. \tag{23}\]  
Noting that the error quaternion \(\mathbf{q}_{err}\) is a perturbation of the rotation matrix, and the vector components of \(\stackrel{{\rightarrow}}{{\mathbf{q}}}_{err}\) are small, the perturbation of the rotation matrix R in Equation (21) can be written as:  
\[\mathbf{R}(\mathbf{q}_{err})\cong\begin{bmatrix}1&-2q_{r}q_{z}^{(err)}&2q_{r}q_{y}^{ (err)}\\ 2q_{r}q_{z}^{(err)}&1&-2q_{r}q_{x}^{(err)}\\ -2q_{r}q_{y}^{(err)}&2q_{r}q_{x}^{(err)}&1\end{bmatrix}=\mathbf{I}_{3x3}+2\mathbf{q}_ {r}\begin{bmatrix}\stackrel{{\rightarrow}}{{\mathbf{q}}}_{err} \end{bmatrix}^{\mathrm{x}}. \tag{24}\]  
Equation (22) relating \(\hat{\mathbf{q}}\) and \(\mathbf{q}\) can be written as  
\[\mathbf{R}(\mathbf{q})=\mathbf{R}(\hat{\mathbf{q}})\mathbf{R}(\mathbf{q}_{err})=\mathbf{R}(\hat{\mathbf{q}}) \begin{bmatrix}\mathbf{I}_{3x3}+2\mathbf{q}_{r}\begin{bmatrix}\stackrel{{ \rightarrow}}{{\mathbf{q}}}_{err}\end{bmatrix}^{\mathrm{x}}\end{bmatrix}. \tag{25}\]  
\(\mathbf{R}(\hat{\mathbf{q}})\) is the estimate of the rotation matrix or the equivalent of \(\hat{\mathbf{q}}\). Now, considering the sensor frame \(\mathbf{u}_{s}\) and the earth frame \(\mathbf{u}_{e}\), we have  
\[\mathbf{u}_{e}=\mathbf{R}(\hat{\mathbf{q}})\begin{bmatrix}\mathbf{I}_{3x3}+2\mathbf{q}_{r} \begin{bmatrix}\stackrel{{\rightarrow}}{{\mathbf{q}}}_{err}\end{bmatrix}^{ \mathrm{x}}\end{bmatrix}\mathbf{u}_{s}=\hat{\mathbf{u}}_{e}+2\mathbf{q}_{r}\begin{bmatrix} \stackrel{{\rightarrow}}{{\mathbf{q}}}_{err}\end{bmatrix}^{ \mathrm{x}}\mathbf{u}_{s}. \tag{26}\]  
Thus, the measurement relation for the quaternion error is obtained:  
\[\Delta\mathbf{u}_{e}\triangleq\mathbf{u}_{e}-\hat{\mathbf{u}}_{e}=\mathbf{2}q_{r} \begin{bmatrix}\stackrel{{\rightarrow}}{{\mathbf{q}}}_{err}\end{bmatrix}^{ \mathrm{x}}\mathbf{u}_{s}. \tag{27}\]  
Accordingly, given the error quaternion \(\mathbf{q}_{err}\) and the sensor frame \(\mathbf{u}_{s}\), the perturbation of the earth frame \(\mathbf{u}_{e}\) can be described. The quantitative analysis of the error quaternion is detailed in Section 6.1.