A Floor-Map-Aided WiFi/Pseudo-Odometry Integration Algorithm for an Indoor Positioning System

This paper proposes a scheme for indoor positioning by fusing floor map, WiFi and smartphone sensor data to provide meter-level positioning without additional infrastructure. A topology-constrained K nearest neighbor (KNN) algorithm based on a floor map layout provides the coordinates required to integrate WiFi data with pseudo-odometry (P-O) measurements simulated using a pedestrian dead reckoning (PDR) approach. One method of further improving the positioning accuracy is to use a more effective multi-threshold step detection algorithm, as proposed by the authors. The “go and back” phenomenon caused by incorrect matching of the reference points (RPs) of a WiFi algorithm is eliminated using an adaptive fading-factor-based extended Kalman filter (EKF), taking WiFi positioning coordinates, P-O measurements and fused heading angles as observations. The “cross-wall” problem is solved based on the development of a floor-map-aided particle filter algorithm by weighting the particles, thereby also eliminating the gross-error effects originating from WiFi or P-O measurements. The performance observed in a field experiment performed on the fourth floor of the School of Environmental Science and Spatial Informatics (SESSI) building on the China University of Mining and Technology (CUMT) campus confirms that the proposed scheme can reliably achieve meter-level positioning.


Introduction
Indoor navigation has become an essential technique that can be applied in a number of settings, such as in a supermarket as a shopping guide, for a fire emergency service for navigation, or for a hospital patient for tracking. However, some techniques that have been successfully used that are similar to the Global Navigation Satellite System (GNSS) [1][2][3] are not suitable for indoor navigation. Real-time indoor positioning using existing techniques remains a challenge, and this is a bottleneck in the development of indoor location-based services (LBSs) [4].
The solution for indoor positioning is increasingly regarded as being based on the integration of multiple technologies, e.g., WiFi, ZigBee, inertial navigation systems (INSs), and laser scanning systems (LSSs). Each has its shortcomings, but an integrated system can combine the advantages of several of these technologies. Pahlavan and Li reviewed the technical aspects of the existing technologies for wireless indoor location systems [5]. There are two main hardware layouts that can be used in an indoor situation: (1) a sensor network, such as a WiFi or ZigBee system [6][7][8]; and (2) self-contained sensors, such as gyroscopes, accelerometers or magnetometers [9][10][11][12]. However, the stringent demands of reliable and continuous navigation in indoor environments are unlikely to be achievable using a single type of layout, and developing a hybrid scheme for reliable and continuous positioning is therefore a core prerequisite for real-time indoor navigation [13][14][15].
It is well recognized that trilateration and fingerprint matching are two basic WiFi-based approaches to locating an object in an indoor environment. In the first method, the user coordinates are calculated based on the distances between access points (APs) and the user. However, the distance measured based on the WiFi signal path loss model is so unstable that it is impossible to use such measurements in a practical indoor navigation system. Fingerprint matching is a more practical approach for use in a market-orientated indoor navigation system, and this technique has been widely researched, especially with the rapid market penetration of the modern smartphone. APs in supermarkets, schools, hospitals, and other infrastructures are also freely available for fingerprint database establishment. Artificial intelligence (AI) methods, e.g., decision trees and neural networks, constitute a new possible approach to determining a user's location [16]. Nevertheless, some inevitable shortcomings exist, e.g., tedious fingerprint database updates and the need to alleviate the "go and back" phenomenon by integrating other techniques [5,16,17]. In addition, the cost of continuously using the WiFi radio on a mobile device can be prohibitive. Nonetheless, such methods are the focus of significant research efforts [12].
Pedestrian dead reckoning (PDR) algorithms, based on accelerometer, gyroscope and magnetometer measurements, can be used as a complementary method of developing an indoor navigation system. The basic PDR procedure involves step detection, step length estimation and heading determination [4,17]. In practice, acceleration measurements are an ideal choice for step detection, considering the periodicity of a pedestrian's walking pattern, and there are three types of step detection algorithms: peak detection, flat-zone detection and zero-crossing detection. The deficiencies of the peak and zero-crossing detection algorithms create the potential for missing detection or over-detection if the thresholds are not appropriately set, and over-detection may also occur in the case of the flat-zone detection algorithm because the flat-zone test statistic varies with different walking patterns [18]. Considerable research has been conducted in an attempt to improve the accuracy of step length estimation, and the techniques that have been developed for this purpose can be summarized as constant/quasi-constant models, linear models, nonlinear models, and AI models [19]. A look-up table conveniently stores a few levels of step length for a given pedestrian based on his/her locomotion mode and the time duration of every step [20]. The linear relationship between step length and step frequency can be used to estimate step length. Kourogi and Kurata utilized the correlation between vertical acceleration and walking velocity to compute the walking speed and then estimated the step length by multiplying the walking speed by the time of the unit cycle of locomotion [17]. Cho presented a neural network for step length estimation that is unaffected by accelerometer bias and the acceleration of gravity [21]. A gyroscope and a magnetometer are two types of heading sensors that are typically used when the PDR algorithm is applied [22]. Klingbeil and Xiao proposed the concept of correcting the magnetic azimuth using gyro data collected over a short time, thereby allowing the heading angles to be estimated by combining gyroscope and magnetometer measurements [22,23]. A biaxial magnetic compass may be used to calculate the azimuth after compensating for the inclination of the compass using a shoe-mounted accelerometer [21]. The use of an INS/EKF framework to reduce heading drift has been demonstrated [11]. A detector has been proposed that can perform magnetic field measurements, which can be used for heading estimation with adequate accuracy. This detector utilizes different magnetic field test parameters that can be analyzed to produce good magnetic field measurements [24]. One factor that limits the use of PDR alone for indoor navigation is its susceptibility to cumulative errors over time. To improve the reliability and accuracy of a PDR navigation system, the gross error caused by the sensor's raw observations must also be avoided. To this end, an electromyography (EMG) method was presented and compared with a traditional method based on accelerometers in several field tests, and the results demonstrated that the EMG-based method was effective and that its performance in combination with a PDR algorithm can be comparable to that of accelerometer-based methods [24,25].
To overcome these constraints, a floor map can be used to further calibrate the bias and correct for unreasonable positioning results. For example, combining gyroscope measurements with the use of a floor map allows the orientation to be corrected using only map aids [26,27], and large heading errors are eliminated via the long-range geometrical constraints exploited by particle filters (PFs) [28]. Extending these techniques to multiple floors and stairways could also be made possible by significantly adapting their constraints to suit pedestrians [29,30]. Unfortunately, the large number of particles makes it unrealistic to operate such algorithms in a real-time manner. However, the integration of several techniques can dramatically reduce the number of particles required in a PF model.
To summarize, the methodologies of the whole article is concluded below: (1) Theoretical analysis. A series of basic researches have been analyzed. As mentioned in the introduction, the signal-based network such as Fingerprint System, and INSs should be two fundamental techniques in indoor localization. However, the stringent demands of reliable and continuous navigation in indoor environments are unlikely to be achievable using a single type of layout, and developing a hybrid scheme for reliable and continuous positioning is therefore a core prerequisite for real-time indoor navigation. The aim is to overcome the drawbacks of conventional architectures at theoretical level to make it possible to improve the performance of an integrated WiFi/pseudo-odometry system. (2) Integration Methodology Development. In the past, extended or unscented Kalman filter (EKF, UKF) and Particle Filter (PF) have mainly been used in data processing. However, in various cases as indicated in the introduction section, the situation is a little different. For instance, the noise dealt with by Kalman filter is assumed to be white noise, and PF algorithm requires a large amount of calculation. To overcome these constraints, a floor map can be used to further calibrate the bias and correct for unreasonable positioning results. (3) Physical System Implementation and Tests. The specific course is shown in Figure 1 below: In this paper, a scheme for indoor positioning by fusing floor map, WiFi and smartphone sensor data to obtain a real-time hybrid indoor navigation result is presented. Compared with the existing technology, Topology-Constrained KNN Positioning method introduced the floor map as a constraint, which could improve the accuracy and operational speed of the WiFi result. Besides, this method fits linear zones much better, such as corridors and narrow roads, which would be hard for GPS to fit, and the most useful places for WiFi localization technology. On the other hand, the multi-threshold PDR algorithm, presented in this paper, could clearly detect most steps accurately in the experiment. In addition, pseudo-odometry (P-O) is presented in this paper as a new exclusive term which means that by simulating the odometer, the step lengths are transformed to the time-domain (TD). The remainder of the paper is organized as follows: In Section 2, a topology-constrained KNN positioning algorithm is proposed, and Section 3 proposes a pseudo-odometry measurement simulation procedure based on a multi-threshold PDR algorithm. Subsequently, a WIFI/P-O integration scheme based on a fading-factor-based EKF is demonstrated in Section 4. Thereafter, Section 5 presents a scheme for floor-map-aided integration based on a PF, which is the core of the hybrid integration scheme. Finally, two experiments are analyzed in Section 6, and Section 7 concludes the paper.

Topology-Constrained KNN Positioning Algorithm
First, as the infrastructure of our indoor positioning approach, the signal fingerprint method, which is based on a WiFi technique, includes offline fingerprint database creation and online location matching.  An area of interest is divided into regular lattices during offline database creation, and the corners of the lattice are used as the training samples for the reference points (RPs). The fingerprint database is also created by collecting the received signal strength indicator (RSSI) measurements of the available access Points (APs) and the corresponding coordinate values ( , ) of the corners.

Topology-Constrained Fingerprint Database Creation
To improve the positioning accuracy, the geometric layout of an indoor floor map is modeled using a fingerprint database to a certain extent. For this task, the algorithm first segments the indoor floor map into sub-regions based on the specific building layout, and RP lattices of various shapes are clustered. Then, a topology-constrained fingerprint database is created by recording both the RSSI measurements and the geometric characteristics of the RPs. To be specific, the RSSI matrix i RP of the RP is given by where is the AP available in the sub-region. = ( , ) denotes the coordinate and the topology relationship, namely, and represent the coordinate of the RP and the topology relationship, referred to as the Geometric Strength of the Sporadic Signal (GSSS), between the RP and the other adjacent RPs, respectively. CI is the i th ( = 1,2, ⋯ ) cluster, where N is the total number of clusters.
denotes the RSSI measurement with respect to sub-region .

Topology-Constrained KNN Positioning Algorithm
It has been experimentally proven that the parameter K is not directly related to the positioning accuracy for the classical KNN fingerprint-database-based algorithm [31], and further research demonstrated that using a K parameter that has been corrected based on the indoor layout can improve the positioning accuracy [4]. In this paper, considering the RP topology in eight directions, a modified KNN algorithm, which chooses the value of K adaptively, is presented and implemented in a real-time indoor navigation system.
The GSSS indicator of the reference point ( ), which is denoted by | , is used to describe the topology structure. First, a given element of should be set to null if no adjacent RP exists in the corresponding direction. Subsequently, is determined by summing the numbers of available RPs in all eight directions. For instance, , as marked in Figure 2, is adjacent to three RPs, and therefore, the corresponding GSSS value is 3; and those of , and are 5, 8 and 2, respectively. To further illustrate the modified KNN algorithm, suppose that MT1 in Figure 3a is a user coordinate, which must be estimated based on the surrounding RPs, ( = 5, ⋯ ,8). Triangles RP5-RP7-RP8 and RP6-RP7-RP8 consist of RPs that can be simultaneously used to describe corresponding RP topologies. In this case, the K value of the KNN algorithm for the user MT1 is set to 3, and the estimated user coordinate is calculated as follows: where ( , ) denotes the estimated user coordinate and , is the RP coordinate of the K RPs. is the correlation coefficient between the RSSI matrix of the RP in the fingerprint database and the user's RSSI matrix measured in real time. In addition, K may also be set to 4 if the distance between MT1 and the center of the square is less than a given threshold. In the scenario depicted in Figure 3b, RP10 and RP11 are used to describe the topology, and the position of MT2 is calculated using the modified KNN algorithm with K = 2. For a given RP, the GSSS value varies from 1 to 8 in differently shaped lattices. Considering the calculation load, K should be set to 2 when GSS ≤ 2 but to 3 or 4 when GSS > 2. Overall, the procedure for indoor positioning using the modified KNN algorithm is summarized in Figure 3. Of the elements illustrated in this chart, the offline topology-constrained fingerprint database should be regarded as the highest priority. During online location determination, the user is required to record the RSSI measurement, which is used to determine the corresponding sub-region. Thereafter, the topology calculation is performed using the method described above. The K value and the corresponding RPs are also essential for the topology-constrained KNN algorithm to be able to produce the desired positioning results.
The flow chart of the topology-constrained KNN positioning algorithm is summarized in Figure 4. The offline topology-constrained fingerprint database is created and includes RSSI data and the corresponding coordinates, topology information for each RP and pre-set sub-region information depending on the floor map layout. In the online coordinate calculation phase, user-recorded RSSI measurements are first used to match the corresponding sub-region and determine the nearest RP. Thereafter, GSSS and K are calculated with respect to a specific RP. The RPs are eventually determined and used as input to the KNN algorithm to calculate the user positions.

Simulation of P-O Measurements
Despite the importance of WiFi data, there is a second indispensible input to this method, namely, inertial data (from inertial sensors), which will be introduced below in detail. It is widely known that pedestrian dead reckoning (PDR) algorithms, which are based on the number of footsteps and the step length, have recently begun to be implemented more widely. Moreover, a heading should be obtained as a value in the 2D plane and should be estimated based on measurements collected by a gyro and magnetometer, whereas the floor level can be detected in advance through barometer measurements. Sections 3.1 and 3.2 illustrate a new multi-threshold step detection algorithm and a hybrid heading estimation algorithm. Section 3.3 presents the flow chart of the P-O measurement simulation.

Multi-Threshold Step Detection
The maximum time duration of a step and the minimum and maximum changes in the acceleration magnitude during one step are frequently used as parameters in techniques for avoiding faulty step detection. The dynamic time warping (DTW) algorithm provides further improvement in step detection accuracy [32]. In this paper, a multi-threshold algorithm is proposed to detect steps based on raw acceleration measurements. The amplitude a of the extremum of an acceleration signal can be used to determine the stance or walking status of an individual. The step detection is terminated if the individual is stationary, and otherwise, a set of parameters of the multi-threshold algorithm is used for step detection. If and denoted the numbers of detected peaks and valleys, then a multi-threshold algorithm for peak detection can be described as follows: If only one peak is detected, i.e., − = 1, If two consecutive peaks are detected, i.e., − = 2, then the true peak can be detected as follows: where is the extremum of the peaks in the acceleration signal. ∆ is the difference between the consecutive peak values. ∆ is the time difference between the consecutive peaks. ∆ is the time difference between a consecutive peak and valley.
, ∆ and ∆ are the threshold values for peak detection, which are determined empirically. For example, ∆ is set to 0.2 s as an empirical value. If p Step is equal to 1, then a true peak is detected; otherwise, it is a false peak. as Figure 5a.
The parameters , ∆ , ∆ , ∆ can also be used to construct a multi-threshold algorithm for valley detection. If − = 0, Similar to the case of peak detection, if two consecutive valleys are detected, i.e., − = 1, then the true valley can be detected as follows: where is the amplitude of the valley extremum. ∆ is the difference between the two consecutive values. ∆ is the time difference between the consecutive valleys. ∆ is the time difference between a consecutive valley and peak.
, ∆ and ∆ are the thresholds for valley detection, where = and ∆ = ∆ . If valley is equal to 1, then a true valley is detected; otherwise, it is a false valley, as Figure 5b.
With the method we display above, we can find out the result of step detection as Figure 6.  Step detection using raw acceleration data.
Step length estimation is an important factor that affects the positioning accuracy and can be performed in combination with a step detection procedure. The step length is related to the acceleration and is typically given by where is the length of the step. and are the minimum and maximum amplitudes, respectively, of the acceleration. The value of the coefficient K depends on the individual and can be calibrated.

Hybrid Heading Estimation
Heading determination is a significant component of PDR-based positioning. The heading angle ψ is defined as the angle of rotation about the z axis with respect to the horizon/ground, which can be estimated using a gyroscope integrated with a magnetometer. The improved heading estimation algorithm presented by Wonho Kang is applied here [33]. The fused heading angle is calculated as follows: where m and n denote the magnetometer and the gyroscope. α, β and γ are the weights of the current measurements from the gyroscope and the magnetometer. , and , denote the measurements acquired by the gyroscope and the magnetometer, respectively, for the step. is the standard

Acceleration Measurement
Acceleration Amplitude Value peak detection valley detection raw acceleration deviation of the magnetometer, and is the correlation between the magnetometer and the gyroscope.
∆, is the difference between , and , . ∆, is the difference in the magnetometer reading between two consecutive steps k and k−1. Figure 7 shows the fusion results of a test in which a person walked forward five steps with a smartphone held firmly on his hand, stopped for a brief period, and eventually turned around and returned on the same path. The results reveal that the pseudo-heading measurements recorded by the magnetometer before and after the turn are considerably smoothed by the proposed algorithm.

P-O Measurement Simulation
Pseudo-odometry (P-O) is introduced to determine how far a mobile user terminal departs from a designated starting point, which can yield a relative distance measurement for indoor positioning. P-O measurements can be easily simulated by sampling the PDR distance in accordance with the rate of RSSI measurements, which are considered to be collected once every 2 s in this paper. Figure 8 presents a flowchart that summarizes the procedure for P-O measurement simulation.

North
Down East

Multi-threshold
Step Detection

Magnetometer Measurements
Heading Angle Fusion

WiFi/P-O Integration Based on a Fading-Factor-Based EKF
Despite the beneficial features of the approaches described above, the absolute coordinates obtained using the WiFi algorithm may exhibit a "go and back" phenomenon, which is tedious for user applications. P-O measurements can yield a relatively fluid user trajectory but suffer from accumulated positioning errors. A reliable integration algorithm must be adopted to alleviate the disadvantages of both the WiFi and P-O algorithms. A fading-factor-based EKF can accommodate the significant differences between the WiFi and P-O approaches and appropriately balance their weights; such an approach is proven to be effective in this paper.

Observation Equation
The observation equation for the integrated positioning based on WiFi, pseudo-odometry and magnetometer measurements can be written as follows: Its discretization can be written as where Z( ) = ℎ ; and are the position information obtained via WiFi in the northern and eastern directions, respectively; and and are the P-O increments of two consecutive samples in the eastern and northern directions, respectively; ℎ are the heading angle. ℎ ( ) is the k th recursive filter observation function, and V is the measurement noise vector.

Fading-Factor-Based EKF
The estimates of the state vector from the extended Kalman filter can be obtained by performing a time update and a measurement update at a given instant of time: = , , + where is the gain matrix of the extended Kalman filter at time k, is the k th recursive filter observation matrix, is the covariance matrix of the state vector at time k, is the covariance matrix of the measurement noise vector at time k, is the covariance matrix of the system noise at time k, and the subscript k, k−1 represents the state or covariance estimate from time k−1 to time k.
Through these five equations above, the and , which represents the status variable and covariance of the equations, respectively, could keep innovating as time goes by. Eventually, we could come to accurate coordination and velocity to a certain extent. However, as time advances, the old data lose their value generally through the improvement of accuracy. Therefore, a fading factor is required to define the weight among the observed value.
To balance the dynamic equation and the observation equation, a fading-factor-based EKF is used to overcome the deficiencies of the classic EKF to obtain more reliable navigation results [35]. Furthermore, the fading factor should be a self-adapting number to allow each variable condition to be managed accurately. The algorithm is written below: = ( + 1) , where represents the optimal solution for this formula, namely, the fading factor. ∑ represents the variance of the predicted residuals. ∑ is the variance of the optimal solution, and R denotes the measurement noise matrix. The modified covariance matrix modified is updated as follows: where is the covariance matrix of the state vector at time k and is the covariance matrix of the system noise at time k. and are the increments of the WiFi and PDR coordinates, respectively. is a threshold that is used to define whether the WiFi coordinate has "go and back", and if | − | < , then the WiFi coordinate will be considered to be reliable and will be input into the fading-factor-based EKF, where is given by Formula (20).

WiFi/P-O Integration Based on the Fading-Factor-based EKF
The flow chart for WiFi/P-O integration based on the fading-factor-based EKF is summarized in Figure 9. The topology-constrained WiFi positioning results and the P-O measurement increments are used to determine the fading factor, and the heading angle obtained by fusing the gyroscope and magnetometer measurements is simultaneously input into the observation equation. Then, the final positioning result is obtained using the fading-factor-based EKF model. The variation in the fading factor variation with respect to time in an experiment that is described in Section 6 is shown in Figure 10a, and the corresponding variation in the threshold δS is depicted in Figure 10b. The variation in the prediction weight of the position vector is shown in Figure 10c. It is illustrated in Figure 10 that the fading factor ultimately converges, and an initial sharp growth of the fading factor from 1 to a peak value of greater than 2.5 is caused by large errors in the WiFi positioning coordinates. Thereafter, it continues to decrease down to a value of approximately 1. Compensation for the dramatic changes in δS is provided by the weight value, which is adaptively adjusted through Equation (23). The value of 3 m selected for δS in this paper can eliminate almost all the gross error in the WiFi or P-O measurements.

Floor-Map-Aided Integration Based on a PF
Because the error may not be Gaussian in many situations, particle filters have recently seen widespread use in indoor positioning. However, such an approach typically requires nearly hundreds of times the number of calculations required by other filters because of the difficulty of the particle selection. Particle filters cannot be applied for real-time or near-real-time operation using a smartphone or other miniaturized devices. In this paper, a floor map is used to alleviate the computational load by constraining the particle numbers and providing more reliable location data.

Particle Filter
The posterior probability density Function (PDF) of a state ( ) given an observation ( ) can be approximately written as follows, according to Branko (2004) [36]: where p(•)and δ(•) represent the posterior probability and the Dirac function, respectively. N is the total particle number corresponding to a specific filter step k. ( ) is the particle of state ( ), and ( ) is the corresponding weight value. The sum of the N weights, ∑ ( ) , is equal to 1.
A particle filter has the merit of being applicable to a non-linear and non-Gaussian noise model. Multiple particle filters are available with varying performance; the classic auxiliary sampling importance resampling (ASIR) algorithm is used in this paper. This filter comprises the following six steps [37]: (1) Initialization: The particle filter begins by generating N particles(x (0), i = 1 ⋯ N) based on the initial PDF p (0) .
(3) Importance Sampling: For any particle ( + 1) , the weight is ( + 1) = ( + 1) ( + 1) which actually defined by the distance between its prediction position and observed value. (6) Calculation of Results: The classic ASIR algorithm is used to obtain the filter results.
The accuracy and stability of the particle filter primarily depend on the number of particles used, but as the number of particles increases, the amount of calculation and the calculation time increase. For the given particle filter, the mean square error (MSE) and the calculation time (CT) are shown for various particle numbers (PNs) in Table 1.  Figure 11. The error maps for various particle numbers.  Figure 11 is also useful in the attempt to determine an appropriate particle number for a simulation. Once the particle number reaches 300, the MSE is reduced to approximately 3 m, and the calculation time increases to 6.536 s. Afterward, the MSE remains nearly unchanged with an increasing number of particles, although the calculation time continues to increase.

Map-Aided Particle Filter
A floor map records the positions of the walls and the obstacles in an indoor scenario, which may restrict the movements of the particles and provide more reliable position information. If the predicted position of a particle passes outside the effective region of the map, then the corresponding weight of the particle filter is set to zero: if the particle id outside the effective region where ( ) and ( ) denote the N and E coordinates, respectively. represents the variance of the results of the EKF algorithm, which is set to 1 m in this paper. A test similar to that presented in Section 5.1 demonstrates that the floor-map-aided PF algorithm can provide more accurate and stable results in a shorter amount of time and using a considerably smaller number of particles; a calculation time of less than one second can be achieved using mobile phones (Table 2).

Scheme for Floor-Map-Aided Integration Based on a PF
The flow chart for floor-map-aided integration using a particle filter is summarized in Figure 12. The number of particles must be decided before the particle filter is used to integrate the integrated WiFi/P-O coordinates and the floor map, and the floor-map-aided weighting formula given by (20) is also used to avoid the "go and back" phenomenon. The detailed performance of the proposed scheme will be demonstrated in Section 6.

TEST One
To verify the effectiveness of the proposed algorithm, a field experiment was performed on the fourth floor of the School of Environmental Science and Spatial Informatics (SESSI) building on the campus of China University of Mining and Technology (CUMT) in Xuzhou, Jiangsu, China. In Figure 13, blue outlines indicate linear corridors, black outlines indicate non-linear corridors, and other areas are unavailable for a person to pass through. Sixty APs in total are distributed along the corridors on the ceiling (Figure 14). A SAMSUNG GALAXY S4 was used as the user terminal in the experiment; its technical specifications are shown in Table 3.   The EKF was used to fuse the information from different sensors for Schemes 1-3. In Scheme 4, the PF was used for floor-map-aided modeling, and the number of particles was set to 100. The smartphone was held as stable as possible during the experiment and thus was considered to be synchronized with the human body's motion. The floor level should, in general, be determined in advance from barometer measurements, although only two-dimensional positioning was considered here. Figure 15 shows the position trajectories for the four schemes. The colorful dots represent the paths of travel calculated using the different schemes. In the test, the test participant walked with a uniform and stable gait; therefore, the true trajectory should be stable. Figure 15a demonstrates that the positioning accuracy achieved using WiFi is often related to the intensity of the points from the fingerprint database. The accumulated errors in the locations and the "go and back" phenomenon adversely affect the positioning results.
The PDR algorithm, the results of which are shown in Figure 15b, inevitably incurs cumulative errors, as shown in Figure 16. Over time, the accumulated error increases, although this error could be mitigated by the floor-map-aided algorithm.  As seen from Figure 15c, the positioning results of the WPO algorithm are more evenly distributed and rarely suffer from the "go and back" phenomenon. The results illustrate that the EKF fusion algorithm preserves the continuity and stability of the PDR algorithm while simultaneously restricting the accumulation of error, thereby improving the positioning accuracy. Moreover, some positioning results  Figure 15c that are located in impassable areas are excluded when the floor-map-aided integrated WiFi/P-O positioning algorithm is used, as shown in Figure 15d.
As observed in Figure 17, the particle distribution of the MWPO algorithm is restricted to lie within the accessible region. In this case, the particle sample number was set to 50. For single-point positioning, the calculation time of this algorithm is notably shortened, as analyzed in Section 5.2, enabling it to run on a smartphone.   The statistics of the MSE, the average error (AE) and the maximum error (ME) reveal that the map-aided algorithm achieved the most reliable and accurate positioning results. In this test, the accuracy indicated by the MSE of the integrated WPO indoor positioning algorithm with EKF was improved by 22.9% compared with the pure WiFi algorithm, and the AE and ME were reduced by 7.4% and 53.5%, respectively. Compared with the PDR algorithm, the MSE of the integrated WPO algorithm was improved by 48.1%, and the AE and ME were reduced by 41.8% and 61.8%, respectively. The integrated MWPO positioning algorithm was more accurate than the WPO algorithm, with an MSE improvement of 4.9%, an AE reduction of 18.0% and a similar ME (Table 4). As seen from the comparison, the integrated MWPO positioning algorithm results in an improvement in the accuracy, reliability, and calculation rate and a decrease in the accumulated error; therefore, this method is superior to the others to a certain extent.

Test Two
To demonstrate the robustness of the MWPO integration algorithm for a smartphone-based indoor positioning system, gross errors were added to the WiFi observations as listed in Table 5.  Figure 19 illustrates the positioning trajectories determined using the WPO algorithm and the MWPO algorithm. As shown in Figure 19a, the three gross-error-contaminated points cause the trajectory to deteriorate around the affected epochs as a result of EKF recursion. In Figure 19b, the gross-error effects are entirely mitigated with the introduction of the MWPO algorithm. Table 6 shows the residuals of these two algorithms for each affected time point (40 s, 60 s and 80 s), and the results demonstrate that the MWPO algorithm achieves much higher reliability and accuracy.  Gross errors were also added to the P-O measurements as listed in Table 7 to verify the robustness of the WPO and MWPO algorithms. The resulting positioning trajectories obtained using the WPO algorithm and the MWPO algorithm are shown in Figure 20. As shown in Figure 20a, the three gross-error-contaminated points cause the trajectory to deteriorate around the affected epochs as a result of EKF recursion, similar to Figure 20a, and again, the gross-error effects are mitigated in the case of the MWPO algorithm. Table 8 lists the residuals of the gross-error-contaminated epochs.   These results demonstrate that the MWPO algorithm is more robust than the WPO algorithm, regardless of where the gross error originates.
These observations yield the following conclusions regarding the investigated positioning algorithms for indoor navigation systems.
(1) A topology-constrained K nearest neighbor (KNN) algorithm and a multi-threshold PDR algorithm are treated as the fundamental basis of this methodology, and P-O measurements are simultaneously simulated. This approach represents an innovation in the attempt to combine WiFi and PDR data by providing a common axis (time axis) other than the step duration. (2) The position determined based on WiFi data experiences fluctuations to some extent, particularly in certain locations, such as windows, glassed-in rooms and corridors. It was experimentally demonstrated that with the addition of supplementary data from inertial sensors, this fluctuation can be considerably decreased, thereby improving the reliability of the algorithm. (3) Considering the issue of the fanning out of positions at corners, a fading factor was incorporated to improve the rate of convergence, thereby decreasing the fluctuation to an acceptable level and improving the accuracy of the entire algorithm. (4) Despite the high accuracy provided by particle filters, a particle filter always requires a considerable amount of calculation, and therefore, most experiments using PFs require a central computer to cope with the information obtained from the nodes. However, incorporating an electronic map of the structure in question into the analysis eliminates redundant operations, thereby helping to improve computational speed and quality.
(5) With the development of methods of integrating the data from both WiFi and inertial sensors (P-O measurements), decreasing fluctuations (including rebound) and increasing particle filtering efficiency (map aid), the proposed hybrid algorithm succeeds in combining the measured data within a common time axis, improving the positioning reliability and producing a dramatic upward shift in operating rate and quality. Therefore, it offers the possibility of quasi-real-time measurements using mobile phones instead of a central computer, as has generally been used in other recent experiments.

Conclusions
This paper investigated several positioning algorithms for indoor navigation systems. A topology-constrained K nearest neighbor (KNN) algorithm and a multi-threshold PDR algorithm were presented, and P-O measurements were simulated. The proposed floor-map-aided WiFi/P-O integration algorithm combines the complementary advantages of all three techniques using a particle filter (PF) model. The experimental test results indicate that the integration of these techniques can not only avoid the "cross-wall" phenomenon but also the gross-error effects inherent to WiFi and P-O measurements. It was demonstrated that a higher indoor positioning precision can be achieved using a smaller number of particles when a floor map is used. The further development of the algorithm will focus on improving the calculation efficiency to allow it to run more efficiently on a smartphone system.