Journal of Sensors

Volume 2018, Article ID 5989678, 9 pages

https://doi.org/10.1155/2018/5989678

## An Improved Particle Filter Algorithm for Geomagnetic Indoor Positioning

^{1}School of Geomatics and Urban Spatial Information, Beijing University of Civil Engineering and Architecture, Beijing 102616, China^{2}Beijing Advanced Innovation Center for Future Urban Design, Beijing 100044, China^{3}The University of Calgary, Department of Geomatics Engineering, Calgary, AB, Canada T2N 1N4

Correspondence should be addressed to Wei Li; moc.qq@9578299511 and Dong Wei Qiu; nc.ude.aecub@wduiq

Received 1 April 2017; Revised 7 July 2017; Accepted 13 December 2017; Published 19 March 2018

Academic Editor: Mohannad Al-Durgham

Copyright © 2018 He Huang et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

#### Abstract

Geomagnetic indoor positioning is an attractive indoor positioning technology due to its infrastructure-free feature. In the matching algorithm for geomagnetic indoor localization, the particle filter has been the most widely used. The algorithm however often suffers filtering divergence when there is continuous variation of the indoor magnetic distribution. The resampling step in the process of implementation would make the situation even worse, which directly lead to the loss of indoor positioning solution. Aiming at this problem, we have proposed an improved particle filter algorithm based on initial positioning error constraint, inspired by the Hausdorff distance measurement point set matching theory. Since the operating range of the particle filter cannot exceed the magnitude of the initial positioning error, it avoids the adverse effect of sampling particles with the same magnetic intensity but away from the target during the iteration process on the positioning system. The effectiveness and reliability of the improved algorithm are verified by experiments.

#### 1. Introduction

With the rapid development of location-based services, indoor positioning is receiving increased attention. Indoor positioning technology can be applied to public security, location tracking, intelligent transportation, and so forth. For example, a hospital can locate and monitor patients using indoor positioning technology. Indoor positioning can solve the problem of finding cars in large complexes and underground parking lots; it can also quickly find an optimal shopping route in large shopping malls. Indoor positioning is currently based on technologies such as Wi-Fi, RFID, Bluetooth, UMB, and geomagnetism. Among different technologies for indoor positioning, the geomagnetic indoor positioning approach has broad application prospects because it is infrastructure-free and has geomagnetic signal stability [1].

As early as the 1950s, the geomagnetic positioning technology based on geomagnetic field vector matching was applied to large-scale outdoor environment navigation, including those of surface ships, submarines, and missiles. In the past, the geomagnetic positioning techniques typically used the correlation matching algorithms [2–4] or the recursive filtering algorithms [5, 6]. More recent use of the geomagnetic positioning technology in the indoor environment is considered an important breakthrough. The geomagnetic field in a modern building is disturbed by the steel-reinforced concrete, steel structure, power systems, electronic equipment, and other artificial sources, which forms a unique and spatially continuous geomagnetic signature [7, 8]. The indoor magnetic field can be collected to construct a fingerprint model based on Wi-Fi fingerprint technology. In general, the construction of geomagnetic perturbation fingerprint model can use a variety of characteristic variables, including a single variable (total geomagnetic intensity), double variables (*H* and *V* direction magnetic field components), or three variables (*X*, *Y*, and *Z* direction magnetic field components). The more characteristic variables are included for the position determination, the more improvement can be made on the positioning accuracy [9]. The indoor positioning technology based on the magnetic field matches the magnetic field intensity, which is obtained by the indoor moving carrier, with the geomagnetic disturbance fingerprint model to enable indoor positioning.

At present, the particle filter algorithm, *k*-nearest neighbor [10], and extended Kalman filter (EKF) [11] have been applied in indoor positioning systems based on a fingerprint model. The particle filter developed by Monte Carlo techniques has been widely used as one effective matching algorithm, because of its advantages of broad adaptability in nonlinear and non-Gaussian systems [12–14]. Grand and Thrun [12] presented a real-time indoor localization method that utilizes a single 3-axis magnetometer to estimate the position of a handheld device. Using a particle filter, a localization accuracy of 0.7 meters in position and 25 degrees in orientation was achieved for a simple straight-line trajectory. Haverinen and Kemppainen [13] equipped a robot with a single magnetic sensor that measured three planes. They ran their robot through a corridor, had it collect data at a set of locations to create a map of the hallway, and used Monte Carlo localization (a particle filter) to accurately determine its location from any starting point. The maximum error was about 28 centimeters, but the robot needed to travel 25 meters in order to localize itself in general. Kim et al. [15] proposed an indoor positioning system using smartphones. They used a particle filter to estimate the users’ location based on geomagnetic anomalies [15] and used the distance between the user and the wall as a conditional constraint. The experimental results in the corridor showed that the positioning accuracy is within 3 meters.

The use of particle filters requires the carrier to complete a continuous recursive filter location over a period of time, and it suffers the problem of filtering divergence [16]. The filter convergence however is affected by the distribution of indoor geomagnetic, and a divergence would occur if it lacks indoor geomagnetism signatures. The sparser the characteristics of the indoor geomagnetic field, as many locations have similar magnetic field patterns, the more likely the divergence of the particle filter algorithm occurs, which eventually leads to excessive positioning error.

In response to this challenge, this paper proposes the use of point set matching in the Hausdorff distance measurement method to improve the particle filter algorithm as well as the method of positioning error constraints. In the new particle filter algorithm, the initial positioning error is used as the distance constraint, only allowing particles that meet the constraints to iterate, and resampling. Coupled with the convergence characteristics of the resampling step, we can suppress the effect of persistent divergence. The main contributions of this work include (1) the development of a geomagnetic data acquisition platform, (2) an improved particle filter algorithm to prevent filter divergence, and (3) the design of an offline test system to estimate the location of mobile robots carrying magnetic sensors.

The paper is organized as follows. The classical particle filter algorithm is described in Section 2.1. Section 2.2 briefly outlines the improved algorithm based on the Hausdorff distance. In Section 3, the data acquisition robot is first briefly described, then the data collection is presented, and finally the analysis of the positioning results is provided. The conclusion is given in Section 4.

#### 2. An Improved Particle Filtering Algorithm

##### 2.1. Classical Particle Filter Algorithm

The particle filter algorithm is an optimal Bayesian estimation method based on Monte Carlo’s idea [17]. It is often used to estimate the position of a target moving along the corridor from an unknown location. The particle filter uses Monte Carlo localization (MCL) method to approximate the posterior probability distribution when it is too complex to directly sampled, but the prior probability density can be sampled and the measurement density can be evaluated, where represents the target positioning, represents the particle positioning, and is the observation. The entire particle filtering process consists of three steps, namely, forecasting, updating, and resampling.

The particle filter algorithm follows the general framework of a sequential importance sampling (SIS) algorithm, and it adds the sampling importance resampling (SIR) to solve the sample impoverishment caused by the iterative process. It first generates a set of samples with *N* particles from the prior probability density and then generates the weight according to the measurement density of each particle. The weights are normalized to make their sum equal to one before the resampling. The basic idea of resampling is to remove particles with small weight and concentrate on particles with large weight. Due to easy implementation, the particle filter widely uses such resampling algorithm. The two-dimensional motion model is given by
where , which obeys a uniform distribution; *L* is the moving distance; and

In (2), is the moving direction. We can roughly choose the size of *L* according to the length of the person’s step. The measurement density is based on the single variable Gaussian probability density function, which is given by
where is the covariance of the observation . The function returns the magnetic field intensity of the position in the fingerprint model. Finally, the position of the target is estimated based on the weight of the sample particles, which is given by
and the positioning error is given by

For geomagnetic indoor positioning based on the particle filter, the particle weight is determined by (3) according to the magnetic field intensity of the target and particle in which the closer the geomagnetic intensity, the greater the weight. After removing the particles with the small weights, the estimated position is then calculated by (4). When the difference in the weight of the particle is not large, the deviation of the distance between the particle position and the target position is large [16]. If the particle position is far from the target position, the error between the estimated position and the target position is large. In other words, the estimated position is obtained by weighted sum of the individual particle positions. The greater the value of the Euclidean distance between the target and particles with large weight, the greater the value of . Finally, it will cause greater positioning error as shown by (5). We have further explained it in Section 3.2 by an example.

##### 2.2. An Improved Algorithm Based on Hausdorff Distance

Increasing the characteristic elements of the geomagnetic matching can effectively solve the divergence problem in the particle filter algorithm, but it will also greatly increase the complexity of the original algorithm and the time required for positioning. Inspired by the Hausdorff distance matching, an improved particle filter algorithm based on the Hausdorff distance is proposed and described in the following.

We know that the magnetic field at any point is stable in the static environment and it is unique within a certain range. If the particle filter starts within a reasonable range, the deviation of estimated position will be reduced. The Hausdorff distance can then be applied to determine this reasonable range for the particle filter. The Hausdorff distance is the maximum value of the distance between the two sets of points in space which is defined as follows [4]:
where represents the maximum distance between *a _{i}* and

*b*in the two point sets of and , is a distance norm, and represent two finite sets of points. The Hausdorff distance represents the degree of matching between

_{i}*A*and

*B*.

In general, in the geomagnetic feature matching based on classical particle filtering, we can control the weight of the particles that participate in calculating the estimated position in (4) when their weight becomes large. However, is difficult to control, once its value becomes too large. This will cause filtering divergence. Since is the maximum distance between each particle and the target, it can be controlled. As a result, if this maximum value can be controlled within a reasonable range, we can avoid the problem that becomes large. In order to avoid the effect of human factors, we use the positioning system to estimate the initial position of the target. The constraint to be applied is the initial positioning error between the estimated initial position and the true position of the target in the measurement environment. Let the initial positioning error as ; the following initial positioning error constraint can be established:

The position of the target estimated based on the weight of the sample particles in (4) must satisfy the condition in (7). Using the improved particle filter algorithm, the divergence problem can be avoided because we have removed those particles that had a larger weight but were far from the target. As a result, the positioning results of the positioning system can converge more quickly. The implementation steps of the improved algorithm is given in Algorithm 1 and the flowchart of the implementation process is given in Figure 1.