# A Virtual Reality Soldier Simulator with Body Area Networks for Team Training
## 2 System Description
### Information Processing  
As mentioned above, human action recognition is crucial to developing an immersive training simulator. The wireless BAN is able to instantaneously track the action of the skeleton of a soldier. The microcontroller of the sensor node acquires the raw data from the accelerometer, gyroscope and  
\begin{table}
\begin{tabular}{c c c c} \hline \hline  & \(\mathbf{CR}_{acc}\) & \(\mathbf{CR}_{mag}\) & \(\mathbf{CR}_{gyro}\) \\ \hline x & 0.95 & 0.98 & 0.96 \\ y & 0.97 & 0.99 & 0.96 \\ z & 0.99 & 0.98 & 0.94 \\ \hline \hline \end{tabular}
\end{table}
Table 1: The calibrated results of the sensor nodes.  
Figure 8: The attitude angles of a sensor node placed on the upper arm when standing in a T-pose.  
magnetometer through SPI and I2C interfaces. The measurements of the accelerometer, gyroscope and magnetometer are contaminated by errors of scale factor and bias, resulting in a large estimation error during sensor fusion. Thus, a procedure for normalization and error correction is needed for the sensor nodes to ensure the consistency of the nine-axis data (Figure 9). After that, the calibrated accelerometer and magnetometer data can be used to calculate the orientation and rotation. Estimation based on the accelerometer does not include the heading angle, which is perpendicular to the direction of gravity. Thus, the magnetometer is used to measure the heading angle. the Euler angles are defined as follows:  
\[\text{Roll}-\Phi: :\text{ rotation about the X-axis}\] \[\text{Pitch}-\theta: :\text{ rotation about the Y-axis}\] \[\text{Heading}-\psi: :\text{ rotation about the Z-axis}.\]  
Let \(X_{acc}\), \(Y_{acc}\), \(Z_{acc}\) be the accelerometer components. We have:  
\[\text{Pitch}\ \theta=\tan^{-1}\left(\frac{-X_{acc}}{\sqrt{Z_{acc}{}^{2}+Y_{ acc}{}^{2}}}\right) \tag{7}\]  
\[\text{Roll}\ \Phi=\tan^{-1}\left(\frac{Y_{acc}}{Zacc}\right) \tag{8}\]  
Let \(X_{mag}\), \(Y_{mag}\), \(Z_{mag}\) be the magnetometer components. We have:  
\[X_{h}=X_{mag}\cos(\theta)+Y_{mag}\sin(\theta)\times\sin(\Phi)+Z_{mag}\sin( \theta)\times\cos(\Phi) \tag{9}\]  
\[Y_{h}=-Y_{mag}\cos(\Phi)+Z_{mag}\sin(\Phi) \tag{10}\]  
\[\text{Heading}\ \psi=\tan^{-1}\left(\frac{Y_{h}}{X_{h}}\right) \tag{11}\]  
Accordingly, the complementary filter output (using gyroscope) is  
\[Angle_{output}=W\times(Angle_{output}+Angle_{gyro})+(1-W)\times Angle_{acc+ mag},\ 0<W<1 \tag{12}\]  
To mitigate the accumulated drift from directly integrating the linear angular velocity of the gyroscope, the accelerometer and magnetometer are used as aiding sensors to provide the vertical and horizontal references for the Earth. Moreover, a complementary filter [28; 29] is able to combine the measurement information of an accelerometer, a gyroscope and a magnetometer, offering big advantages in terms of both long-term and short-term observation. For instance, an accelerometer does not drift over the course of a long-term observation, and a gyroscope is not susceptible to small forces during a short-term observation. The W value of the complementary filter in Equation (12) is  
Figure 9: The diagram shows the process of sensor fusion.  
the ratio in which inertial sensor data is fused, which can then be used to compensate for gyroscope drift by using the accelerometer and magnetometer measurements. We always set the W value to 0.9, or probably even higher than 0.9. Therefore, the complementary filter provides an accurate orientation estimation.