Indoor Tracking, Mapping, and Navigation: Algorithms, Technologies, and ApplicationsView this Special Issue
Research Article | Open Access
An Improved Particle Filter Algorithm for Geomagnetic Indoor Positioning
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.
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 .
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 . 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 , and extended Kalman filter (EKF)  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  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  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.  proposed an indoor positioning system using smartphones. They used a particle filter to estimate the users’ location based on geomagnetic anomalies  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 . 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 . 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 . 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 : where represents the maximum distance between ai and bi 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 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.
3. Experiments and Analysis
3.1. Data Collection System Development: A Geomagnetic Data Acquisition Robot
The construction of a geomagnetic fingerprint model is a prerequisite for geomagnetic indoor positioning technology. In order to quickly and effectively establish a fingerprint model, a data acquisition robot has been developed by Urban Surveying and Mapping Institute which includes data acquisition module and control module as shown in Figure 2 . The robot is loaded with a HMC5983 three-axis magnetic sensor placed at a height of 1.3 meters above the floor. The placement of sensor at such a height is to separate the magnetic sensor to avoid interference by the robot itself. The robot is controlled by the control module. Data through the USB cable real-time are imported to the computer, through openMAT software to save geomagnetic data and record, while the magnitude was calculated. Finally, we use the MATLAB-based software to conduct position determination in the computer. Since the magnetic sensor itself will produce a relatively stable interference field when energized , we must correct the HMC5983 magnetic sensor in the data acquisition module to ensure the authenticity of the data before collecting data. The rotation of the magnetic sensor around the z-axis of its own coordinate system will generate the corresponding circle based on the magnitude of the x-axis and the y-axis magnetic field. However, due to the presence of an interference field, the location of the center of the circle will move a short distance. The interference can be eliminated by adding a fixed value to the output value of the magnetic sensor, as shown in Figure 3.
The method to correct the value of the HMC5983 magnetic sensor and the x-axis and y-axis magnetic field offset is given as follows: where and are the maximum and minimum values, respectively; is the original magnetic field value on the x-axis and y-axis; and is the compensation of the x-axis and y-axis direction of the magnetic field value.
3.2. Experimental Data Collection and Fingerprint Model Construction
The experimental data acquisition was conducted in the 2nd floor of the Institute of Surveying and Mapping at Beijing University of Civil Engineering and Architecture (BUCEA). The frames of the building are reinforced concrete. Figure 4 shows a simple plan of the corridor with a total length of 68 meters. The magnetic field was measured every 25 Hz producing a three-dimensional vector , in units of μT.
In order to prove the defect of particle filter algorithm, we randomly collected a row of data in the corridor. Figure 5 shows the magnetic field distribution in the corridor which is linear and continuous, and the magnetic field intensity of different locations is likely to be the same. This proves that when the particle position is far from the target, it will lead to biased estimate in the particle filter algorithm. An example is shown in Figure 6.
In the corridor, we collected geomagnetic data along four lines of 60 cm apart. For building the fingerprint model, we control the acquisition robot along the planned route to move forward which the step length of robot is 0.2 m with geomagnetic data measurement at a sampling rate of 5 Hz. To perform localization, we use the norm of the magnetic field as the observation, because magnetic field intensity is a rotation invariant scalar quantity. The is given by
The final fingerprint model is created by applying a linear interpolation to the magnetic field intensity using a 0.02 m step size in the computer, as shown in Figure 7, and the map adds the grid coordinates as its relative coordinate frame after it is generated.
4. Positioning Results
The acquisition robot used to take measurements was controlled to travel straight along the corridor, with a step length of 0.6 m. It recorded data every second, iteration times t = 16. In the positioning system, the number of sample particles N is set to 400; each test set was conducted using the same value of the standard deviation of the measurement model , and a total of 20 time tests. The SIS algorithm and the particle filter algorithm with the SIR algorithm are used to investigate the geomagnetic matching precision and the degree of continuous filtering divergence.
The burr in Figure 8 shows that the SIS algorithm has the problem of filtering divergence and geomagnetic matching instability in the geomagnetic matching process. Although the positioning error shows an overall decreasing trend, there is no convergence.
As shown in Figure 9, the addition of the SIR algorithm makes the filtering divergence more serious, and the continuous filtering divergence phenomenon results in the loss of positioning (see ①, ②, ③ in Figure 9). Most of the experiments began to converge after t = 5. The average matching accuracy was 1.78 m and the average run time was 10.9 s. We can see from the comparison of Figures 8 and 9 that after the SIR algorithm is added, the particle is convergent after iteration calculation for a period of time due to its resampling step. The matching accuracy is far superior to that of the SIS algorithm, although positioning loss is also inevitable.
The idea of the positioning error constraint method is shown in Figures 10 and 11. In Figure 10, the dots indicate the sample particles that are randomly selected in the positioning area; the hollow circle represents the initial position of the weighted position and the sign indicates the position of the moving carrier at time t = 1. In Figure 11, the circle which is deformed due to the limitation of the geomagnetic fingerprint model range represents the initial positioning error range. It can be concluded from Figures 10 and 11 that with the establishment of the positioning error constraint after the initial positioning, the sampling particles have a restriction on their maximum distance . It does not use the particles which are far from the true location of target in the positioning process. Due to the reduction in the number of particles, the time of the whole system iterating 16 times is saved (the average running time is 9.1 s).
Figure 12 shows that the initial positioning errors are all within 10 m, which is acceptable for indoor positioning. The experimental results and the positioning error analysis based on the improved particle filter algorithm are shown in Figure 13. In the experiments using the improved algorithm, most particles began to converge at t = 2 and have no loss of positioning as in Figure 9, with an average matching accuracy improved to 0.62 meters. Compared to the particle filter with the SIR algorithm, the improved algorithm can effectively prevent the filter divergence, eliminating location losses. Its convergence rate is faster than that of the classic particle filter algorithm, with an average running time of the whole system iterating 16 times is reduced by 16.15%.
5. Conclusions and Future Work
Indoor geomagnetic disturbance prevents the classical particle filter algorithm from stably finding the location in real time. Although the particle filter algorithm has a strong convergence in the matching accuracy, the particle iteration process is accompanied by the loss of positioning. In this paper, we add the position error constraint to the particle filter algorithm and compare and analyze the advantages and disadvantages of the classical particle filter algorithm with the improved algorithm in matching accuracy, running time, and other aspects by real-field test. The results show that the improved algorithm can solve the persistent divergence problem in the particle filter and avoid the loss of positioning. Under the premise of the single variable feature, it can improve the indoor positioning speed and effectively solve the technical defect in geomagnetic matching. In the future work we will try to combine WLAN and other technologies to achieve effective initial positioning accuracy better than 5 meters.
Conflicts of Interest
The authors declare that they have no conflicts of interest.
This study was supported by National Key Research and Development Program of China (no. 2017YFB0503702).
- M. Angermann, M. Frassl, M. Doniec, B. J. Julian, and P. Robertson, “Characterization of the indoor magnetic field for applications in localization and mapping,” in 2012 International Conference on Indoor Positioning and Indoor Navigation (IPIN), pp. 1–9, Sydney, NSW, Australia, November 2012.
- C. Deng, C. Huang, H. Zhao, and H. Tian, “Review of geomagnetic matching navigation algorithm,” Science Technology and Engineering, vol. 12, no. 24, pp. 6125–6131, 2012.
- Y. Qiao, S. Wang, J. Zhang, and Z. Wang, “Simulation of geomagnetic matching algorithm based on correlation analysis for flying objects,” Progress in Geophysics, vol. 24, no. 2, pp. 721–727, 2009.
- Y. Kong, L. Hao, and J. Xu, “Study on geomagnetic matching algorithm based on Hausdorff distance,” Aero Weaponry, vol. 4, pp. 26–29, 2011.
- X. Wang and Y. Tian, “Autonomous navigation based geomagnetic research,” Chinese Journal of Geophysics, vol. 53, no. 11, pp. 2724–2731, 2010.
- G. Yang, S. Li, and Z. Jiang, “Data fusing algorithm in geomagnetic aided INS,” Journal of Chinese Inertial Technology, vol. 15, no. 1, pp. 47–50, 2007.
- L. C. Boles and K. J. Lohmann, “True navigation and magnetic maps in spiny lobsters,” Nature, vol. 421, no. 6918, pp. 60–63, 2003.
- W. Storms, J. Shockley, and J. Raquet, “Magnetic field navigation in an indoor environment,” in 2010 Ubiquitous Positioning Indoor Navigation and Location Based Service, pp. 1–10, Kirkkonummi, Finland, October 2010.
- B. Li, T. Gallagher, A. G. Dempster, and C. Rizos, “How feasible is the use of magnetic field alone for indoor positioning?” in 2012 International Conference on Indoor Positioning and Indoor Navigation (IPIN), pp. 1–9, Sydney, NSW, Australia, November 2012.
- J. Chung, M. Donahoe, C. Schmandt, I. J. Kim, P. Razavai, and M. Wiseman, “Indoor location sensing using geo-magnetism,” in Proceedings of the 9th international conference on Mobile systems, applications, and services - MobiSys '11, pp. 141–154, Bethesda, MD, USA, June-July 2011.
- R. Hostettler and S. Särkkä, “IMU and magnetometer modeling for smartphone-based PDR,” in 2016 International Conference on Indoor Positioning and Indoor Navigation (IPIN), pp. 1–8, Alcala de Henares, Spain, October 2016.
- E. Le Grand and S. Thrun, “3-axis magnetic field mapping and fusion for indoor localization,” in 2012 IEEE International Conference on Multisensor Fusion and Integration for Intelligent Systems (MFI), pp. 358–364, Hamburg, Germany, September 2012.
- J. Haverinen and A. Kemppainen, “Global indoor self-localization based on the ambient magnetic field,” Robotics and Autonomous Systems, vol. 57, no. 10, pp. 1028–1035, 2009.
- J. Haverinen and A. Kemppainen, “A global self-localization technique utilizing local anomalies of the ambient magnetic field,” in 2009 IEEE International Conference on Robotics and Automation, pp. 3142–3147, Kobe, Japan, May 2009.
- S. E. Kim, Y. Kim, J. Y. Yoon, and E. S. Kim, “Indoor positioning system using geomagnetic anomalies for smartphones,” in 2012 International Conference on Indoor Positioning and Indoor Navigation (IPIN), pp. 1–5, Sydney, NSW, Australia, November 2012.
- Z. Guo, L. Luan, H. Zhu, and P. Cai, “Geomagnetic filtering navigation algorithm based on single spot matching precorrection,” in 2012 Fifth International Symposium on Computational Intelligence and Design, pp. 543–546, Hangzhou, China, October 2012.
- S. Q. Hu, The Principle and Application of Particle Filter, Science Press Co. Ltd, 2010.
- H. Huang, Y. Zhao, C. L. Wang, and G. Yu, “Design of the acquisition system of indoor positioning reference map based on magnetic field data,” Bulletin of Surveying and Mapping, vol. 2, pp. 54–59, 2017.
- W. Shao, F. Zhao, C. Wang et al., “Location fingerprint extraction for magnetic field magnitude based indoor positioning,” Journal of Sensors, vol. 2016, Article ID 1945695, 16 pages, 2016.
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.