# GridiLoc: A Backtracking Grid Filter for Fusing the Grid Model with PDR Using Smartphone Sensors

^{1}

^{2}

^{3}

^{*}

## Abstract

**:**

## 1. Introduction

- We innovatively combine the grid filter and PDR for indoor localization on smartphones. The proposed algorithm can achieve accurate pedestrian tracking by using the grid model and the inertial sensors embedded in smartphones, without relying on any wireless infrastructures.
- We propose a backtracking grid filter algorithm. The historical tracking data are used to tackle the dead ending issues, thereby eliminating the tracking failure caused by the accumulative error of PDR. Meanwhile, a topological graph is introduced for representing candidate backtracking points, which can largely reduce the time consumption of backtracking. In certain cases, the historical tracking data can also be used to automatically calibrate the step length model of PDR.
- We evaluate the accuracy, reliability and computational complexity of GridiLoc in a multi-floor experimental environment. Experimental results show the GridiLoc achieves a higher accuracy and reliability than the map filtering approach, especially in complex indoor environments. We implement GridiLoc, which runs smoothly on Android smartphones, proving its low and acceptable computational complexity.

## 2. Related Works

## 3. Overview of GridiLoc

Algorithm 1. GridiLoc (${x}_{0}$, ${l}_{0}$, $M$, $G$, $z$, $r$). |

INPUT: A user’s initial location ${x}_{0}$ on the ${l}_{0}$-th floor, the grid model $M$, the topological graph $G$, a set of estimated step lengths and headings $z$ and the raw sensor data $r$ from Time 1 to $N$. |

OUTPUT: The trajectory $tr=\{{x}_{1},{x}_{2},\dots {x}_{N}\}$. |

$[\{{p}_{k,0}\},{M}_{{l}_{0}}]\leftarrow $ Initialization (${x}_{0}$, ${l}_{0}$, $M$); {Initialize the probability grids} |

$v\leftarrow {x}_{0}$; {The last visited topology node} |

for t $\leftarrow $ 1 to N do |

if the movement on stairs or elevators between time m and n is captured, then |

${x}_{t}$ is set as the location of the captured landmark; |

$v\leftarrow {x}_{t}$; |

${l}_{0}\leftarrow $${l}_{0}$ + ChangedLevel ($\{{r}_{i},m<i<n\}$); |

$[\{{p}_{k,0}\},{M}_{{l}_{0}}]\leftarrow $ Initialization(${x}_{t}$, ${l}_{0}$, $M$); |

continue; |

end; |

if a turning corner event is captured, then |

$v$ is set as the location of the captured landmark; |

end; |

$\left\{{p}_{k,t}\right\}\leftarrow $ Prediction ($\left\{{p}_{k,t-1}\right\}$, ${x}_{t-1}$, ${z}_{t}$); |

$[{x}_{t},\{{p}_{k,t}\}]\leftarrow $ Update ($\left\{{p}_{k,t}\right\}$, ${M}_{{l}_{0}}$); |

if T continuous dead ending events are captured, then |

Let $S$ and $O$ be the step lengths and headings from time (t – T + 1) to t; |

${x}_{t-T+1}\leftarrow $ Backtracking ($G$, $v$, ${x}_{t-T+1}$, $S$, $O$); |

Recalculate the user’s trajectory from time t – T + 2 to t; |

end; |

end; {of for} |

## 4. PDR-Based Grid Filter

#### 4.1. Initialization

#### 4.2. Prediction

- Determine a buffer: Normally, the grid filter needs to traverse all of the cells of the grid model in order to calculate the probability of each cell. However, the computational load becomes quite high when the number of cells is huge. To reduce the computational load, a buffer mechanism is introduced. A buffer is defined as a subset of a complete grid model, and it represents the search region of a user’s current state. The range of a buffer depends on the user’s previous location and walking speed. As depicted in Figure 2, the buffer in this paper is denoted by a rectangle with a side length of seven-times the cell size (0.7 m) and centering at the previous state, given the fact that a user’s walking distance in one step cannot be over two meters. In the prediction and update stage, we just need to calculate the probabilities of the cells within the buffer and rule out the other cells directly.
- Calculate the prior probability: The estimated step length and heading derived from smartphone inertial sensors are generally inaccurate. Thus, they need to be sampled, and more than one candidate cell may be produced in the buffer. A pair of step length and heading can be represented by a directed line segment with the starting point as the center of the buffer, while the sampled ending point is determined by the sampled step length and heading. For the candidate cells in the buffer, their prior probabilities are calculated by using Equation (1), which equal the sum of the probabilities of the sampled ending points located in the candidate cells. The probability of a sampled ending point is the joint probability of its sampled heading and step length, denoted by $\overline{p}({d}^{k})$ and $\overline{p}({\theta}^{k})$, respectively. The Probability Density Function (PDF) of the step length and heading is approximated as a Gaussian distribution; thus, the probability of a sampled step length or heading can be calculated through Equation (2), where ${{r}_{t}}^{i}$ is the step length or heading of the i-th sample at time t. The standard deviation of the Gaussian distribution for the step length or heading is denoted by $\sigma $. The mean value of the step length or heading at time t is denoted by ${z}_{t}$, which is the estimated step length or heading at time t.

#### 4.3. Update

## 5. Backtracking

#### 5.1. Dead Ending

#### 5.2. Backtracking Algorithm

- First, the last visited topology node v is recorded and updated during tracking. When T successive dead ending events at location $x$ have been captured, the heading estimation h on the path from v to $x$ is then calculated. Based on node v, another node if found in the topological graph such that the node is linked to v and that the difference between the link direction and h is below a threshold H. This node is selected as an initial candidate node. If only one candidate node exists, this node will be treated as the backtracking point.
- Otherwise, the topology nodes linked to the candidate nodes are used to identify the correct candidate node, which are called association nodes. The average heading estimation in dead ending states is denoted by $o$, and the direction from a candidate node to its corresponding association node is denoted by ${o}^{\prime}$. The candidate node whose direction ${o}^{\prime}$ is closest to $o$ is then treated as an optimal backtracking point.
- However, if there still exists more than one optimal backtracking points, the one with the nearest distance to $x$ is chosen as the backtracking point.

#### 5.2.1. Single Node

#### 5.2.2. Multiple Nodes

Algorithm 2. Backtracking ($G$, $v$, $x$, $S$, $O$). |

INPUT: A topological graph $G$, the last visited topology node $v$, the location where the dead ending occurs $x$, a set of estimated step lengths $S$ and headings $O$ during the dead ending state. |

OUTPUT: The inferred location $\overline{x}$ at the starting time of the dead ending. |

$B\leftarrow null$; {Candidate backtracking points} |

Let $h$ be the orientation from $v$ to $x$; |

for $\forall (p,v)\in G$, do |

Let ${h}^{\prime}$ be the orientation from $v$ to $p$; |

if $\left|{h}^{\prime}-h\right|<H$, then {$H$ is a heading threshold} |

$B\leftarrow B\cup \left\{p\right\}$; |

end; |

end; {of for} |

if size($B$) == 1, then { Only one element exists in $B$} |

$\overline{x}\leftarrow {B}_{1}$; |

UpdateStepModel ($v$, $x$, $S$, $O$); |

return; |

end |

else {Association topology nodes are used as the criteria} |

$L\leftarrow size(O)$; |

$o\leftarrow \frac{{\displaystyle \sum _{l=1}^{L}{O}_{l}}}{L}$; {$o$ is the mean value of the heading array O} |

${B}^{\prime}\leftarrow \left\{{B}_{1}\right\}$; |

${d}^{\prime}\leftarrow \mathrm{max}\_value$; |

for $i\leftarrow $ 1 to size($B$) do |

${p}^{\prime}\leftarrow {B}_{i}$; |

for $\forall ({p}^{\prime},c)\in G$ do |

Let ${o}^{\prime}$ be the orientation from ${p}^{\prime}$ to $c$; |

$d=\Vert {o}^{\prime}-o\Vert $; |

if $d=={d}^{\prime}$ then |

if ${p}^{\prime}\notin {B}^{\prime}$ then |

${B}^{\prime}\leftarrow {B}^{\prime}\cup \left\{{p}^{\prime}\right\}$; |

end; |

end; |

if $d<{d}^{\prime}$ then |

${d}^{\prime}\leftarrow d$; |

if ${p}^{\prime}\notin {B}^{\prime}$ then |

${B}^{\prime}\leftarrow \left\{{p}^{\prime}\right\}$; |

end; |

end; |

end; {of for} |

end; {of for} |

end; |

if size(${B}^{\prime}$) == 1, then { Only one element exists in ${B}^{\prime}$} |

$\overline{x}\leftarrow {{B}^{\prime}}_{1}$; |

return; |

end |

else {The point ${p}^{\prime}$ in ${B}^{\prime}$ with the shortest path distance to $x$ is picked} |

${d}^{\prime}={A}^{\ast}({{B}^{\prime}}_{1},x)$; {Calculate the path distance with ${A}^{\ast}$ algorithm} |

$m=1$; |

for k $\leftarrow $ 2 to size(${B}^{\prime}$), do |

$d\leftarrow {A}^{\ast}({B}_{k}^{\prime},x)$; |

if $d<{d}^{\prime}$, then |

${d}^{\prime}\leftarrow d$; $m\leftarrow k$; |

end; |

end; {of for} |

$\overline{x}\leftarrow {{B}^{\prime}}_{m}$; |

return; |

end; |

## 6. Experiments

#### 6.1. Experimental Setup

#### 6.1.1. Experimental Testbed

#### 6.1.2. Parameter Setting

#### 6.2. Localization Accuracy and Reliability

#### 6.3. Localization Performance

#### 6.4. Impact of Threshold T

#### 6.5. Adaptivity of the Step Length Model

#### 6.6. Energy Consumption

## 7. Discussion

## 8. Conclusions

## Acknowledgments

## Author Contributions

## Conflicts of Interest

## References

- Hazas, M.; Scott, J.; Krumm, J. Location-aware computing comes of age. Computer
**2004**, 37, 95–97. [Google Scholar] [CrossRef] - Worboys, M. Modeling indoor space. In Proceedings of the 3rd ACM SIGSPATIAL International Workshop on Indoor Spatial Awareness, Chicago, IL, USA, 1–4 November 2011; pp. 1–6.
- Shang, J.; Hu, X.; Gu, F.; Wang, D.; Yu, S. Improvement schemes for indoor mobile location estimation: A survey. Math. Probl. Eng.
**2015**, 2015, 397298. [Google Scholar] [CrossRef] - Harle, R. A survey of indoor inertial positioning systems for pedestrians. IEEE Commun. Surv. Tutor.
**2013**, 15, 1281–1293. [Google Scholar] [CrossRef] - Li, F.; Zhao, C.; Ding, G.; Gong, J.; Liu, C.; Zhao, F. A Reliable and Accurate Indoor Localization Method Using Phone Inertial Sensors. In Proceedings of the 2012 ACM Conference on Ubiquitous Computing (UbiComp’12), Pittsburgh, PA, USA, 5–8 September 2012; pp. 421–430.
- Zampella, F.; Jiménez Ruiz, A.R.; Seco Granja, F. Indoor Positioning Using Efficient Map Matching, RSS Measurements, and an Improved Motion Model. IEEE Trans. Veh. Technol.
**2015**, 64, 1304–1317. [Google Scholar] [CrossRef] - Klepal, M.; Beauregard, S. A backtracking particle filter for fusing building plans with PDR displacement estimates. In Proceedings of the 5th Workshop on Positioning, Navigation and Communication (WPNC 2008), Hannover, Germany, 27 March 2008; pp. 207–212.
- Imad, A.; Cyril, R.; Christophe, C. Spatial Models for Context-Aware Indoor Navigation Systems: A Survey. J. Spat. Inf. Sci.
**2012**, 1, 85–123. [Google Scholar] - Stevenson, G.; Ye, J.; Dobson, S.; Nixon, P. LOC8: A location model and extensible framework for programming with location. IEEE Pervasive Comput.
**2010**, 9, 28–37. [Google Scholar] [CrossRef][Green Version] - Becker, C.; Dürr, F. On location models for ubiquitous computing. Pers. Ubiquitous Comput.
**2005**, 9, 20–31. [Google Scholar] [CrossRef] - Choset, H.; Burdick, J. Sensor-Based Exploration: The Hierarchical Generalized Voronoi Graph. Int. J. Robot. Res.
**2000**, 19, 96–125. [Google Scholar] [CrossRef] - Fox, D.; Hightower, J.; Liao, L. Bayesian Filtering for Location Estimation. IEEE Pervasive Comput.
**2003**, 2, 24–33. [Google Scholar] [CrossRef] - Xiang, L.; Claramunt, C.; Ray, C. A Grid Graph-Based Model for the Analysis of 2D Indoor Spaces. Comput. Environ. Urban Syst.
**2010**, 34, 532–540. [Google Scholar] - Dieter, F.; Burgard, W.; Thrun, S. Markov Localization for Mobile Robots in Dynamic Environments. J. Artif. Intell. Res.
**1999**, 11, 391–427. [Google Scholar] - Lan, K.C.; Shih, W.Y. On calibrating the sensor errors of a PDR-based indoor localization system. Sensors
**2013**, 13, 4781–4810. [Google Scholar] [CrossRef] [PubMed] - Bao, H.; Wong, W.C. An Indoor Dead-Reckoning Algorithm with Map Matching. In Proceedings of the 9th International Wireless Communications and Mobile Computing Conference (IWCMC), Sardinia, Italy, 1–5 July 2013; pp. 1534–1539.
- Bhattacharya, S.; Floréen, P.; Forsblom, A.; Myllymäki, P.; Nurmi, P.; Pulkkinen, T.; Salovaara, A. Ma$$iv—An Intelligent Mobile Grocery Assistant. In Proceedings of the 8th International Conference on Intelligent Environments (IE), Guanajuato, Mexico, 26–29 June 2012; pp. 165–172.
- Faragher, R.M.; Sarno, C.; Newman, M. Opportunistic Radio SLAM for Indoor Navigation Using Smartphone Sensors. In Proceedings of the Position Location and Navigation Symposium (PLANS), Myrtle Beach, SC, USA, 23–26 April 2012; pp. 120–128.
- Jurgen, B.; Vogt, H. Robust Probabilistic Positioning Based on High-Level Sensor-Fusion and Map Knowledge; ETH, Swiss Federal Institute of Technology, Institute for Pervasive Computing: Zurich, Switzerland, 2003. [Google Scholar]
- Morgan, Q.; Stavens, D.; Coates, A.; Thrun, S. Sub-Meter Indoor Localization in Unmodified Environments with Inexpensive Sensors. In Proceedings of the International Conference on Intelligent Robots and Systems (IROS), Taipei, Taiwan, 18–22 October 2010; pp. 2039–2046.
- Weinberg, H. Using the ADXL202 in Pedometer and Personal Navigation Applications; Analog Devices AN-602 Application Note; Analog Devices, Inc.: Norwood, MA, USA, 2002; Volume 2, pp. 1–6. [Google Scholar]
- Shang, J.; Gu, F.; Hu, X.; Kealy, A. APFiLoc: An Infrastructure-Free Indoor Localization Method Fusing Smartphone Inertial Sensors, Landmarks and Map Information. Sensors
**2015**, 15, 27251–27272. [Google Scholar] [CrossRef] [PubMed] - Zeng, W.; Church, R.L. Finding shortest paths on real road networks: The case for A*. Int. J. Geogr. Inf. Sci.
**2009**, 23, 531–543. [Google Scholar] [CrossRef] - Zhang, L.; Tiwana, B.; Qian, Z.; Wang, Z.; Dick, R.P.; Mao, Z.M.; Yang, L. Accurate online power estimation and automatic battery behavior based power model generation for smartphones. In Proceedings of the Eighth IEEE/ACM/IFIP International Conference on Hardware/Software Codesign and System Synthesis, Scottsdale, AZ, USA, 28 October 2010; pp. 105–114.
- Woodman, O.; Harle, R. Pedestrian localisation for indoor environments. In Proceedings of the 10th International Conference on Ubiquitous Computing (UbiComp ’08), Seoul, Korea, 21–24 September 2008; pp. 114–123.
- Yang, Z.; Wu, C.; Zhou, Z.; Zhang, X.; Wang, X.; Liu, Y. Mobility increases localizability: A survey on wireless indoor localization using inertial sensors. ACM Comput. Surv. CSUR
**2015**, 47. [Google Scholar] [CrossRef]

**Figure 9.**Snapshots of the data collection process and the corresponding screenshots of the in-time tracked trajectories on smartphones. (

**a**) Walking down a corridor; (

**b**) walking through a door; (

**c**) tracking in the corridor; (

**d**) tracking in the large room.

**Figure 13.**Estimated trajectories along the first test path. (

**a**) Estimated trajectories on the first floor; (

**b**) estimated trajectories on the second floor; (

**c**) estimated trajectories on the fourth floor.

**Figure 14.**Estimated trajectories along the second test path. (

**a**) Estimated trajectories on the first floor; (

**b**) estimated trajectories on the second floor; (

**c**) estimated trajectories on the fourth floor.

GridiLoc | Map Filtering (1000 Particles) | Map Filtering (50 Particles) | |
---|---|---|---|

Standard error | 0.79 m | 1.19 m | 3.53 m |

Mean error | 1.27 m | 1.68 m | 2.17 m |

Median error | 1.12 m | 1.38 m | 1.39 m |

67% CEP | 1.45 m | 1.86 m | 1.94 m |

T = 2 | T = 5 | T = 10 | T = 13 | T = 15 | |
---|---|---|---|---|---|

Time | 113.34 s | 79.21 s | 88.00 s | 116.84 s | 122.76 s |

Standard error | 2.36 m | 0.92 m | 0.87 m | 0.89 m | 8.55 m |

Mean error | 1.87 m | 1.45 m | 1.34 m | 1.40 m | 4.57 m |

Median error | 1.23 m | 1.22 m | 1.15 m | 1.19 m | 1.61 m |

67% CEP | 1.66 m | 1.64 m | 1.52 m | 1.56 m | 2.16 m |

Step Length Model Parameter | Tester 1 | Tester 2 | ||
---|---|---|---|---|

Weinberg Distance (m) | GridiLoc Distance (m) | Weinberg Distance (m) | GridiLoc Distance (m) | |

0.5 | 255.3 | 286.6 | 266.2 | 285.1 |

0.54 | 273.7 | 290.4 | 286.4 | 292.5 |

0.58 | 294.5 | 284.8 | 305.5 | 293.1 |

0.62 | 314.1 | 292.1 | 325.7 | 289.5 |

0.66 | 334.5 | 282.9 | 346.3 | 291.3 |

0.7 | 354.9 | 285.8 | 365.6 | 294.8 |

© 2016 by the authors; licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC-BY) license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Shang, J.; Hu, X.; Cheng, W.; Fan, H. GridiLoc: A Backtracking Grid Filter for Fusing the Grid Model with PDR Using Smartphone Sensors. *Sensors* **2016**, *16*, 2137.
https://doi.org/10.3390/s16122137

**AMA Style**

Shang J, Hu X, Cheng W, Fan H. GridiLoc: A Backtracking Grid Filter for Fusing the Grid Model with PDR Using Smartphone Sensors. *Sensors*. 2016; 16(12):2137.
https://doi.org/10.3390/s16122137

**Chicago/Turabian Style**

Shang, Jianga, Xuke Hu, Wen Cheng, and Hongchao Fan. 2016. "GridiLoc: A Backtracking Grid Filter for Fusing the Grid Model with PDR Using Smartphone Sensors" *Sensors* 16, no. 12: 2137.
https://doi.org/10.3390/s16122137