Indoor Location Method of WiFi / PDR Fusion Based on Extended Kalman Filter Fusion

This paper proposes an indoor positioning method based on extended Kalman filter WiFi-PDR fusion, which aims to improve the accuracy and stability of indoor positioning. In this method, the mobile terminal collects the WiFi fingerprint location information and establishes the fingerprint database. At the same time, using the accelerometer, gyroscope and magnetometer in the mobile terminal, the walking state of the pedestrian is judged by adjusting the dynamic threshold, and the direction detection is completed. After that, adaptive Kalman filter is used to integrate the WiFi location system and the PDR location system to update the user’s location. The results show that the scheme reduces the accumulated error of PDR positioning to a certain extent, and improves the continuity and stability of WiFi Positioning. Therefore, the scheme we propose can effectively improve the positioning accuracy.


Introduction
With the development of information technology, the demand for location-based services is increasing. However, due to the complex indoor environment, the signal degradation of outdoor positioning facilities such as global navigation satellite system (GNSS) is serious indoors, which cannot meet the indoor positioning requirements. Because of the low cost of hardware and the low complexity of the system, the indoor location technology of LAN has been developed gradually. Among them, the principle of using WiFi for positioning is to collect fingerprint database and use fingerprint matching algorithm to estimate the location; For PDR technology [5], the user's location is calculated by combining walking step detection, step size and heading estimation. Both of them have their disadvantages and advantages, so this paper can combine PDR and WiFi to realize the fusion positioning. This scheme can not only calibrate PDR results and reduce accumulated errors, but also improve the accuracy of WiFi Positioning.
Among various WiFi-PDR fusion methods, paper [1][2][3] proposed a particle filter which integrates inertial sensor and WiFi Positioning, However this method needs a lot of computing cost, so it is not suitable for mobile phone location. A WiFi-PDR integration method based on linear Kalman filter is proposed in reference [4]. Because of the nonlinearity of PDR, this method will lead to inaccurate estimation of the covariance of the predicted location error. In paper [6][7], UKF is deployed to integrate WiFi and PDR to solve the non-linear problem of PDR positioning, but the noise parameters in UKF will reduce the positioning accuracy. In this paper, the adaptive extended Kalman filter (AEKF) is used to fuse WiFi fingerprint location data and PDR location data, which can effectively reduce the impact of environmental factors and improve the location accuracy.

Positioning System Implementation
The indoor location method based on WiFi-PDR fusion is mainly used to estimate the current location by the data fusion of WiFi fingerprint location and PDR location. WiFi fingerprint positioning technology mainly obtains RSS data in the current environment and establishes fingerprint database, then uses the database to realize the location; PDR positioning mainly completes the inertial navigation positioning by solving the user's attitude and direction. Finally, the IEKF algorithm is used to fuse the two algorithms, which can effectively improve the positioning accuracy.

Analysis of WiFi Fingerprint Location Method
The main method of WiFi fingerprint location is to establish fingerprint database offline, and then match the fingerprint data at the point to be tested with the database fingerprint data, which can determine the current position. In order to improve the correlation between each location point, KNN indoor location method based on the location range limit is used to estimate the user's location. This method makes use of the data information of the previous position when positioning a certain position coordinate, so as to enhance the correlation between two adjacent positioning points and reduce the positioning error to a certain extent. Using KNN algorithm, the Euclidean distance between the i-th reference point and the point to be located is as follows: The KNN Algorithm based on location-range restriction is designed to limit the range of a fingerprint, in which the position near the user's previous position is given a higher selectivity. It can be expressed as Where , l i W is the penalty function between the i -th reference point at point l to be located and the point. M is the total number of reference points in the database, ( , ) pre pre x y is the coordinate of the user's previous position,  is the maximum distance that the user can move in the continuous sampling interval t . The user's location l can be determined by the weighted average of K nearest neighbors.

PDR positioning method analysis
The specific formula of PDR algorithm is as follows: In the aforementioned expression, k length represents the distance from position 1 k  to position k ,  indicates the heading angle of pedestrian moving from position 1 k  to position k . It can be seen that the study of PDR positioning method requires the study of step frequency, step length and heading angle [9].
(1) Stride frequency detection: The detection of peak value and valley value is constrained by many parameters, so as to achieve high-precision step frequency detection.
(2) Stride length estimation: In general, the step length of human does not always show strict linear relationship. In order to improve the accuracy of step calculation, nonlinear model is used to estimate step length [11]. The nonlinear model is based on the statistics of the acceleration changes in the process of walking, and establishes the calculation model with nonlinear relationship with acceleration. The commonly used nonlinear models is: (3) Course angle estimation: In course estimation, the most commonly used sensors are gyroscopes and magnetometers. The advantages of gyroscope are strong anti-interference and high accuracy in a short time, but the disadvantages are relative azimuth drift; the advantages of magnetometer are relatively stable positioning accuracy, and the disadvantages are easy to be interfered by the outside world. If we combine the two, we can learn from each other. Therefore, it is a feasible method to combine the two methods for course estimation. The system block diagram of the combined system is shown in Figure 1: According to the relationship between attitude angle and attitude matrix, the heading angle can be calculated as: 2 2 2 2 1 2 0 3 0 1 2 3 arctan(2( ) ) q q q q q q q q       ( 7 ) A detector is set up in Figure 1. The function of the detector is to compare the output angular rate of the magnetometer and the gyroscope, and then to analyze the data after the comparison so as to know the influence of electromagnetic interference on the system. Finally, the angular velocity at time is obtained by using the output of magnetometer: In formula (8), is the heading angle, is the time interval. If the difference detected by the detector is small (that is, the magnetic interference is small), the gyroscope/magnetometer can be combined with the acceleration data to calculate the heading angle, and the error of the heading angle can be corrected in real time.

Analysis of adaptive extended Kalman filter fusion positioning method
The basic idea of the algorithm is to fuse the data of the WiFi location and the PDR location by using the adaptive extended Kalman filter, and then feedback the result to the WiFi system and the PDR system, to achieve the previous location of the update operation. Considering the reasons of motion state and motion error, the state variables of the adaptive extended Kalman filter are error caused by moving distance, heading angle error and position error. These state variables can be expressed as: [  Where dN is the error value pointing to the north, dE is the error value pointing to the East, and ds represents the error value when moving. Once the WiFi system is used to update the position, the position difference between the WiFi and PDR systems can be taken as the observation value of the fusion system. The operation can be expressed as follows , , , , In formula (10) p k pk N E is the calculation result of PDR system at k time. According to the information of the above parameters, the state equation of the extended Kalman filter algorithm can be expressed as:

Experiment and Analysis
The experiments in this paper were conducted in laboratory 21A104 and in the corridor on the fourth floor of laboratory 21A of the Harbin Engineering University. Before the experiment, we need to build the WiFi fingerprint database [8]. First, set up the sampling points, then use the equipment to collect multiple groups of RSS data in each sampling point, after that input the data into the fingerprint database together with the reference point location coordinates after the data processing, and finally the experiment is carried out. Test 1: pedestrians move from the initial position to the end of the road at a constant speed. The sampling frequency of the inertial sensor in the device is 100Hz. The Wifi fingerprint is collected at 1 Hz when a pedestrian is walking. During the experiment, the acceleration data collected is shown in Figure 2 The acceleration data is filtered through the Hamming window to obtain the waveform shown in figure 2(b). In order to reduce the influence of the interference of the three-axis acceleration curve when the pedestrian walks, the three-axis total acceleration is used to detect the step frequency, which can be shown in Figure 3 The path map of pedestrian movement in the room is shown in Figure 4. Test 2: pedestrians were tested in the corridor on the fourth floor of 21a, Harbin University of engineering. The path curve of pedestrian walking has two sections. The first section is straight walking, which is about 75.3 meters long. The second section is the path after the right turn, which is about 28m long. The figure of pedestrian track calculated by the above method is shown in Figure 5: It can be seen from Figure 5 that when WiFi is used for independent positioning, the pedestrian motion path will jump up and down the original path. The position error of pedestrians is very small at the beginning, and then gradually increases. In the AEKF fusion, the cumulative error of pedestrian motion path is reduced, and the stability of location is greatly increased. For these positioning methods, figure 6 shows the position error of each positioning point.  Figure 6 Positioning error of different tracks In Figure 6, it can be seen from the trend of error curve that the positioning effect of the new extended Kalman filter fusion method is better than that of other methods.  Table 1 analyzes and compares the performance of each positioning algorithm in terms of maximum error, minimum error, average error and 2.5m percentage. Among them, the AEKF fusion positioning method with the lowest average positioning error, which is 1.520m. The positioning accuracy of the average error is 26.78% higher than that of LRL_KNN algorithm, and 9.79% higher than that of PDR algorithm. Moreover, the algorithm has advantages in other error indexes, which also proves the superiority of the fusion algorithm.

Conclusion
In this paper, the indoor positioning system is designed by combining the location fingerprint with the pedestrian dead reckoning, which realizes the positioning based on the two-dimensional indoor plane map. The experimental results show that the average error of the location algorithm after fusion is within 1.52m. Compared with the improved location fingerprint method and the improved PDR algorithm, the errors are reduced by 42% and 46% respectively. Compared with the previous research, the accuracy of the location results has been significantly improved.