# Intelligent Fusion Structure for Wi-Fi/BLE/QR/MEMS Sensor-Based Indoor Localization
## 3 Mems Sensor-Based Localization, Optimization, and Evaluation Framework
### Design of Inertial Odometry  
Conventional MEMS sensor-based pedestrian tracking approaches typically incorporate PDR and INS mechanizations, which are susceptible to cumulative errors from built-in sensors, indoor artificial interference, and complex motion modes. In this section, a pre-integrated INS model is applied that takes into account the measurement biases of the inertial sensors, and it is further combined with multi-level observations to obtain higher trajectory-modeling precision.  
(1) The measurement model for inertial sensors: Because of the low-cost nature of MEMS sensors, the estimated biases of accelerometers and gyroscopes need to be compensated in real time for error constraint. The modeled outputs for acceleration and angular rate are described as [23]:  
\[\left\{\begin{array}{l}a^{-}(t)=a(t)+b_{a}(t)+R_{w}(t)g^{w}+n_{a}\\ w^{-}(t)=w(t)+b_{w}(t)+n_{w}\end{array}\right. \tag{1}\]  
where \(a^{-}(t)\) and \(w^{-}(t)\) represent a modeled real-time measurement of acceleration and angular rate information; \(a(t)\) and \(w(t)\) represent ideal acceleration and angular rate data; \(R_{w}(t)\) indicates the attitude matrix with timestamp \(t\); and \(g^{w}\) indicates the local gravity value. \(n_{a}\) and \(n_{w}\) are the measurement noises that are the derivatives of \(b_{a}(t)\) and \(b_{w}(t)\), both following the Gaussian distribution. In this case, the biases of the accelerometer and the gyroscope are modeled as the random walk procedure:  
\[\left\{\begin{array}{l}\dot{b}_{a}(t)=n_{h_{a}},n_{b_{a}}\sim N(0,\sigma_{b_ {a}}^{2})\\ \dot{b}_{w}(t)=n_{h_{w}},n_{h_{w}}\sim N(0,\sigma_{b_{w}}^{2})\end{array}\right. \tag{2}\]  
(2) Pre-integration: For two adjacent sampling periods [\(t_{u}\), \(t_{u+1}\)], the 3D location \(P_{b_{u+1}}^{b_{u}}\), speed \(V_{b_{u+1}}^{b_{u}}\), and attitude \(\phi_{b_{u+1}}^{b_{u}}\) information can be updated based on the last moment of motion information and estimated sensor bias:  
\[\left\{\begin{array}{l}P_{b_{u+1}}^{b_{u}}=\int_{t\in[t_{u},t_{u+1}]}R_{t}^ {b_{u}}(a^{-}(t)-b_{a}(t))dt^{2}\\ V_{b_{u+1}}^{b_{u}}=\int_{t\in[t_{u},t_{u+1}]}R_{t}^{b_{u}}(a^{-}(t)-b_{a}(t)) dt\\ \phi_{b_{u+1}}^{b_{u}}=\int_{t\in[t_{u},t_{u+1}]}\frac{1}{2}\Omega(w^{-}(t)-b_{w}(t)) \phi_{t}^{b_{u}}dt\end{array}\right. \tag{3}\]  
where \(R_{t}^{b_{u}}\) is the rotation matrix and \(\Omega\) is described as:  
\[\Omega(w)=\left[\begin{matrix}-\lfloor\mathbf{w}\times\rfloor&\mathbf{w}\\ -\mathbf{w}^{T}&0\end{matrix}\right],\lfloor w\times\rfloor=\left[\begin{matrix}0 &-w_{z}&w_{y}\\ w_{z}&0&-w_{x}\\ -w_{y}&w_{x}&0\end{matrix}\right] \tag{4}\]  
where \(\mathbf{w}=\begin{bmatrix}w_{x}&w_{y}&w_{z}\end{bmatrix}\) indicates the three-axis angular velocity vector.  
(3) Error correction: Following the sensor-bias-estimation procedure, the updated bias is further applied to the model correction using first-order approximations:  
\[\begin{array}{l}P_{b_{u+1}}^{b_{u}}\approx\delta_{b_{u+1}}^{b_{u}}+I_{b_{u }}^{P}\delta b_{a_{u}}+I_{b_{w}}^{P}\delta b_{w_{u}}\\ V_{b_{u+1}}^{w_{u}}\approx\delta_{b_{u+1}}^{b_{u}}+I_{b_{u}}^{P}\delta b_{a_{u }}+I_{b_{w}}^{P}\delta b_{w_{u}}\\ \phi_{b_{u+1}}^{b_{u}}\approx\delta_{b_{u+1}}^{b_{u}}\otimes\left[\begin{array} []{c}1\\ \frac{1}{2}I_{b_{w}}^{\phi}\delta b_{w_{u}}\end{array}\right]\end{array} \tag{5}\]In the case of indoor artificial disturbances and complex motion modes, errors in the corrected motion information also cumulate, so additional observations are required to further minimize errors.