A Directional Particle Filter-Based Multi-Floor Indoor Positioning System

In recent years, extensive research and applications have demonstrated that a more accurate and stable indoor positioning system (IPS) can be realized through the complementarity of different technologies. However, improving the accuracy of a single positioning technology would significantly impact the subsequent fusion. In this paper, we proposed a smartphone positioning system based on pedestrian dead reckoning (PDR) fusing with a floor estimation module (FEM) and a directional particle filter (PF) extracted by the idea of a regular PF to improve positioning accuracy. Generally, particles are generated by circle-shaped distribution by a regular PF, leading to producing some useless particles that waste computing resources. To tackle this issue, our proposed directional PF uses the particle more effectively by adjusting the distribution shape of particles with an estimated moving direction. Comprehensive experiments are conducted to verify the positioning accuracy and robustness of the proposed method. The experimental data show that the positioning error of our proposed method is only 1.53 m in a multi-floor path with a total length of 306 m.


I. INTRODUCTION
Within the world, a new generation of technological development has been growing exponentially in the past decades. None of us would have been living in a world framed by a single solution. By exploring the Internet, there must be several solutions to a problem and indoor positioning is not an exception. The most traditional way of accomplishing an indoor positioning system (IPS) includes visible light communication (VLC) [1], [2], pedestrian dead reckoning (PDR) algorithm [3], Wi-Fi fingerprint [4], Wi-Fi channel state information (CSI), Bluetooth low energy (BLE) beacon [5], ultra-wideband (UWB), etc. However, signal-based IPS such as Wi-Fi fingerprint requires the deployment in advance for the database and the collections of footprints, which is time- The associate editor coordinating the review of this manuscript and approving it for publication was Le Hoang Son .
consuming. Apart from this, buildings with less access point (AP) coverage would have caused a lack of data for an IPS to determine location accurately. Also, data preprocessing plays an essential role in Wi-Fi fingerprint, because the final output would be plagued with faulty insight.
The PDR algorithm computes the inertial measurement unit (IMU) value and is based on the previous location to predict the next possible location, which belongs to a continuous and relative positioning algorithm. With each operation, the direction and the moving distance [6] calculated by the IMU errors continue to accumulate in the positioning results. As a result, the positioning accuracy will deteriorate over time.
As we need to pursue a more stable and accurate system, we should consider the geomagnetic issue which might influence the magnetometer to calculate the destination accurately with the data of the gyroscope as this is the principle of how the filtering algorithms [7] work. Also, the quaternions VOLUME 10, 2022 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ complementary filtering (QCF) [8] algorithm is in charge of estimating the attitude of a smartphone. With the help of ubiquitous modern filtering algorithms, the above problems could be optimized effectively in our IPS. With regard to filtering algorithms, we will be covered in the following chapters.
In the past decade, extensive research was focused on realizing the complementarity of different technologies to improve the accuracy and robustness of IPS. However, before we make a fusion of different technologies, we are responsible to ensure one of them is accurate enough to do further research. Thus, our proposed method aims to improve the positioning accuracy based on the PDR algorithm and some idea of the particle filter (PF).
In our proposed method, we have implemented the QCF to enhance the estimation of the smartphone attitude. Besides, particles are generated based on the previously estimated position. Compared with general particle distribution, we use the particle more effectively by adjusting the distribution shape of particles. With the increase of probability density, the system can be prevented the waste of particles and computing resources. Extensive experiments have been carried out in various aspects to evaluate the proposed method.
The paper is organized as follows. The fundamental of PDR and PF algorithms will be described in Section II, and our proposed method in this paper is presented in Section III. The performance analysis and evaluation of several experiments have been conducted in Section IV, and a brief conclusion is given in Section V.

II. RELATED WORK
Through the analysis of human walking behavior [9], [10], the concept of PDR was proposed and widely used in indoor positioning. By giving a known starting location, the user's location can be tracked via the moving distance and direction as the formula shown as where P k is the two-dimensional coordinates of the pedestrian, L k is the user's step length, and θ k is the heading direction at time k.
Once the pace occurs, the latest location is updated through the formula. The method not only has outstanding accuracy but also provides more instant position information than other positioning methods. However, the algorithm still has several serious drawbacks such as environmental interference and poor sensor quality. Most importantly, the positioning error gradually accumulates as the user goes further and further. Thus, a large quantity of research has contributed to improving the shortcoming of PDR from different aspects.

A. ORIENTATION REPRESENTATION AND FILTER
To present the practical orientation in the real world, various rotation formalisms have been proposed, e.g., Euler angle [7], rotation matrix [11], and quaternion [12]. While there exists the gimbal lock for Euler angle and ineffective computing for rotation matrix, the quaternion is with the advantage of less storage and faster calculation of rotation by simply multiplying each quaternion. Hence, quaternion formalism is extensively applied in the recent sensor fusion algorithms of orientation estimation.
Furthermore, several filtering algorithms were presented to reduce noise to refine the accuracy to a higher degree, including the Mahony filtering algorithm [13], extended Kalman filter (EKF) [14], Madgwick filtering algorithm [12], etc. Of all the filtering methods, EKF plays an important role in the optimization of a system but is not the most effective way [15] to perform it. Even though the EKF has the advantage of solid mathematical foundations and high accuracy, the method has computational complexity involving matrix inversion and multiplication. Additionally, EKF expected the probability distribution to be Gaussian which is not the case for our problem. In contrast, a complementary filter (CF) [16] keeps flexibility and accuracy without considering detailed noise processing. Therefore, the CF is widely used in micro aerial vehicles (MAV) [17] and unmanned aerial vehicles (UAV) [18]. The fundamental of CF applies a high-pass filter to the integrated gyroscope sensing rapid biased tilt signals and applies a low-pass filter to the lower rate measurements. In addition, two glorified CF algorithms were presented. Mahony solved the nonlinear attitude observers on Special Orthogonal Group SO(3), and Madgwick used a gradient descent algorithm achieving the level of accuracy matching Kalman-based algorithm.

B. POSITION CALIBRATION
As of now, the PF is the most popular method of calibrating PDR results. A Bayesian filter [19] is a general probabilistic approach for estimating an unknown probability density function (PDF) [20] recursively over time and it is indispensable to the PF algorithm. Besides, the theory of PF is to implement a recursive Bayesian filter using the sequential Monte Carlo method which is also known as the sampling method to express PDF and gives each sampling point a value by where p is the probability of particles; µ is the mean value of the Gaussian distribution and also the original estimated position; σ is the width of the Gaussian distribution; d is the distance updated by where x and y are the current position coordinates of the particle; x 0 and y 0 are the original estimated position coordinates of the particle. Then assigns each particle with a different weight by calculating (4) and resamples all the points, where w i represents the weight of the i th particle and p i is the probability of the particle. Eventually, a new set of particles obtained after resampling will become the beginning of the next cycle. Hence, the PF algorithm estimates and corrects the position of the user P k by where the w i represents the weight of each particle and P i is the position of each particle. There are tons of research [21], [22] already proved that the PF algorithm contributes significantly to improving IPS. In our case, the PF is the most effective way to deal with non-linear and non-Gaussian probability distributions. However, most particles are useless and waste computing resources. To overcome these issues, we proposed a directional PF to use the filter more efficiently.

III. METHODOLOGY
The system proposed in this paper uses smartphones as positioning devices and locates in a multi-floor environment based on the PDR algorithm under the condition of zero environmental infrastructure. The system frame composition is shown in Fig. 1. Pedometer and QCF modules are realized by the IMU built into the smartphone including an accelerator, gyroscope, and magnetometer. When a new step is detected by the step detection service, the PDR calculates the current position according to the initial position, the length of the step, and the walking direction and thereby realizing the prototype of a relative positioning system.
Based on the prototype of the system, a barometer is added to a floor estimation module (FEM) to provide altitude information. First, the variation of initial and current air pressure is used to identify the floor. Second, the building information modeling (BIM) of the corresponding floor is loaded according to the result of FEM. Eventually, several functions and calibrations can be extended through BIM.
The step length calibration (SLC) module is one of the calibration modules extended from BIM. The purpose of the module is to obtain the optimal step length to improve positioning accuracy. The PDR operates according to the fixed step length input by the user, but this value is a rough measurement value that is slightly different from the actual walking step distance. As mentioned previously, these slight errors continue to accumulate after each operation of PDR, which eventually leads to unreliable prediction results. To obtain the optimal value, the module expands the input value as the center and selects several values to execute the PDR simulation. By analyzing the simulation results, the most suitable step length at present is found, and an autonomously configured pedestrian dead reckoning algorithm [23] is realized by using this optimal value. In rare cases, while all the results are invalid, the regular PF considering BIM is triggered to obtain a new initial point for simulations. Otherwise, the valid results are used to calibrate the result which is out of the available area.
To reduce the influence of the accumulated error mentioned previously, the directional PF is proposed to calibrate the results of each step. In addition, the proposed filter which considers the heading direction to restrict the distribution of the particles allows each particle to be used more effectively. The weight of the particles is not only determined by the distance but also integrates information from BIM. Eventually, the result of the directional PF is used as the user's location.
So far, the operation process of the entire system has been briefly described. The following sections will discuss more detail in the major module of the system, including BIM, QCF, SLC, and directional PF.

A. BUILDING INFORMATION MODULE
BIM [24] is essential in the proposed system. The module converts the floor plan which is a two-dimensional array into one-dimensional data. Compares to the figure, converted data are more efficient to be used while designing correction mechanisms. In order to speed up the converting process, a Windows-based application was designed. The interface is shown in Fig. 2. First, the application will load the floor plan of the building and divide it into several regions, and encode the regions from left to right and from top to bottom. After completing the plan VOLUME 10, 2022 set, the walkable area can be drawn in the drawing area, and the selected area will be filled with blue and its number will be recorded. After the process is complete, BIM is exported in the form of comma-separated values.

B. QUATERNIONS COMPLEMENTARY FILTER
While walking with a hand-held smart device, the values of the gyroscope and magnetometer change with the direction of the pedestrian. The output values of the two sensors are variations in angle, but their meanings are quite different. The value presented by the magnetometer is the relative change between the device and the earth's magnetic field whose distribution is stable. However, the value is not only affected by the earth's magnetic field, but also by any object or device in the environment that can generate a magnetic field. The disturbed values can cause serious positioning errors. Compared with a magnetometer, a gyroscope is less susceptible to interference from external magnetic fields, but it is also impossible to calculate the user's direction relative to the geomagnetism by simply using the gyroscope. By integrating the advantages of the two sensors, QCF can reduce the impact of the above problems. The normalized gyroscope signal calculates the quaternion tilt from the previous orientation to integrate its next estimating attitude, which is complemented by the fusion of accelerometer and magnetometer quaternion to correct the biased error of the gyroscope signal by a calibrated parameter α as where q k is the estimated quaternion attitude, q ω is the angular velocity quaternion computed from the data of gyroscope and previous attitude, q am is the correction quaternion based on the data of accelerometer and magnetometer, and α is the calibrated parameter that is the only parameter needed to adjust in QCF to compensate the bias of angular velocity quaternion.

C. STEP LENGTH CORRECTION
In the program initialization stage, the system calculates the position of pedestrians according to the step length input by the user. However, this step length is subject to artificial measurement errors, which may be inconsistent with the real step length, and the step length is often short due to the influence of terrain, psychology, obstacles, etc. These step length errors will continue to accumulate in the positioning results of the positioning algorithm. For the purpose of solving the above problems, the system takes the initial step length as the center and selects multiple lengths to run PDR simulations, and the positioning results of these simulations will be used as the basis for correction. The result of simulations is used as the basis for dynamically adjusting the step distance. First, the results are filtered through BIM to determine whether the result is credible. Then, the credible results are fused and added to the historical list. After filtering the list by moving the average, the most appropriate length for the current step will be obtained. To make the positioning result more credible, the PDR will be traced back to the previous predicted position and re-execute the calculation. Repeat the above operations and increase the length of the backtracking one by one until the selfdefined backtracking upper limit. Eventually, calculate all valid backtracking results to get the appropriate position.
In practical application, the variation range of step length is most significant in stairways and corridors. With the walking habits of different users, there is a huge gap between the distance from one step up to the preset length when going upstairs. Moreover, the step frequency is greatly increased when going downstairs. Dynamic adjustment of step length can effectively reduce the positioning error caused by the above factors.

D. DIRECTIONAL PARTICLE FILTER
The combinations of PF and the PDR algorithms have always been multifarious research topics [3], [21] for IPS. The purpose of this paper is to eliminate the traditional way to achieve our goal. In the traditional way, samples are around the user to find the next most possible step for them.
Instead of using a circle, we spread the particle as a sector. In several experiments, we have found that the samples behind the user will not often be used. In addition, we should be more concentrated on the sample around the front of the user. Most importantly, there's no such research for our reference. The distribution difference between a circle and a sector is shown in Fig. 5 and Fig. 6 below.  In the same quantity of samples, after we have reduced the size from a circle to a sector, the density of samples will be a higher degree. Apparently, the main idea of this is to make those samples become closer to the next step for the user. Apart from this, we redefine the unit of parameter d, which represents the distance between the particle and the generating center according to PF with a variable named scale (s). When s = 1, the unit of d is a centimeter, and when s = 100, the unit of d is a meter. The larger the range of s, the smaller the relative distance between the particles and the center. Hence, the way our directional PF distributed particles as where d i is the distance between the i th particle and the original estimated position; θ i is the estimated attitude of the i th particle; θ thld is the threshold of the sector to sprinkle particles.

IV. PERFORMANCE ANALYSIS
All experiments have been performed with the off-the-shelf smartphone, which is Google Pixel 4a with Android 10 operating system to validate the performance of our proposed scheme. The experimental field is the College of Electrical Engineering and Computer Science (CEECS) of National Taiwan University of Science and Technology (NTUST). The sixth to the eighth total of three floors simulate the multi-floor indoor environment. The floor length-width ratio is 80.7 m by 16.3 m, and the building area is about 1,315 m 2 . Since the buildings are primarily private areas of professors' offices and laboratories, so the experimental scope is only tested in public areas such as corridors, stairwells, and elevators. According to the standards of international positioning events [25], the experimental process arranged checkpoints in space and gave each measuring point a number. Testers walked along a designed path of the numbering sequence and stopped to press the button in the program to record the current calculation result whenever they crossed the measurement point. The experimental route is shown in Fig. 7 below and the total amount of checkpoints is 46. The whole process will not stop until all measurements are completed. The record file will be compared with the coordinates of the measurement point, and the distance between the calculated value and the measured value can be obtained by Euclidean distance. The calculation result represents the positioning error.
The whole experiment was comprised of two major parts which included offline and online experiments. An offline experiment will be presented to proceed with some simulations to establish a standardized prototype in advance. Most importantly, the upcoming online experiment will try to validate the previous simulation to make a complete comparison.

A. OFFLINE EXPERIMENT
In the offline experiment, we write the signal variation of the sensor from the test process into the file and reproduce the tester's moving track through these data. As a result, we can optimize the system parameters through incessant simulation. The following chapters will focus on finding the directional PF parameters that are most appropriate for this experimental field. Moreover, the positioning mean error (PME) in the experimental process is used to evaluate the positioning effect.

1) THE SHAPE OF THE DISTRIBUTION
Compared with the regular PF, the directional PF proposed in this paper can specify the direction of particle generation, so that the particles can be used more efficiently. The generated shape can be defined by adjusting the angle value. Fig. 8 shows the influence of different angle values on the PME.
The results of directional PF and regular PF are distinguished by blue and red in the figure. After 3,600 rounds of simulations, it shows that the average value of PME is 1.91 m when particles are generated in a circular way; the angle has the best effect at 240 • and 270 • , and the average PME is 1.62 and 1.54 m respectively. Although the average value of 240 • is not the lowest, it shows good stability and its interquartile range (IQR) is only 0.15 m, which is 44.5% lower than that of 270 • . Subsequent simulations of other experiments will be performed at 240 • .

2) THE RANGE OF THE DISTRIBUTION
The radius value determines the range where particles can be generated. To be closer to the settings of different testers, the unit of the radius is the number of steps in our design.  it can be observed that when the radius is 1, the generation range of particles is too small and the particles are excessively concentrated in the center, so most of the particles are included in the calculation, which also contains many noises, resulting in unstable results with IQR value of 0.21 m. However, when the generation range is gradually increased, this phenomenon will be greatly improved. Under the condition that the number of particles is 150 and the value of radius is 6-8, both IQR and PME show better results.

3) THE VARIANCE OF THE DISTRIBUTION
The filter uses PDF to calculate the probability of particles and calculates the final correction position according to the value of probability. As mentioned in the previous formula, the result of PDF is greatly affected by σ and s. The following experiments show the influence of two parameters. Fig. 10 shows 1,800 simulation results of different σ , and the results show that when σ is between 1.0 and 3.0, good period correction results are obtained. When σ = 1.5, the overall distribution is more concentrated, and its PME is 1.66 m.   11 shows the influence of different s on the results. After 6,750 rounds of the simulation, the results indicated that there is a slight difference in positioning effect when s is less than 15, and the average PME. When s = 9 is the lowest, with a value of 1.65 m.

4) QUANTITIES OF PARTICLES
In the PF, the number of particles is one of the most crucial parameters. The number of particles not only affects the correction effect but also directly affects the execution time of the filter. The relationship between positioning accuracy and execution time for different n, which contains nearly 5,000 simulation results in total. From the results, it can be observed that when n gradually increases, the positioning result gradually stabilizes, and at the same time, the time of each execution gradually increases; when n is too large, the correction effect gradually diverges, and the execution time is lengthened to several times, which eventually takes up all the computing resources of the device. Appropriate n is indispensable for the normal operation of the system and needs to be evaluated from many aspects. From the simulation results, n = 175 has an excellent performance in accuracy, stability, and operation time.
We progressively selected the appropriate parameters from the above simulations and re-simulated one hundred times with this set of parameters. The results are shown in Fig. 13. The simulation results of PDR with directional PF show that the average PME is 1.53 m, IQR is only 0.06 m, and the PME of the best and worst results is 1.38 m and 1.69 m consecutively. In contrast, the PME and IQR of PDR with regular PF are 1.93 m and 0.10 m respectively. The proposed method improves PME by 21%, and IQR increased by 40%.

B. ONLINE EXPERIMENT
In the online experiment, we invited fifteen untrained people to participate. These testers presented the most realistic performance and use different walking habits and individual differences to verify the stability of the system. As mentioned previously, these differences greatly affect the accuracy of the algorithm. Fig. 14 shows the individual differences between the participants.
Before conducting the test, we measured the step length of the participant previously mentioned and input the value into the system. Except for the step length, other parameters in the system refer to the results obtained by the offline experiment.
The accuracy of the system is evaluated by the mean error and the endpoint error (EPE). The lower the mean error means the better the stability of the system, while the smaller the EPE proves that the system can solve the influence of accumulated error on the PDR algorithm. Fig. 15 shows the average results of each participant and Table 1 shows the statistics for the entire experiment. Both of   them indicate the proposed method has better performance and more stability even when applied to different users.
To show more detail of the experiment, one of the results is presented in Fig. 16 and Table 2. The selected data is the result closest to the mean, and its mean error of PDR and proposed PDR are 4.76 and 2.55 m respectively. Since Regular PF generates new particles by giving weights around the PDR result, regular PF is possible to converge to the incorrect result of non-moving directions, especially in open areas. Our proposed method utils the moving direction to limit the particle generation area, which effectively suppresses the continuous accumulation of errors, but also causes the result to temporarily be obstructed by BIM at the sixth to eighth checkpoints. Even if PDR had an error of 7.92 m after multiple floor changes, our method finally achieved a good result with an EPE of 2.26 m.
According to the above experiments, we can find out that the proposed method has better accuracy and stability regardless of the simulation of single-person data or the actual measurement of multiple persons. In the offline experiments,  we obtained stable direction changes by using QCF and achieved a PME of 4.39 m in a 306-meter multi-floor path. Using the record of the sensor values, we simulated the positioning result and occurred that the proposed method had better stability than the regular one. The results showed that IQR was reduced by 77.78%. In the online experiments, the proposed method combining BIM and directional PF to correct the positioning results succeeded in reducing PME by approximately 46.43% and EPE by approximately 64.71%.

V. CONCLUSION
This research aims to identify effective filtering methods combined with the PDR algorithm for dealing with the higher accuracy of our IPS. Based on the research, we have adjusted the distribution shape of particles which helps us to use the particles more efficiently. Most essentially, it is necessary to find the directional PF parameters that are most appropriate for this experimental field.
Compared with other algorithms, our experiments have demonstrated that our proposed method not only improves the estimation of device position but further minimized the error of PDR to1.53 m in a multi-floor path with a total length of 306 m. For future work, we aim that the aforementioned method can fuse with other absolute positioning algorithms to provide a more accurate and robust IPS. Currently, he is an Associate Professor and the Head of the Department of Radio Engineering, and the Chairperson of IoT branch of master study programme with CTU. His main research interests include signal and image processing, embedded systems, the Internet of Things, and machine learning. He is a member of numerous international teams focused to networks of robotic telescopes. VOLUME 10, 2022