# Location-Aware Point-to-Point RPL in Indoor IR-UWB Networks
## 3 UWB-Based Cooperative Multi-Hop Self Localization
### Mobile Node Tracking Based on the Inertial Navigation System with Particle Filtering
Assuming that the frame relationship between the smartphone body and the pedestrian is fixed, we can use a smartphone inertial sensor to measure changes in the pedestrian moving direction. To get the current orientation quaternion state of each particle, we need to sample the rotation quaternion values \(\Delta\mathbf{q}\) that represent the total angle the device has rotated since the last state update:  
\[\left\{\Delta\mathbf{q}_{j,k}^{l}\mid l\in\left\{1,\cdots,N_{p}\right\} \right\}\sim p\left(\Delta\mathbf{q}_{j,k}\mid\mathbf{\gamma}_{(k-1):k}\right) \tag{13}\]Now all particles can update their position and orientation state vectors according to the sampled input values and the pedestrian motion model. The quaternion state of each particle is updated as follows:  
\[\mathbf{q}_{j,k+1}^{l}=\Delta\mathbf{q}_{j,k}^{l}\otimes\mathbf{q}_{j,k}^{l}, \hskip 14.226378 ptl=1,...,N_{p} \tag{14}\]  
where  
\[\mathbf{q}\otimes\mathbf{q}^{\prime}= \begin{bmatrix}q_{0}&-q_{1}&-q_{2}&-q_{3} \\ q_{1}&q_{0}&-q_{3}&q_{2}\\ q_{2}&q_{3}&q_{0}&-q_{1}\\ q_{3}&-q_{2}&q_{1}&q_{0}\end{bmatrix}\begin{bmatrix}q_{0}^{\prime}\\ q_{1}^{\prime}\\ q_{2}^{\prime}\\ q_{3}\end{bmatrix}  \tag{15}\]  
The orientation quaternion represents the 3D orientation. The orientation quaternion is used to calculate the 2D orientation that the mobile node is currently facing. \[\psi_{j,k+1}^{l}=arctan\frac{2\left(q_{0,j,k+1}^{l}q_{3,j,k+1}^{l}+q_{1,j,k+1} ^{l}q_{2,j,k+1}^{l}\right)}{1-2\left\{\left(q_{2,j,k+1}^{l}\right)^{2}+\left( q_{3,j,k+1}^{l}\right)^{2}\right\}},\hskip 14.226378 ptl=1,...,N_{p} \tag{16}\]  
After sampling the moving distance and heading direction of each particle, the position state is updated as follows:  
\[\mathbf{r}_{j,k+1}^{l}=\mathbf{r}_{j,k}^{l}+\Delta\lambda_{j,k}^{l} \begin{bmatrix} cos\left(\psi_{j,k+1}^{l}\right)\\ sin\left(\psi_{j,k+1}^{l}\right)\end{bmatrix} ,\hskip 14.226378 ptl=1,...,N_{p} \tag{17}\]  
After the movement tracking, the B-box state of the mobile node is determined as the smallest rectangle that contains all the survived particles, which is shown in Figure 3.  
After multiple iterations of the particle filtering process, the weights are concentrated on a small number of particles. We need to resample the set of particles to avoid the situation where the weight of a few particles dominate the rest of the samples. However, frequent resampling may cause the side effects such as sample impoverishment, so we need a criterion for implementing  
Figure 3: The process of adjusting weights in Particle Filtering. resampling. The effective sample size (ESS) is a representative criterion when to perform the resampling procedure [24]. \[ESS_{j,k}=\left(\sum_{l=1}^{N_{\tau}}\left(\omega_{j,k}^{l}\right)^{2}\right)^{-1} \tag{18}\]  
Resampling is performed when the ESS is lower than the selected threshold \(\tau_{ESS}\). To avoid uncensored discarding of low-weighted particles, we use a method called deterministic resampling [25]. The deterministic resampling method keeps the original state density strictly, allowing particle filter to maintain sample diversity without sample impoverishment problems [26]. Figure 4 shows the CDF of the average estimated errors for the proposed cooperative multi-hop positioning algorithm. Decawave DW1000 device is used for distance measuring in physical radio channel. In basic simulation network configurations, 200 stationary nodes are randomly deployed in a \(150\,\mathrm{m}\times 150\,\mathrm{m}\) network area while anchor nodes are deployed at every \(25\,\mathrm{m}\), \(50\,\mathrm{m}\), \(75\,\mathrm{m}\), \(100\,\mathrm{m}\), \(125\,\mathrm{m}\), \(150\,\mathrm{m}\). Five mobile nodes are moving continuously with slow random walking speed and operate as leaf nodes without intermediate route forwarding features in route discovery procedures [27; 28].