A Multi-Floor Location Method Based on Multi-Sensor and WiFi Fingerprint Fusion

Aiming at the problems of high time overhead, low positioning accuracy, and inability to meet the requirements of indoor positioning applications in WiFi and Pedestrian Dead Rockoning (PDR) positioning technologies, a cross-layer positioning method based on multi-sensor and WiFi fingerprint fusion is proposed. Firstly, Multi-dimensional scaling technology (MDS) is used in WiFi location, which reduces the overhead of offline stage of large area WiFi fingerprint location and improves the responsiveness of online location. Without limiting the holding mode, the high and low threshold detection method is used to reduce the error in gait detection of the PDR method. Unscented Kalman Filter (UKF) is used to fusion WiFi and PDR positioning results, output the optimal two-dimensional estimation, and finally use WiFi signal and multi-sensor information to determine the height of pedestrian position and output three-dimensional coordinates. The experiment results show that the proposed method have higher accuracy and better stability compared with WiFi and PDR positioning method.


I. INTRODUCTION
Currently, the market demand related to indoor localization services is expanding. In modern cities, people spend about 80% of their life in indoor environments. In the era of the mobile Internet, 70% of conversations based on mobile phones, mobile consumption, payment, data connection, and 80% of Internet data interaction all happened indoors. This makes people's demand for indoor location-based applications and indoor positioning products more and more widespread, and the market value related to indoor localization is also increasing. At the same time, indoor positioning and navigation systems can be widely used in various fields, Indoor positioning systems have been widely studied by scholars due to their huge commercial value and application prospects.
As we all know, due to the special nature of the indoor environment, outdoor location systems (such as GPS and cellular mobile networks [1], [2]) cannot provide positioning services indoors. In order to meet people's needs for indoor The associate editor coordinating the review of this manuscript and approving it for publication was Noor Zaman . positioning and to deal with complex indoor electromagnetic propagation environment, various indoor location technologies based on Bluetooth, Ultra Wide Band (UWB), Radio Frequency Identification (RFID), Micro-electromechanical Systems (MEMS) sensors and Wireless Local Area Network (WLAN) have been researched and developed. Among these methods, the WiFi fingerprint location method has attracted much attention due to its widespread deployment in the environment [3], [4]. The location method based on the MEMS sensor and IMU has also been widely studied because of its low infrastructure cost and high positioning accuracy [5], [6], and both methods are available on most mobile devices. In recent years, to break through the limitations of a single technology, the location methods based on data fusion and combine multiple location technologies have received further attention [7]. In order to achieve higher indoor positioning accuracy, researchers coordinate different positioning systems, many methods combine WiFi fingerprint recognition and PDR methods through Kalman filter [8] or particle filter [9]. However, collaborative positioning systems lack recognized integration standards, in order for collaborative positioning systems to achieve better market acceptance, VOLUME 8, 2020 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ researchers have begun to study the next development of indoor localization systems, and to research and classification of different indoor positioning systems from the conceptual level [10]. While improving the positioning accuracy, many research efforts have ignored other standards of these localization systems. In 2011, Evall evaluated the existing Ambient Assisted Living (AAL) system through competitive benchmarking [11]. For an AAL system, not only focus on the comparison of algorithms, but also focus on the cost of deployment, user acceptance, and availability (ie, the response performance of the online phase). Evaluate AAL systems from multiple dimensions. In 2014, EVARILOS3 became the second milestone of benchmarking methods in indoor positioning environments [12]. In that same year, two leading conferences in the field, the International Conference on Information Processing in Sensor Networks (IPSN) and the International Conference on Indoor Positioning and Indoor Navigation (IPIN), launched each their own indoor localization competitions: respectively the Microsoft indoor localization competition [13] and the IPIN competition, the latter exploiting the legacy of EvAAL by adopting what is currently known as the EvAAL framework [14]. In 2016, the first standard method, the ISO/IEC 18305, for evaluating indoor localization systems was proposed [15]. In that same year, the Geo IoT World competition initiated by the Internet of Things field also discussed the importance of real-time positioning [16]. Based on these benchmarking methods, the researchers further discussed and studied the evaluation standards, gave possible suggestions for modification, and further improved the assessment method [17].
In other words, the design of an integrated positioning system must involve the above aspects of research to make the positioning system more and more perfect in the future. In the past, the WiFi model of the converged system relied on the KNN algorithm, which took a long time during the offline phase. Since the fingerprint positioning algorithm using MDS technology does not need to collect fingerprints at each reference point in the positioning area [18], introducing the MDS algorithm into the fusion system can obviously optimize this disadvantage. At the same time, continuous positioning between floors is also one of the challenges facing indoor positioning systems. Faced with the above problems, in this paper, a cross-floor location method based on multi-sensor and WiFi fingerprint fusion is proposed to solve the problems such as the time consuming of database construction in the offline stage of collaborative positioning systems, 3D location.
The contributions of this paper are as follows: 1) Aiming at the requirement of three-dimensional positioning and the deficiency of height estimation only using barometer at present, a new real-time height estimation method is proposed. The change of the direction signal of the barometer and accelerometer makes the judgment of the pedestrian state more accurate, and the effective height estimation error correction can be carried out when the pedestrian reaches the new floor and moves. Moreover, in the process of walking up the stairs, it can provide more accurate state judgment and height estimation. 2) In the fusion method of WiFi and multi-sensor proposed in this paper, the time cost of WiFi positioning phase is greatly reduced by introducing MDS method, and the scalability and real-time response ability of the system is increased. 3) In the asymmetric mode, the high and low threshold method is used to detect the gait, and in the typical office building environment, the experimental verification is carried out by using volunteers of different height, and better detection accuracy is obtained.
The second section of this paper introduces the related work; the third section gives a specific description of the proposed method; experimental verification is given in section 4; finally, the conclusion is made in section 5.

II. RELATED WORK A. WiFi FINGERPRINT LOCATION METHOD
The WLAN indoor positioning system named RADAR [19] was first proposed by the Microsoft Research Institute of the United States. The system consists of three AP whose location is known. Each location fingerprint is collected and stored in the database in the offline stage, test fingerprint is located by the nearest neighbor matching method in the online stage, positioning accuracy is between 2m and 3m.
University of Maryland Youssef et al. [20] proposed the Horus system. The process is also offline and online, however, the offline fingerprint database construction stage does not average all the Received Signal Strength Indicator (RSSI) like RADAR, but saves RSSI of each AP at each reference point, and proposes clustering reference points with similar RSSI signal characteristics. In the online positioning stage, clustering is used to locate a certain sub-region, next the accurate positioning is carried out, which shortens the time of online positioning.
In reference [21], the researchers collected a large amount of information at each reference point and proposed an adaptive WiFi fingerprint identification technology suitable for indoor dynamic environment positioning. The stability of the positioning is improved by updating value of the fingerprint database regularly. The accuracy is improved and cost of offline phase is increased at the same time.
Reference [22] found that for more AP signals in a single building, some fingerprint samples in the radio map did not contribute significantly to the estimation process. They proposed two methods, AP filtering and fingerprint filtering, to optimize the fingerprint database, which not only improved the positioning accuracy but also reduced the time needed for each positioning.
Reference [23] constructs a new fingerprint database by interpolation method based on obtaining a small number of 223766 VOLUME 8, 2020 fingerprint information, which reduces the overhead of fingerprint database construction in the offline stage, but interpolation of fingerprint by algorithm brings artificial error.
To reduce the workload of fingerprint collection, reference [24] and reference [25] put forward a crowdsourcing method, but this method needs a special incentive mechanism.
Based on the MDS technology [26] studied by Stojmenovic et al. Xiao et al. [18] through a large number of experiments, obtained that if a sufficient number of AP signals (for example, more than 4) can be measured at each reference point in the location area, the distance between the signal intensity vectors of any two reference points can well represent their physical distance, moreover, the MDS technology does not compare the RSSI vector measured of the point to be located with all the records in the fingerprint database one by one, but constructs a distance matrix by calculating the distance of signal strength vector between the point to be located and the specific RSS reference point, and then use MDS technology and the real coordinates of RSS reference points to determine the actual position of the undetermined points. And the size of the positioning error depends on the set of RSS reference points used. The definition of the MDS algorithm will be described in detail in section 3.1.
In conclusion, WiFi fingerprint location method has limitations and reducing the time of offline fingerprint database construction and online location is also a problem faced by single WiFi location technology. Moreover, the position estimated by WiFi fingerprint recognition method is independent and discontiguous in real-time tracking.

B. PDR POSITIONING METHODS
The PDR method uses inertial sensors (such as gyroscopes, accelerometers, or magnetometers) to acquire the user's movement information and then combine it with the user's previous position to estimate the current position. Before smartphones became popular, researchers linked inertial devices to the body for PDR. Harle [27] divides the pedestrian inertial positioning system into two categories: 1) inertial navigation system and 2) stepping and heading system (SHS).
For the PDR method, there are three main steps to be completed: (1) gait detection to detect whether the pedestrian has completed one step, (2) step estimation of walking step, and (3) heading angle estimation relative to the coordinate system.
The reference [LOCALREF%_Ref15160857%28%] proposed a SHS location method using the MEMS sensor in a mobile phone. Firstly, the original acceleration data is denoised by low-pass filter, and then gait detection is carried out by peak detection method. The step size is estimated by linear frequency step model. The experimental results show that the positioning accuracy is 1.5 m and 2 m respectively in the case of hand-holding and carrying.
Liu et al.
[LOCALREF%_Ref15160863%29%] proposed the HIPE algorithm, which combines smartphones and WiFi signals. The sensor inside the smartphone is used to measure the user's movement, set the step size to a constant value, and the gait is detected by zero-crossing peak detection method, the final position is estimated by the hidden Markov model through the compass direction detection.
In reference [30], Xiao et al proposed a method of lifelong learning PDR parameters. Kalman filter is used to eliminate the drift of gyroscope in direction estimation. Inspired by walking repetition mode, the REPUT algorithm was proposed to correct the drift of acceleration in horizontal direction and finally to optimize PDR algorithm.
In reference [31], Wang et al. proposed the UNLOC algorithm, which combines the PDR method with the landmarks, eliminates the cumulative error of the PDR method through indoor landmarks, and gives full play to the good time recurrence of the PDR method.
In reference [32], based on the five ways of pedestrians holding mobile phones, the author combines PDR method, WiFi fingerprint technology and landmark method to improve the accuracy of real-time user location. However, the accuracy of positioning during actual use depends on the number of road signs.
The reference [33] combines the WiFi signal with the barometer information. Although there is no fine-grained positioning on the stairs, it achieves good accuracy in floor height recognition.
The reference [34] Aiming at the WiFi fingerprint indoor positioning system with complex calculation and low precision, improved K-means clustering method is used to reduce the searching time of the fingerprint database of WiFi positioning. Secondly, the sensor inside mobile phone is used to realize the PDR positioning. Finally, the WiFi fingerprint location and PDR method are fusion via the UKF method to obtain the position, in the total path of 133.5m, the error is approximately 1.5m. Although the positioning of each floor is involved, the continuity of location between floors is ignored.
The reference [35] proposed a hybrid structure of the KNN WiFi fingerprint location and dead reckoning method, which achieves a reasonable level of accuracy in different scenes, but ignores the system overhead in offline and online phases and the requirement of three-dimensional location.
The reference [36] also used the KNN fingerprint positioning method and PDR method to realize indoor fusion positioning. Considering the indoor three-dimensional positioning requirements, height measurement is carried out by using barometer and geographic information built in the mobile phone. The initial height of pedestrian position is very important to the positioning result. However, as the air pressure of a certain determined floor depends on the weather and temperature at that time, the air pressure and height cannot form a good mapping relationship, so using the air pressure value to determine the initial height will cause certain height error and have no error correction capability.
The reference [37] proposes a PDR positioning method based on multi-sensor fusion. The Extended Kalman Filter (EKF) is used to complete data fusion, and clustering algorithm and the Zero-Speed Update (ZVU) method are used to reduce sensor installation errors and path integration errors caused by sensor differences, which improves the location performance of PDR algorithm.
In reference [38], inertial sensors and GPS built-in smart phones are used to realize indoor positioning, segmented signal frames are used to learn pedestrian speed, and pedestrian time series signals are classified, regressed, and predicted by multi-scale convolution and recurrent neural network model, which greatly reduces the construction cost of location fingerprint and achieves high positioning accuracy.
In reference [39], a multi-layer 3D target tracking system based on the built-in inertial sensor of the smartphone is proposed. First, the 2D PDR model is calibrated through the particle swarm algorithm, and the 2D motion trajectory is combined with the height information to achieve 3D positioning. High-precision floor change detection is realized on the Android APP.
From the above PDR method, it can be seen that the positioning of PDR method involves the holding mode, gait detection, step size, heading angle and other issues of handheld devices. In order to reduce the cumulative error of the PDR method, Researchers usually combine the PDR method with other methods, and the positioning performance of the two methods determines the overall performance of the fusion method.

III. LOCATION ALGORITHM A. MULTIDIMENSIONAL SCALE WiFi FINGERPRINT POSITIONING
Fingerprint positioning methods include both online and offline stages. In this paper, the offline phase mainly includes the learning of the AP location, fingerprint collection and pre-processing at the reference points, and then storing into fingerprint database. The online phase includes data acquisition and preprocessing as well as position calculation.

1) OFFLINE PHASE
In the offline stage, due to the need of the algorithm, first, it is necessary to learn the AP positions in several floors (the number of floors is 3). Set the AP position as (x, y, z), x and y represent the horizontal and vertical coordinates with O as the origin in floor plan, Z represents the height of the floor where AP is located, the Table 1 is the AP location information, including the location coordinates and Mac address that are specifically acquired. Next, RSS reference points are selected in the preset positioning area of each floor. Taking the rectangular area marked by the red line on the fourth floor of the experimental scene as an example (as shown in the red area of floor plan in section 5.1). The location error of MDS algorithm is related to the set of RSS reference points. It is assumed that M RSS reference points are selected in the positioning target area. The data of all APs can be measured in each point in the test area. The position of each reference point is expressed as P m = (x, y, z).
For AP signals received on the same floor, due to environmental reasons and crowded AP signals in modern buildings, individual APs may experience intermittent signal loss or always maintain a very low RSS value when constructing the fingerprint database. This part of the AP does not contribute to the positioning accuracy, so it can be removed. In this paper, continuous sampling rate R s is defined to screen low quality AP.
Among them, C s is the largest sample size of all AP at the test point, and E s represents the detection sample size of the current AP. We choose AP which R s ≥ 0.8 to collect fingerprints. For screened AP, it is found that although the RSS value changes with time, it is a small probability event that produces large signal fluctuation. So this paper uses Gauss filtering to remove the signal with large fluctuation. The Gauss distribution model is shown in (2): where G(x) represents the probability density when the signal strength is x, µ is the mean value of multiple signals collected by the same AP, σ is the variance of this group of signals, and the low probability signal strength value can be filtered by setting the value range of G(x). Then, the filtered RSS average of each AP at the reference point P m is used as the position fingerprint vector of the AP, and the RSS vector at the reference point is recorded as: RSS m is a n z -dimensional vector, n z < n, m = 1, 2, · · · , M is the number of reference points of the selected record RSS vector, and n z is the number of AP that the phone can measure on the floor with height z. Suppose the RSS fingerprint vector at reference point A is: where Where d Ai is the distance from points A to the i-th AP. P ti and P Li (d 0 )P Li (d 0 ) are the transmit power and the near-ground reference power of the i-th AP, respectively. Since the transmit power and near-earth reference power of each AP are unchanged, formula (4) can be rewritten as: where AP i = P ti −P Li (d 0 ), the RSSI vector euclidean distance between reference point A and B is defined as [3941]: where δ i is a Gaussian random variable with zero mean in decibels and a standard deviation of σ . Then the RSSI vector euclidean distance between M reference points is calculated and stored in fingerprint database. The distance matrix is expressed as: In the online stage, As the signal will be weakened greatly after passing through the floors, this paper uses the AP of the floor where the pedestrian is located as the input of the algorithm. After starting the positioning, the absolute floor identification method is used to determine the initial height of the floor where the pedestrian is located. Then, according to Table 1, the AP signal received by the mobile phone on the same floor is screened out. Then the MDS positioning algorithm is used to locate the location. The steps of the MDS location algorithm are as follows: Step1: The distance matrix is constructed by using the RSSI vector distance between the M reference points, the matrix is recorded as P m×m , and then calculate the RSSI vector Euclidean distance between the M RSS reference points and the to-be-located point respectively, and then build the distance matrix P (m+1)×(m+1) on the basis of the matrix P m×m ; Step2: The generalized Euclidean distance matrix P (m+1)×(m+1) is input into MDS algorithm and dimensionality reduction is carried out on P (m+1)×(m+1) . The fitting distance matrixP m+1 is obtained, and then the three largest eigenvectors of matrix P m+1 are calculated and recorded as X (m+1)×3 .
Step3: According to the real position of the M RSS reference points in the three-dimensional coordinate system and X (m+1)×3 , using the least squares iterative coordinate transformation algorithm, the translation parameter j, the rotation matrix R and the scaling scale factor s are obtained; Step4: By using j, R, s and X (m+1)×3 , the real position of the point to be located in the three-dimensional coordinate system can be obtained.
The specific process of the MDS algorithm in step 2 is shown in Algorithm 1, and the specific execution processes of least square coordinate conversion algorithm in step 3 are referred to relevant reference [41].

C. MULTI-SENSOR DEAD RECKONING
When a pedestrian uses a handheld device to navigate or position, the device is always held in his hand and alternates between the symmetrical mode and the asymmetrical mode [30]. For example, if the mobile phone is held in the hand but the hand does not swing with walking, it is called symmetrical mode (the mobile phone is stationary relative to the body), Holding the phone in the hand and swinging with it is called asymmetric mode (the phone moves relative to the body). The multi-sensor navigation firstly identifies the motion type, then carries out gait detection, and finally carries out speed estimation and heading angle estimation.

1) MOTION PATTERN RECOGNITION AND GAIT DETECTION
First, the acceleration signal and the direction signal in the carrier coordinate system are converted to the reference coordinate system (detailed in the second part). It has been proved in the reference [30] that in the symmetric mode, the acceleration signal is like the sine wave, while in the asymmetric mode, the direction signal is like a sine wave. Because the original data contains noise, the acceleration signal is processed by moving average filter (window width K is 6)and Butterworth low pass filter, and the direction signal is processed by average filter. Then the discrete Fourier transform of acceleration and direction signals in the frequency range corresponds to human walking is calculated, typically between1.2 Hz and 2.5 Hz, finally use an energy detector to decide whether the device placement is resulting in symmetric or asymmetric motion, the gait detection process is shown in Figure 1.
After determining the motion mode, the next task of PDR method is gait detection. Due to different motion modes, the signals used to detect gait are also different. If the detection result is symmetrical mode, gait detection is carried out by using the z-axis acceleration perpendicular to the ground, in contrast, gait detection is carried out by using direction signals. In asymmetric mode, reference [30] uses the peak Step detection process.
and valley values of directional signals for gait detection(first step is from valley to peak, second step is from peak to valley). In actual walking, the pedestrian walks faster, the periodicity of the direction signal is shorter, the pedestrian walks slower, the periodicity of the direction signal is longer. Therefore, the distance between the wave peak and the wave valley cannot be well set. If the setting is too long, the number of steps in the fast walking will be lost. If the setting is too short, the situation shown in Figure 2 will appear. Local fluctuations can lead to erroneous gait detection. The wave valley shown in the green circle to the wave crest shown in the red circle are recorded as one step. In the symmetrical mode, the acceleration data processed by filtering will still show the pseudo-wave peak phenomenon shown in the red circle (as shown in Figure 3 (a)), there will be an error step when using the traditional peak detection method. If the unilateral threshold judgment method is used, the area crosses the threshold and is counted as one step. To avoid above two situations and avoid the extra overhead caused by gait detection using two methods, this paper uses the high and low threshold detection method mentioned in reference [42] to detect gait. For gait detection, high and low threshold detection methods must set high and low thresholds. Two thresholds divide the acceleration data into three states, which are represented by 1, 0 and −1, respectively, as shown in Figure 3 (b).
In actual walking, only the alternation of symmetrical mode and asymmetrical mode will occur. When the detection result is symmetric mode, gait detection using periodicity of acceleration signal, when the acceleration exceeds the high threshold, it is recorded as 1; when the acceleration is below the low threshold, it is recorded as-1, and the part between the two thresholds is recorded as 0. In practice, the acceleration changes periodically with the movement of pedestrians, and the normal one-step conversion process is 0 → 1 → 0 → −1 → 0. According to the judgment rules of high and low threshold, gait error detection can be effectively avoided. Each time such a complete cycle of 0 → 1 → 0 → −1 → 0 is detected is recorded as one step.
When the detection result is asymmetric mode, we use the periodicity of the direction signal to detect the gait. We also divide the direction signal into three thresholds. Because the direction signal is one period every two steps, in the direction signal, The normal one-step conversion process is 1 → 0 → −1 or −1 → 0 → 1. Under the condition of not limiting the hold mode of the mobile phone, according to the judgment rules of high and low thresholds, the step number error detection can be effectively avoided.
After gait detection is completed, this paper uses the R-Step Length Estimation method proposed in reference [30] to measure step size. The measured step size is recorded as L.

D. HEADING ANGLE ESTIMATION
The dead reckoning method in this paper relies on the builtin triaxial accelerometer, triaxial gyroscope and triaxial magnetometer in the smart phone terminal. After the pedestrian starts to move, the acceleration and direction signals in the carrier coordinate system are first converted to the reference coordinate system. To this end, define the carrier coordinate system ox b y b z b (frame b) and the geo-referenced coordinate system ENU (frame n) based on the mobile terminal (the E, N, and U axes point to the geographic east, north, and sky directions, respectively). The carrier and reference coordinate system are shown in Figure 4.
Heading angle estimation is described as follows. The coordinate transformation relationship between the navigation coordinate system and the carrier system is Among them, C b (q) is the attitude rotation matrix, x t y t z t is the data measured by the three-axis gyroscope in the carrier coordinate system, x b y b z b is the data measured by the three-axis gyroscope in the geographic coordinate system. And the Euler angle is usually used to solve the attitude, but in order to simplify and real-time calculation, the direction cosine matrix is represented by quaternion (9), as shown at the bottom of the page.
where q = q 0 +q 1 i+q 2 j+q 3 k is a quaternion, q 0 , q 1 , q 2 , q 3 is four real numbers, and i, j, k is three mutually orthogonal bases with imaginary units. It can be seen that the quaternion solution can be used to update the attitude matrix. The rotation angle relationship between two coordinate systems with a common origin can be represented by quaternions, and the quaternion itself varies with time, and its variation can be described by the differential equation of quaternions, as shown in (10).
In the formula, w nx , w ny , w nz is the triaxial angular velocity of the gyroscope in the carrier coordinate system, and q = q 0 q 1 q 2 q 3 T is the quaternion. Discretize the above formula: where =cos( ϑ 2 )I + sin( ϑ 2 ) ϑ 2 1 2 (wT s ) is the state transition matrix, ϑ = (w nx · T s ) 2 + (w ny · T s ) 2 + (w nz · T s ) 2 , T s is the sampling time interval, I is the unit matrix, q(0) is the initial quaternion, that should satisfy q 2 0 + q 2 1 + q 2 2 + q 2 3 = 1, i is the time sample index. Because of the existence of calculation error, the normalization condition is not valid, so it is necessary to normalize the quaternion: The quaternion is calculated by formula (11) and (12), and then the attitude rotation matrix can be solved. However, the inherent noise of the device can easily lead to the error of quaternion calculation, which leads to the deviation of equipment orientation. We take q = q 0 q 1 q 2 q 3 T as the state variable to establish the state equation: where w i is the process noise and B i+1 = g i+1 m i+1 T is the observation quantity. The observation equation is established as follow: where g i+1 is the gravity vector in the carrier coordinate system, m i+1 = m xn m yn m zn T is the three-axis magnetic field strength in the carrier coordinate system, P is the observation noise, g is the gravity vector when the target is not moving in the ENU coordinate system [24], L = 0 b y b z T is the triaxial magnetic field intensity in the ENU coordinate system, among them, b y = m 2 the gravity vector at time T in the carrier coordinate system is obtainedas follow: C bτ is the attitude transformation matrix from ENU coordinate system to device coordinate system at time τ , a τ is the three-axis acceleration in device coordinate system and T is the width of time window. Finally, quaternion is updated by EKF model [43], and the estimation result of heading angle is expressed as: 2(q 1 q 2 + q 0 q 3 ) 2(q 1 q 2 + q 0 q 3 ) 2(q 1 q 2 + q 0 q 3 ) q 2 0 + q 2 1 − q 2 2 − q 2 3 2(q 1 q 2 + q 0 q 3 ) 2(q 1 q 3 + q 0 q 2 ) 2(q 1 q 2 + q 0 q 3 ) VOLUME 8, 2020

IV. WiFi/MEMS FUSION POSITIONING
The positioning flowchart of the fusion method is shown in Figure 5. During the process of positioning, the floor of the pedestrian is determined firstly according to the height measurement method proposed in this paper, and then the MDS fingerprint localization method proposed in reference [26] and APs placed on the floor are used to locate the pedestrian initial position in the horizontal plane. The height measured with the fingerprint localization method is replaced by the method proposed in this paper. With the movement of the target, the result obtained by the fingerprint localization is regarded as the initial value of the PDR method. Based on PDR method mentioned in document [30], this paper uses high and low thresholds to deal with the problem of gait detection in mixed motion mode to complete PDR localization. Finally, according to the fusion positioning system proposed in reference [35], MDS fingerprint positioning technology and PDR method are fused by using unscented Kalman filter to reduce the time required for each positioning of the fusion system. When walking inside the floor, the output three-dimensional position is the three-dimensional coordinate contain the height of the floor. If it is detected that the positioning target enters the staircase to go up and down stairs, we use WiFi information and multi-sensor information to jointly estimate the real-time height of pedestrian position, and the updated three-dimensional position is finally output. when it is detected that the pedestrian starts walking horizontally again, the height measurement method in this paper uses the absolute floor identification method to correct the height measurement error again.

A. WiFi/PDR IN-PLANE POSITIONING
Since the multi-objective optimization problem does not have a unique global optimal solution, solving the multi-objective optimization problem is actually to find a set of solutions. The particle swarm optimization algorithm is an optimization This article provides indoor WiFi positioning and multiple sensor positioning to estimate pedestrian location, both of which have advantages and disadvantages. WiFi-based positioning can provide accurate coordinates directly, but it is affected by signal fluctuations. Multi-sensor estimation is more accurate over short distances, but there is cumulative error. In this paper, UKF is introduced to combine the two methods to overcome their respective shortcomings. The location based on WiFi can eliminate the cumulative error, and the position estimation of multi-sensor has good time recurrence performance to avoid individual deviation. Further improve the positioning accuracy.
In the process of fusion, the state equation describes the recurrent relationship between input and output. Multi-sensor calculation has better timing recurrence, which can be used as the state equation. The equation of state of the system is shown in formula (17): where X t = p x p y L θ T is the state vector, P x and P y are the position in the navigation coordinate system, L is the step size, θ is the heading angle, and w t is additive white Gaussian noise with variance matric Q and average value 0, Location estimation based on WiFi is obtained through the relationship between RSS and distance, and there are no cumulative errors. We use the WiFi estimation and the vector distance between the point to be measured and the selected RSS reference point as observations (as shown in Figure 9 pure black pentagram) to establish the observation equation: where p t+1 is additive white Gaussian noise with variance matric R and average value 0 p wifi x and p wifi y are the horizontal and vertical coordinates of the WiFi fingerprint location, and Pd is the RSSI vector Euclidean distance between the point to be measured and the RSS reference point., The UKF-based fusion positioning process is described as follows [35]: X (t|t − 1) is the predicted state estimate at time t, X (t − 1|t − 1) is the state estimate at time t, P (t|t − 1) is the predicted covariance matrix at time t, and P (t − 1|t − 1) is the updated covariance matrix at time t.
The sigma points of the UKF are generated according to X (t|t − 1) and P (t|t − 1) as follows: where n is the dimension of the state, λ is the scaling parameter, The weights of sampling points can be expressed as: where α, β are constants. The generated sigma points are transformed by the nonlinear function h (25) where r j i is the predicted value of sigma point set, the mean, covariance, cross-covariance of the transformed sigma points are calculated as follows: where R t is system noise KF gain is defined as: The system state estimation and covariance matrix updated are expressed as:

B. PART OF THE SIMULATED ANNEALING ALGORITHM
To solve the problems of continuous positioning between floors, complex structure between stairs and unstable height estimation based on the absolute value of single barometer, this paper uses WiFi signal and multi-sensor information to estimate the height of pedestrian position in each position in the building. Due to the propagation characteristics of wireless signals, obvious signal weakness occurs when the WiFi signal passes through the floor to another floor. The largest RSSI received by the mobile phone now comes from AP of the floor where the mobile phone is located, and the air pressure difference between the floors is stay the same in reference [33]. According to this phenomenon, at the beginning, the reference value of floor level is initialized to the AP installed floor with the largest RSSI received by a smartphone, and the air pressure value at this time is marked. This method is called absolute floor identification method. In this paper, through the test of the actual environment, the threshold is set to −50dBm as a value that a smartphone only receives when a user is within five meters of APs and the signal does not pass through the floor. The AP information has been stored in the database during the offline learning phase of the WiFi location, as shown in Table 1.
When pedestrians go up/down the stairs, not only does the air pressure change, but when they complete a complete upstairs or downstairs action on the stairs, the acceleration signal of Z axis or direction signal in the navigation coordinate system will change periodically. When pedestrians enter the staircase, the accelerometer and barometer are used to judge the motion, and if the go upstairs or go downstairs activity is detected, start level estimation.

1) JUDGMENT OF WALKING CONDITION
The indoor movement includes two situations: the flat road movement in the floor and the up or down stairs movement on the stairs. In the offline phase, this paper firstly made multiple actual measurements in the experimental environment. Take the maximum value obtained from the change in horizontal pressure during walking on a flat road as the threshold value in 1), take the minimum value obtained from air pressure change per second during going up or down stairs as the threshold value in 2). This paper uses the acceleration signal or the direction signal and the change of the barometer to judge the situations: 1) when only the acceleration signal or the direction signal has periodicity change, the pressure change within five seconds does not exceed 0.05hpa, then the movement is judged to be walking horizontally. 2) when the barometer detects that the change of air pressure per second exceeds 0.025hPa and lasts for more than three seconds, it is defined as have change of air pressure, and when accompanied by periodic changes of acceleration signals or direction signals, the movement is judged as go upstairs or go downstairs. The process of judging the user's upstairs or downstairs status by using the acceleration signal or the direction signal and the barometer is shown in Figure 6.

2) HEIGHT ESTIMATION DESIGN PROCESS
This paper uses the periodic variation of sensor signals to accumulate/reduce the number of stairs to obtain the height of the target. The map coordinate system is established as show in floor plan in section 5.1. The z axis in the coordinate system starts from the third floor of the experimental environment, and the initial value is the height of the third floor. The plane position is determined by the fusion method mentioned above. When up/down stairs, the step size is set to the width of one stair, and the width and height of the stairs are measured in the offline stage through actual experimental environment, which are 0.24m and 0.14m respectively. The specific design flow chart is shown in the following figure.
The problem with this method is that if the user's starting position is on the stairs, the initial height will locate the user's position height according to the absolute floor recognition method to the adjacent floor height. After detecting that the pedestrian reaches the target staircase, the height is re-corrected by the absolute floor identification method, position estimation error will occur during this period. For example, at the initial moment, when the horizontal measurement result of pedestrian position is on the stairs, an initial height is given by the absolute floor recognition method, and then a large height estimation error will appear when the pedestrian up/down floor. When the horizontal measurement result of the pedestrian position reaches the staircase and pedestrian starts horizontal movement, the height is corrected again. The overall design process of height measurement and estimation is shown in Figure 7.

A. DEPLOYMENT OF THE LAB ENVIRONMENT
The experimental environment selects the third floor to the fifth floor of a building, and selects the corresponding 24m × 16m-sized rectangular area as the experimental place on each floor. The selected rectangular area includes the staircase, as shown in the red area on the fourth floor of Figure 8,in order to facilitate viewing, only the floor schematic maps from the fourth to the fifth floor are drawn. The location area of the third floor corresponds to the fourth and fifth floors.
According to document [26], regular select reference point can improve WiFi positioning accuracy. At the same time,   to avoid too few reference points affecting WiFi positioning accuracy, we divide the positioning area in Figure 8 into 2m × 2m small areas on average, with an intersection point for every 4 small areas. In this paper, 35 RSS reference points are selected. the selected reference points are shown in Figure 9, and the five-pointed star in the figure indicates RSS reference points.
For each floor, in the offline phase, 4 minutes of signal acquisition are respectively carried out at each selected RSS reference point. When the acquisition frequency is too high, the acquired WiFi signal lacks time variability, so we set the acquisition interval to 0.5s, and then store the acquired signal into the database after preprocessing.
It is assumed that the influence of indoor environment on the range of a single AP signal is ignored, and the same route has the same coverage. In this paper, the coverage of the fusion system is extended from the edge AP until the dimension of the AP signal measured by the mobile phone is reduced to less than 4 dimensions. From these areas, the fusion system in this paper will not work.
In order to evaluate the proposed method, this paper developed the WiFi-RSSI and MEMS data collector and the Web location server on the commercial smartphone (Huawai P9) running Android8.0 platform. The MEMS collector sampling frequency was set to 60Hz. The Web location server stores maps from the third floor to the fifth floor of the Internet of things Center. Three volunteers were recruited to participate in our experiment. Part of the actual experimental scene is shown in Figure 10.

B. DEPLOYMENT OF THE LAB ENVIRONMENT
In order to evaluate the effectiveness and reliability of the algorithm in this paper, this paper needs an accurate reference trajectory to analyze the estimation error of the navigation algorithm. Considering the characteristics of straight paths in the experimental environment, this paper uses a map-assisted PDR algorithm to generate reference trajectories.
We let each volunteer successively carry a smartphone and walk at a constant speed along a pre-designed experimental trajectory. When volunteers walk along a straight line, a map-assisted PDR trajectory generation algorithm locks the heading information to a specific value based on the map information. In the process, record the moment of passing any marked point (such as landmark, corner). According to these marked points, the trajectory of each volunteer is divided into several different line segments. The starting point and end point of any one of the line segments can be obtained from the map information. The coordinates of the other points of the line segment are obtained by interpolation.
Because the constant speed assumption is used, and the length and time of each line segment are known, the speed information can be obtained by dividing the length by the time, and the time and heading corresponding to each coordinate can be obtained.
The trajectory generation algorithm is only completed by the built-in sensor of the mobile phone, and is independent of the indoor positioning algorithm proposed in this article.
The generated trajectory is shown in Figure 8. For the height information, in the plane, we artificially add to the trajectory generated above. In the height test phase, we assume that the pedestrians go up and down stairs continuously, and the original reference height is also manually added.

C. DEPLOYMENT OF THE LAB ENVIRONMENT 1) TIME COST ANALYSIS OF SYSTEM OFFLINE PHASE
According to the reference [18], when the number of received APs exceeds 4, the MDS algorithm can achieve relatively stable positioning accuracy in the plane. Since the number of APs in the positioning area is far more than four. Therefore, we can ignore the impact of due to the single AP signal cannot be detected in the real-time positioning phase. To compare with the method of reference [35], we set the number of AP to 5.
For the fusion positioning system of WiFi fingerprint positioning and PDR method, the time cost of the offline phase of WiFi fingerprint method is the most important cost of the whole fusion positioning system. Therefore, in the same environment, this paper compares the overhead time of deploying KNN fusion method [35] and MDS method in the offline phase. During signal acquisition, we select the vertex of the squares for signal acquisition, and analyzes the positioning results by using the data obtained from the actual environment and simulation experiments. The comparison results are shown in Table 3. The reference point interval of the KNN method is still 2m.
It can be seen that when building fingerprint database in the same environment, in the offline phase, the fusion system using KNN method is much more expensive than the fusion system proposed in this paper. At the same time, the selection of the reference point interval of KNN method with 2m will cause larger positioning error. In this experimental environment, the average positioning error of KNN method is 3.84m.

2) ANALYSIS OF SYSTEM RESPONSE PERFORMANCE
Because the trajectory needs continuous positioning, this paper uses KNN method and MDS method to fuse with PDR method and UKF method respectively. The MDS method can achieve positioning accuracy like the above the KNN method at 9 reference points. The influence of the number of selected reference points on the positioning result is shown in Figure 11. Therefore, In the experimental environment of this article, MDS method reference points are set to 9 in this comparative experiment. the reference points are selected as shown by the pure black five-pointed star in Figure 9. For accuracy of comparison, the state equations were modified to the same dimension. Then we let the volunteer walk at a constant speed. In a two-dimensional environment, volunteer used  mobile phones to perform continuous positioning for up to 60 seconds. The walking frequency was 1Hz. This article uses the usability evaluation criteria provided in EvAAL to evaluate response performance and the availability Avs value is expressed as [11]: among them,the availability A is measured as the ratio between the number of produced localization data and the number of expected data. each localization system was expected to provide one sample every half a second, hence the number of expected samplings is given by the double of the test duration in seconds. The recording results are shown in Table 4. As can be seen from the Table 4, during 60 seconds of continuous walking, the MDS system generates 46 localization data, while the KNN system generates 28 localization data.64% increase in availability.

D. MULTI-SENSOR ESTIMATION AND EVALUATION
Due to the different electromagnetic interference in different parts of the room, the north pole detection has deviation, which leads to directional drift and affects the measurement of acceleration. therefore, we conducted the experiment with known indoor magnetic field distribution.
In order to further prove the effectiveness of the gait detection method in this paper, three volunteers were allowed to walk 100 steps in the actual environment using symmetrical mode and asymmetrical mode respectively. The gait detection method proposed in document [30] and the method used in this paper were used to detect in the actual environment respectively. We call the gait detection method in document [30] the peak method for short, and the results are shown in Table 5.
As can be seen from the table, in the symmetrical mode, the average step count error of the double threshold detection method is 3.3 steps, the average count error of the peak detection method is 9.7 steps, in the asymmetrical mode, the average step count error of the double threshold detection method is 3.7 steps, and the average error of the peak detection method is 8.3 steps. It can be seen that gait detection using the double threshold method can effectively reduce the detection error.
In order to analyze the effect of gait detection method in this paper under the mixing of the two modes. We asked three volunteers to carry out experiments on the floor and stairs respectively with their mobile phones without specifying the walking route, the experiment was repeated three times. During the whole experiment, there was no restriction on the holding mode of the mobile phones and the walking speed of the volunteers, where the number of measured steps and the step count error were the average value of three people. The result is shown in Table 6.
It can be seen that using the high and low threshold method for gait detection, whether walking horizontally in the floor or going up and down the stairs. The accurate gait detection can be obtained for pedestrians, which is beneficial to accurate dead reckoning and judgment of pedestrian movement.
The accuracy of the heading estimation depends on the accuracy of the quaternion rotation matrix. The accurate step size estimation depends on the acceleration, and the accurate rotation of the acceleration to the earth coordinate system also depends on the rotation matrix. In order to study the accuracy of the quaternion estimation, let three volunteers took the mobile phone on the chest (relative to their body at rest),  and randomly changed the tilt angle of the mobile phone to walk 50 meters and 100 meters in a straight. The number of steps is obtained by accelerometer gait detection. The average step length is obtained by dividing the total distance by the number of steps, and the detection distance is obtained by accumulating the real-time step size according to the number of steps. The experimental results are shown in Table 7.
As shown in Table 6, the measured value of the quaternion corrected by the gravity vector estimation value and the magnetometer measurement value can well rotate the acceleration value to the earth coordinate system, so that the deviation of detection distance under the 50m test distance can be controlled within 2 meter, and that under the 100m test distance, the deviation can be controlled within 5 meters.
The correct estimation of the floor initial height determines correctness of the next height estimation. In the experiment, volunteer was allowed to walk quickly between the 4th floor and the 5th floor of the experimental environment in this paper. After traversing the positioning area of the 4th floor (accompanied by AP deployment dense area or sparse area), volunteer reached the 5th floor through the stairs and traversed the positioning area of the 5th floor. During 160 second walk, the time for climbing the stairs was 20 seconds, and the initial height estimation was performed twice per second. The threshold set in section 4.2 and the height estimation method proposed in this paper are used to estimate the initial floor height, estimated results are shown in Figure 12. Floor recognition results: the floor of the pedestrian location represents the true location of the volunteers. AP response floor is the installed floor with the largest RSSI received by a smartphone. As shown in Figure 12, Only when the volunteers climb the stairs, the estimated results will jump, and the rest of the time is relatively stable. The jump in the stairs is due to the close distance between the volunteers and the two floors. During 140 second walk (on the floor), the initial floor height was misestimated 10 times and correctly estimated 270 times. The accuracy rate of initial height estimation reaches 96%.

E. COMPARISON OF RESULTS BETWEEN FUSION METHOD AND SINGLE METHOD
Next, in order to verify the positioning accuracy of the method, set up four methods to carry out comparative experiments. a) Multi-sensor and WiFi fingerprint fusion location; b) using Multi-Sensor to locate individually; c) fingerprint location using WiFi; d) the algorithms in the literature [35], we call it FK. During the experiment, the phone is held in mixed mode.   Figure 13 compares the locating trajectories of different locating methods in the same floor environment. The actual trajectory of the three volunteers has been shown in Figure 8.

1) ON THE SAME FLOOR
As shown in Figure 13, WiFi positioning results contain more irregular jumps, this is due to the fluctuation of the signal. But the overall trajectory deviates little from the real trajectory. Multi-sensor positioning has higher accuracy in the beginning of positioning, but as time goes by, accumulative error is getting bigger and bigger, leaving the real track. In comparison, multi-sensor and WiFi fingerprint fusion technology suppresses the irregular jump of WiFi localization by using the good time reclusiveness of multi-sensor method, and the cumulative error of multi-sensor positioning is greatly  reduced. Further comparison shows that the trajectory of the fusion method proposed in this paper is closer to the real trajectory than the FK method.
To further grasp the positioning performance of four positioning methods, we have counted the positioning results of the four positioning methods, Figure 14 shows the overall positioning results of the four positioning methods. We see that the errors of the four methods are within 1.8 m, 1.55 m,1.3m and 1.1 m respectively. because of Accumulative error of multi-sensor method, the range of maximum and minimum errors of location results is large. while the range of maximum and minimum error of WiFi location is more stable than multi-sensor location. In this paper, the two methods are combined using UKF, which is more accurate and stable than the FK method. The plan structure diagram of the stairs from the third floor to the fifth floor in the test scene is shown in Figure 15.

2) CROSS-FLOOR SITUATION
Because the positioning results in the two-dimensional plane are basically the same, the location research in the case of cross-floor is mainly aimed at the estimation of the height of stairs. In the aspect of height estimation, method (a) uses the method mentioned in this paper, method (b) uses the change of air pressure to accumulate or subtract stairs, and method (c) uses the Z-axis coordinates obtained by WiFi positioning.
We asked three volunteers to perform three experiments on the stairs. We let the first volunteer go from the third floor to the fifth floor, as shown by the blue line in Figure 15.
We let the second volunteer go from the fifth floor to the third floor, as shown by the yellow line in Figure 15; we let the third Volunteers reach the fifth floor from the fourth floor, and then return to the fourth floor, as shown by the green line in Figure 15. We used each height step as a test point, plus staircases (Green triangle) and inflection point (Purple triangle), total 53 test points(As shown in Figure 15). Figure 16 shows the height estimation errors at each test point. The height measurement error is obtained by measuring the height minus the actual height in the coordinate system.
It can be seen that because the router is on the same level, the height estimation error under WiFi method is very large, and the error caused by the height estimation using only the barometer is also very obvious. The combination of WiFi and multi-sensors can not only achieve continuous and stable height estimation, but also can correct height estimation error in continuous motion (shown in green circle in Figure 16). Through experiments, the average estimation error of the height estimation method proposed in this paper is 0.214m.

F. COMPARISON OF RESULTS BETWEEN FUSION METHOD AND SINGLE METHOD
To further understand the overall performance of the method, the statistical analysis of general positioning errors is shown in Figure 17 and Table 8. Among them, Figure 17 shows the cumulative distribution of the positioning errors of four different positioning methods on the same floor. Table 8. shows the average positioning error, root mean square error and standard deviation of the three methods.
As can be seen from Table 8, compared with the pure WiFi and PDR methods, the proposed positioning method is superior to the two single methods in terms of average positioning error, RMSE and standard deviation. The average error is 44.3% lower than WiFi method and 51.9% lower than PDR method. This shows that the fusion of the two methods can effectively reduce the cumulative error of PDR method, and also restrain the jump of WiFi positioning in line with the actual scene. Compared with the FK method, the fusion method of this paper can achieve better positioning accuracy while improving the responsiveness of the system.

VI. CONCLUSION
This paper proposes two innovations to improve the performance of the fusion positioning system.The first was that a real-time height estimation method is proposed,compared with the previous method of height estimation based on barometer, the result of height estimation is more stable and accurate.The second was that use MDS technology to improve the scalability and responsiveness of the fusion positioning system,compared with the KNN fusion system, the MDS fusion system significantly increases the scalability and response performance of the fusion system due to the special nature of the MDS algorithm. Through experimentation, the performance of our proposed algorithm was demonstrated.In a typical rectangular teaching building, the average estimation error of the height estimation method proposed in this paper is 0.214m. When the positioning area is the same size, the MDS fusion system is easier to deploy. When the positioning accuracy is the same, the response performance of the MDS fusion system is improved by 64% compared to the KNN fusion system. Because there are many other information that can be used for positioning in the environment, such as the Channel State Information in WiFi and the ultrasonic wave emitted by mobile devices, in the future work, we will consider integrating more available information into the research of indoor positioning methods, and further improve the positioning accuracy of the system and the generalization ability of indoor positioning models.
ZHANJUN HAO was born in Xingtai, Hebei, in 1979. He is currently pursuing the Ph.D. degree with Lanzhou Jiaotong University. He is also an Associate Professor with Northwest Normal University. His main research interests include location service, wireless positioning technology, and wireless sensor networks.
JIANWU DANG was born in Fuping, Shaanxi, in 1963. He is currently a Professor with Lanzhou Jiaotong University. His main research interests include the Internet of Things, sensor networks, the transportation Internet of Things, and so on.
WENBO CAI was born in Qingyang, Gansu, in 1993. He is currently pursuing the degree with Northwest Normal University. His main research interest includes wireless sensor networks.
YU DUAN was born in Taiyuan, Shanxi, in 1994. He is currently pursuing the master's degree with Northwest Normal University. His main research interests include wireless intelligent perception, the Internet of Things, and wireless sensor networks. VOLUME 8, 2020