# A Virtual Reality Soldier Simulator with Body Area Networks for Team Training
## 3 Quaternion Representation  
This section outlines a quaternion representation of the orientation of the sensor arrays. Quaternions provide a convenient mathematical notation for representing the orientation and rotation of 3D objects because quaternion representation is more numerically stable and efficient compared to rotation matrix and Euler angel representation. According to [34; 35; 36], a quaternion can be thought of as a vector with four components,  
\[q=q_{0}+q_{x}i+q_{y}j+q_{z}k \tag{14}\]  
as a composite of a scalar and ordinary vector. The quaternion units \(q_{x}\), \(q_{y}\), \(q_{z}\) are called the vector part of the quaternion, while \(q_{0}\) is the scalar part. The quaternion can frequently be written as an ordered set of four real quantities,  
\[q=\big{[}q_{0},\ q_{x},\ q_{y},\ q_{z}\big{]}. \tag{15}\]  
Denote \({}^{e}_{s}q\) as the orientation of the earth frame \(\mathbf{u_{e}}\) with respect to the sensor frame \(\mathbf{u_{s}}\). The conjugate of the quaternion can be used to represent an orientation by swapping the relative frame, and the sign \({}^{*}\) denotes the conjugate. Therefore, the conjugate of \({}^{e}_{s}q\) can be denoted as  
\[{}^{e}_{s}q^{*}={}^{s}_{e}q=\big{[}q_{0},\ -q_{x},\ -q_{y},\ -q_{z}\big{]}. \tag{16}\]  
Moreover, the quaternion product \(\otimes\) can be used to describe compounded orientations, and their definition is based on the Hamilton rule in [37]. For example, the compounded orientation \({}^{s}_{h}q\) can be defined by  
\[{}^{s}_{h}q={}^{s}_{e}q\otimes{}^{e}_{h}q, \tag{17}\]  
where \({}^{e}_{h}q\) denotes the orientation of the earth frame \(\mathbf{u_{e}}\) with respect to the frame \(\mathbf{u_{h}}\).  
A human body model consists of a set of body segments connected by joints. For upper limbs and lower limbs, kinematic chains are modeled that branch out around the torso. The kinematic chain describes the relationship between rigid body movements and the motions of joints. A forward kinematics technique, which was introduced for the purposes of robotic control, is used to configure each pair of adjacent segments. In the system, the aim of building human kinematic chains is to  
Figure 13: System initialization flow diagram.  
determine the transformation matrix of a human body from the first to the last segments and to find the independent configuration for each joint and the relationship with the root frame.  
Thus, the rotation matrix \(q_{n-1}^{n}\) used for orientation from sensor node \(n\)-1 to sensor node \(n\) is given by  
\[q_{n-1}^{n}=q_{n-1}\otimes q_{n}^{\star}. \tag{18}\]  
Figure 14 shows the simplified segment biomechanical model of the human body. The kinematics of segments on which no inertial sensors are attached (e.g., hand, feet, toes) are considered to be rigid connections between neighboring segments. The transformation matrix is defined as  
\[Q_{n-1}^{n}=\left[\begin{array}{cc}q_{n-1}^{n}&T_{n-1}^{n}\\ 0&1\end{array}\right]. \tag{19}\]  
where \(T_{n-1}^{n}\) is the translation matrix from sensor frame to body frame. According to [37; 38], therefore, the transformation matrix of a human body from the first segment to the n-th segment is  
\[Q_{1}^{n}=Q_{n-1}^{n}Q_{n-2}^{n-1}Q_{n-3}^{n-2}\cdots Q_{2}^{3}Q_{1}^{2}. \tag{20}\]