Robust Local Weighted Regression for Magnetic Map-Based Localization on Smartphone Platform

DOI: 10.4236/jcc.2017.53010   PDF   HTML   XML   842 Downloads   1,152 Views   Citations


The magnetic information measured on the smartphone platform has a large fluctuation and the research of indoor localization algorithm based on smart-phone platform is less. Indoor localization algorithm on smartphone platform based on particle filter is studied. Robust local weighted regression is used to smooth the original magnetic data in the process of constructing magnetic map. Use moving average filtering model to filter the online magnetic observation data in positioning process. Compare processed online magnetic data with processed magnetic map collected by smartphone platform and the average matching error is 0.3941uT. Average positioning error is 0.229 meter when using processed online and map data.

Share and Cite:

Meng, Z. , Wang, M. , Wang, E. and Xu, X. (2017) Robust Local Weighted Regression for Magnetic Map-Based Localization on Smartphone Platform. Journal of Computer and Communications, 5, 80-90. doi: 10.4236/jcc.2017.53010.

1. Introduction

Localization system has become an indispensable tool in life and work, we usually use GPS or Beidou to complete the localization function in outdoor environment, but when entering the indoor environment, the GPS signal become weakened and even unable to achieve positioning function. Based on people’s demand for indoor localization services, indoor localization technology in recent years has been a great development. [1] proposed RSSI-based indoor positioning method for concrete hydropower station to provide security for workers; [2] proposed a technology for providing indoor positioning of hospital medical supplies; [3] proposed WIFI-based indoor localization using of sub-regional and curve fitting algorithm with positioning accuracy of 2 meters to 2.5 meters; [4] proposed the use of ZigBee indoor localization, compared to its reference indoor localization system based on WIFI, it has 85% reduction in power and 87% on accuracy.

Localization technology proposed in the past mainly based on ZigBee, Bluetooth, ultrasound, geomagnetism, UWB, RFID, WiFi. Indoor localization algorithms based on ZigBee, Bluetooth [5] [6] and WiFi [3] [7] almost use RSSI technology which needs to add some infrastructure and their accuracy is similar, about 2 meters [3] [4] [5]. Positioning accuracies employing of RFID [8] [9], UWB [10] [11] and ultrasonic [12] [13] are much higher, but they require increasing emission and receiving equipment which also cost much more. Localization system based on geomagnetism [14] [15] has more advantages that it doesn’t need additional equipment support, only relying on magnetic sensor carried by mobile platform, its accuracy can reach 1m in special condition [15]. The magnetic distribution in the indoor environment is mainly caused by the superposition of natural geomagnetism and manmade geomagnetism. Reinforced concrete structure interferes with the indoor magnetic environment, which makes the magnetic information become rich. It is the rich magnetic information that makes indoor localization based on magnetic field come true [16] [17].

In the past, magnetic indoor localization algorithm mostly concentrated on the particle filter algorithm [14] [15]. Most indoor localization experimental platforms are mobile robot equipped with magnetic sensor, and the magnetic information is rarely processed. Equipped with gyroscopes, accelerometers and magnetic sensor, android smartphone makes a good localization platform. But the magnetic sensor is often affected by hard and soft-iron effects, resulting in large fluctuations [18]. This paper analyzes the magnetic information of the mobile platform, and makes use of the robust local weighted regression algorithm to smooth the magnetic original data, which makes the established map more stable and accurate. Online stage moving average filtering model is used to filter the magnetic data which rely by particle filter as observation in the process of indoor localization and the data filtering makes online magnetic data more accuracy.

2. Map Construction and Localization Algorithm

2.1. Magnetic Data Smoothen by Robust Local Weighted Regression Algorithm

The robust local weighted regression algorithm which is proposed by Cleveland [19] makes use of local data to fit the points by polynomials weighted fitting and the polynomial coefficient is estimated by the least square method. In local weighted regression algorithm, for each point, the weight is obtained from the weight function. Fitted value is got by degree polynomial fitting using the weighted least squares method with weight to fit. Then we can get from residual and use new weight instead of to compute new fitted value. After T times of repeats we can get the final fitted value which is called robust local weighted regression fitted value.

Percentage represents the window size, is the number of points occupied by the window, is the smallest value in. The weight is for and the commonly used weight function is


In this paper, is coordinate point and is the corresponding magnetic energy value. Steps of calculating are as follows:

(1) For each magnetic data, compute the corresponding estimated parameters of degree polynomial regression:


is dimensions vector, utilizing degree local weighted regression algorithm to obtain the point, is the fitting value at point:


(2) Define the bisquare weight function as below:


Let be the residual of the fitted value, and be the median of. Define the robustness weights:


(3) Compute new by fitting a degree polynomial using weighted least squares with weight instead of.

(4) Repeatedly carry out steps 2 and 3 for T times, the final is the magnetic fitted value corresponds to point, and this process is called robust local weighted regression.

2.2. Online Magnetic Data Filtering by Moving Average Filtering Model

The moving average filtering model gets the filtered result by averaging the N-1 points before and itself. For the magnetic observation data of the smartphone platform fluctuates violently that can reach, which is beyond the tolerance range of the magnetic-based particle filter location algorithm. Moving average filtering model is used to filter online magnetic data and the filtering algorithm model is described below:


where is the number of moving average points, is the online magnetic data at time.

2.3. Particle Filter Localization Algorithm

Particle Filter algorithm is usually utilized in indoor magnetic localization to estimate the position of user. We use particles to represent user’s position state. When the direction and observation is known, position of user can be estimated by Particle Filter algorithm which is used in the condition that the distribution cannot be measuring but prior. When the algorithm beginning, initial distribution of particles is uniformly and randomly sampled from prior. Then for every particle we calculate the weight by online magnetic observation. Normalizing the particles and

we can get approximation probability. As, tends to equal to. The main steps are shown below.

The motion model is


is two dimensional Gaussian noise. subjects to the Gaussian distribution with as the mean and as the variance:


3. Experiment

Experiments are conducted on the 3rd floor of keji building where is 27 meters long and 7 meters wide in Guilin University of Electronic Technology. The experimental environment is shown in Figure 1 and it is a corridor. Besides the corridor there is student lab in which a large number of experimental instruments help increase the richness of magnetic information. Experimental platform is smartphone Honor7. In the process of magnetic information acquisition and online localization, their directions are set to be the same. In the Y direction, we use 5 meters for a section and keep walking in the sampling process. Corresponding to the X direction, we choose 0.5 meters for interval and the whole sampling process example is shown in Figure 2. After sampling by the phone, each 5-metersmagnetic data are smoothed and mapped in 5 meters long coordinate with interval of 0.1 meter. Finally, two-dimensional plane interpolation is carried out to get total magnetic map with interval of 0.1 meter in both X and Y direction.

Figure 1. Experiment environment

Figure 2. Magnetic map sampling process.

3.1. Simulation of Robust Local Weight Regression

In the process of smoothing, numbers of iterations is set as empirical value of 5 and polynomial degree as 2 which means the local fitting objective function is.Windows size need to adjust the amount change of mag-

netic data for there is not available empirical value. So we only discuss the size of window and set be 0.01, 0.06 and 0.15. Simulation results show Figure 3.

Magnetic data of 5 meters long are used to simulation. From the simulation results, when, due to the window size is too small, there has been overfitting phenomenon. When, the window size is set properly, so the fitting result is better. When, due to the window size is too large, the fitting is in underfitting state and the fitting curve can’t represent the original data.

(a)(b) (c)

Figure 3. Simulation result of Robust local weighted regression with equals of 0.01 (a); 0.06 (b) and 0.15 (c).

3.2. Simulation Moving Average Filter Model

As the indoor localization has high demand of real-time, so in the process of filtering magnetic data, both filtering time and data stability have to be considered. Limited by experimental phone’s sampling frequency 100 HZ and the real-time is difficult to present by simulation, so the algorithm is only validated by simulation and there is no analysis about the number of moving average points. Set average number, final magnetic observation is made by filtering the magnetic data within 0.5 seconds before the time point. We sample single point for 60 seconds and obtain 6000 sets of magnetic data. Moving average filtering model is used to filter the obtained data, simulation result is shown in Figure 4.

From the simulation results, filtered data have great improvements compared to the original data in stability. Although there are still fluctuations, taking into account the real-time factors, these fluctuations can be acceptable.

3.3. Online Measurement Data and Map Data Comparison

Construct magnetic map by robust local weighted regression algorithm and compare the map with online magnetic observation processed by filter model to validate the two methods. Figure 5 shows the matching result of the map created by the smoothing process and the online processed magnetic data. Figure 6 shows the matching result of the map created by original magnetic data and original online magnetic data. Figure 5 shows a better match error of and Figure 6 shows match error of relatively. Matching result indicates that the processed magnetic data are more stable and have higher matching degree.

3.4. Online Simulation of Particle Filter

Through the above process, we get the magnetic map and online observation data which are used to simulate on platform MATLAB. The step length in walking and simulation are set the same of 0.5 meter, the variance of the weight func-

Figure 4. Filter result by moving average filter with window size of 50 points.

Figure 5. Matching result by processed data.

Figure 6. Matching result by original data.

tion is, number of particles is 100, initial distribution is evenly distri- buted in the range of (0 cm, 0 cm) to (100 cm, 2700 cm). Particle filter simulation results by processed data and unprocessed data are shown in Figure 7 and the localization errors are shown in Figure 8.

After the particles converge, the positioning results are analyzed as follows. Simulation result by unprocessed data is lower in stability and accuracy than the processed data. The average error using processed data is 0.229 meter compared to the unprocessed data’s 0.394. 96.9% of the localization errors are lower than 0.5 meter by processed data but unprocessed data’s 77.3%.

4. Conclusion

In this paper, robust local weighted regression algorithm is used to smooth the magnetic original data. Online magnetic observation data are filtered by moving average filter. Compare processed magnetic map and online processed magnetic observation, the average error of data matching is 0.3941uT. Indoor localization based on particle filter using processed map and online observation shows ave-

Figure 7. Simulation trajectory.

Figure 8. Localization error comparison between different data and the red line is localization error by original data and blue line is by processed data.

rage positioning error of 0.229 meter which is relatively better. But the problem is also exists, this result is in experimental environment. In the procedure of map construction and online data obtained, the height and direction of smartphone are same. We have to solve these problems by adding other algorithm such as magnetic sensor calibration algorithm or using magnetic variation as observation.


This work is supported by the National Natural Science Foundation of China (No.61371107), the Guangxi Experiment Center of Information Science (No.LD16061X), the Guangxi Natural Science Foundation (No.2016GXNSFBA38014), and the China Postdoctoral Science Foundation (No.2016M602921XB).

Conflicts of Interest

The authors declare no conflicts of interest.


[1] Lin, P., Li, Q., Fan, Q., Gao, X. and Hu, S. (2014) A Real-Time Location-Based Services System Using WiFi Fingerprinting Algo-rithm for Safety Risk Assessment of Workers in Tunnels. Math. Prob. Eng., 2014, 371 456-1-371 456-10.
[2] Jeong, S.Y., Jo, H.G. and Kang, S.J. (2014) Fully Distributed Monitoring Architecture Supporting Multiple Trackees and Trackers in Indoor Mobile Asset Management Application. Sensors, 14, 5702-5724.
[3] Wang, B., Zhou, S., Liu, W., et al. (2015) Indoor Localization Based on Curve Fitting and Location Search Using Received Signal Strength. IEEE Transactions on Industrial Electronics, 62, 572-582.
[4] Niu, J., Wang, B., Shu, L., et al. (2015) ZIL: An Energy-Efficient Indoor Localization System Using ZigBee radio to Detect WiFi Fingerprints. IEEE Journal on Selected Areas in Communications, 33, 1-1.
[5] Pei, L., et al. (2010) Using Inquiry-Based Bluetoothrssi Probability Distributions for Indoor Positioning. J. Glob. Positioning Syst., 9, 122-130.
[6] Bargh, M.S. and de Groote, R. (2008) Indoor Localization Based on Response Rate of Bluetooth Inquiries. In: Proc. ACM Int. Workshop Mobile Entity Localization Tracking GPS-Less Environ, 49-54.
[7] Yang, L., Chen, H., Cui, Q., et al. (2015) Proba-bilistic-KNN: A Novel Algorithm for Passive Indoor-Localization Scenario. Vehicular Technology Conference. IEEE, 1-5.
[8] Zhang, Z., Lu, Z., Saakian, V., et al. (2014) Item-Level Indoor Localization With Passive UHF RFID Based on Tag Interaction Analysis. IEEE Transactions on Industrial Electronics, 61, 2122-2135.
[9] Papapostolou, A. and Chaouchi, H. (2011) RFID-Assisted Indoor Localization and the Impact of Interference on Its Performance. Journal of Network & Computer Applications, 34, 902-913.
[10] Venkatesh, S. and Buehrer, R.M. (2007) NLOS Mitigation Using Linear Programming in Ultrawideband Location-Aware Networks. IEEE Trans. Veh. Technol., 56, 3182-3198.
[11] Guvenc, I., Chong, C.-C. and Watanabe, F. (2007) NLOS Identification and Mitigation for UWB Localization Systems. In: Proc. IEEE WCNC, Mar. 2007, 1571-1576.
[12] Huang, W., Xiong, Y., Li, X.Y., et al. (2015) Swadloon: Direction Finding and Indoor Localization Using Acoustic Signal by Shaking Smartphones. IEEE Transactions on Mobile Computing, 14, 2145-2157.
[13] Choi, K.H., Ra, W.-S., Park, S.-Y. and Park, J.B. (2014) Robust Least Squares Approach to Passive Target Localization Using Ultrasonic Receiver Array. IEEE Trans. Ind. Electron., 61, 1993-2002.
[14] Haverinen, J. and Kemppainen, A. (2009) Global Indoor Self-Localization Based on the Ambient Magnetic Field. Robotics & Autonomous Systems, 57, 1028-1035.
[15] Xie, H., Gu, T., Tao, X., et al. (2014) MaLoc: A Practical Magnetic Fingerprinting Approach to Indoor Localization Using Smartphones. Proceedings of the 2014 ACM International Joint Conference on Pervasive and Ubiquitous Computing. ACM, 243-253.
[16] Yamazaki, K., Kato, K., Ono, K., Saegusa, H., Tokunaga, K., Iida, Y., Yamamoto, S., Ashiho, K., Fujiwara, K. and Takahashi, N. (2003) Analysis of Magnetic Disturbance Due to Buildings. IEEE Transactions on Magnetics, 39, 3226-3228.
[17] Casinovi, G., Geri, A. and Veca, G.M. (1989) Magnetic Field near a Concrete Wall during a Lightning Stroke. IEEE Transactions on Magnetics, 25, 4006-4008.
[18] Ozyagcilar, T. (2012) Calibrating an eCompass in the Presence of Hard and Soft-Iron Interfe-rence. Freescale Semiconductor Ltd.
[19] Cleveland, W.S. (1979) Robust Locally Weighted Regression and Smoothing Scatterplots. Journal of the American Statistical Association, 74, 829-836.

comments powered by Disqus

Copyright © 2020 by authors and Scientific Research Publishing Inc.

Creative Commons License

This work and the related PDF file are licensed under a Creative Commons Attribution 4.0 International License.