# Glove Prototype for Feature Extraction Applied to Learning by Demonstration Purposes
## 3 Theoretical Concepts
### Orientation Estimation  
In order to estimate orientation in 3D space, it is very common to use IMUs because they are highly portable devices increasingly used in human motion capture systems [36]. They offer a reference (gravity) given by the accelerometer and a measurement of rotation by the gyroscope. It is enough to initialize and estimate attitude commonly known by pitch and roll but not heading or yaw. To obtain the heading, the IMU is usually packed with a magnetometer that it can use as a compass. In this application, the heading is not so important, and magnetometers are the least reliable of the three sensors. Ideally, the sensors would give perfect measurements, but that is not the case, and its implications will be addressed in Section 3.2. For instance, assuming that the IMU's measures are perfect and the orientation estimation is computed from that (extracting orientation from the IMUs data is later addressed in Section 3.3), there are many ways to represent an orientation, namely quaternions, rotation matrices, and the many types of Euler angles [37]. [PERSON] (1707-1783) proved that given a known sequence of axis to rotate, only three angles are needed to define a rotation between any two independent orthonormal  
Figure 1: Proposed hand model (adapted from [35]). coordinate frames with a common origin [37]. Named after [PERSON], Euler angles are the simplest to grasp because they consist of three angles rotating around three axes. The representation used in [38] is very common for simple quad-copters or aviation, also known for roll, pitch, and yaw angles, which one can intuitively comprehend and interpret,. However, it is susceptible to gimbal lock where an axis overlaps another with the rotation and loses one degree of freedom because now angles rotate in the same axis [39]. Rotation matrices are very flexible and well established in all sorts of transformations mainly due to the convenience of matrix algebra operations, but they are not so intuitive just by looking at the a matrix defining the rotation [37]. So, in this work, quaternions were the best choice. They are known for the fast and easy computation and compact memory use, and they avoid singularities such as gimbal lock in Euler angles. In addition, SLERP (spherical linear interpolation) is very easy to compute from two quaternions [24]. Quaternions are an extension of complex numbers, but they add not one but two imaginary parts composed of a real part and three imaginary parts with a distinct multiplication rule set. The same way complex numbers describe rotations in 2D space, quaternions inherit that to the 3D space. It can be represented as four real coefficient numbers of (w, i, j, k) or (w, x, y, z). This is common because quaternions are very close to angle-axis representation. As the name implies, it describes a rotation in the axis (\(e_{x}\), \(e_{y}\), \(e_{z}\)) by an angle \(\alpha\). The quaternion is formed as:  
\[\mathbf{q}=\left[ \begin{array}{c}q_{w}\\ q_{x}\\ q_{y}\\ q_{z}\end{array} \right]=\left[ \begin{array}{c}\cos\frac{\alpha}{2}\\ e_{x}\sin\frac{\alpha}{2}\\ e_{y}\sin\frac{\alpha}{2}\\ e_{z}\sin\frac{\alpha}{2}\end{array} \right] \tag{1}\]  
and to rotate and change frames of reference, quaternion multiplication is similar to rotation matrices. We can multiply quaternions \(\mathbf{p}\) and \(\mathbf{q}\) as:  
\[\mathbf{p}\mathbf{q}=\left[ \begin{array}{c}p_{w}q_{w}-p_{x}q_{x}-p_{y}q_{y} -p_{z}q_{z}\\ p_{w}q_{x}+p_{x}q_{w}+p_{y}q_{z}-p_{z}q_{y}\\ p_{w}q_{y}-p_{x}q_{z}+p_{y}q_{w}+p_{z}q_{x}\\ p_{w}q_{z}+p_{x}q_{y}-p_{y}q_{x}+p_{z}q_{w}\end{array} \right] \tag{2}\]  
A finger can be thought of as three links that are the phalanges and three joints that are the articulations between them. Usually, in robotics, the transformation matrices are referenced to the last link, but in this case, using IMUs, the orientation estimated is in the global frame of reference.