WiFi RTT Indoor Positioning Method Based on Gaussian Process Regression for Harsh Environments

A novel two-way ranging approach was introduced into the Wireless Fidelity (WiFi) standard, and its ranging accuracy reached one meter in a low multipath environment. However, in harsh environments due to multipath or non-line of sight (NLOS), the range measurement based on the WiFi round trip time (RTT) usually has low accuracy and cannot maintain the one-meter accuracy. Thus, this paper proposes an indoor positioning method based on Gaussian process regression (GPR) for harsh environments. There are two stages in the proposed method: construction of a positioning model and location estimation. In the model construction stage, based on known positions of access points (APs), we can determine the position coordinates of some ground points and the reference distances between them and the APs, and the offline ranging difference fingerprints can be generated by the reference distances, which means that there is no need to collect data. Gaussian process regression (GPR) utilizes offline ranging difference fingerprints based on the reference distance to establish a positioning model, and the particle swarm optimization (PSO) algorithm is employed to estimate the GPR hyperparameters. In the location estimation stage, the gathered actual range measurements generate the online ranging difference fingerprint, which is the input data of the positioning model. The output of the model is the estimated position of the smartphone. Experimental results show that the mean errors (MEs) of the proposed method and Least Squares (LS) algorithm are 1.097 and 3.484 meters, respectively, in a harsh environment, and the positioning accuracy of the proposed method improved by 68.5% compared with the LS algorithm.

with the expansion of the positioning area. A good lighting environment is needed for computer vision to extract clear features from the picture, and computer vision is able to reach centimeter-level precision. However, the large amount of computation and sensitivity to the environment prevent computer vision from becoming a mainstream indoor localization method. INS includes two categories: pedestrian dead reckoning (PDR) and integral reckoning. PDR can utilize low-accuracy sensors to acquire high-precision positioning results over short distances. However, it has error accumulation and drift phenomena with increasing distance. For some high-accuracy sensors, the integral approach can be used to realize high-precision positioning.
WiFi-based indoor localization mainly includes two types: fingerprinting [12]- [14] and multilateral positioning [15]. Fingerprinting has two stages: the offline stage and the online stage. In the offline stage, the main task is to build the offline fingerprint database with the received signal strength (RSS) [16] or channel state information (CSI) [17] data. In the online stage, the online fingerprint is employed to match the offline fingerprint database to acquire the position. The classic matching algorithms include nearest neighbor [14], GPR [18], and neural networks [17]. Multilateral positioning utilizes the measured distances between the receiver and transmitters to acquire the position. Its advantage is that there is no need to build an offline fingerprint database. The shortcoming is that the position of transmitters must be known. The usual algorithms of multilateral positioning include LS [14], [19], weighted least squares (WLS) [20], [21], and trilateration [20], [22]. However, the range-finding method based on RSS is easily affected by the environment, and its ranging accuracy is very low. The ranging method based on CSI has good ranging precision but needs special equipment, which indicates that this method has certain limitations and cannot meet the needs of users with large amounts of data. Therefore, the traditional ranging methods based on WiFi have some defects and cannot support the realization of universal and high-precision indoor positioning.
The fine timing measurement (FTM) protocol [23] was added to the WiFi standard in 2016 and provided a new two-way ranging approach and allowed for range estimation based on round trip time (RTT) measurements [24]. It brought some changes to WiFi-based indoor positioning technology, including the appearance of a range-finding method without clock synchronization [25]. However, the range measurement of this new method was also affected by external factors such as obstacles, multiple paths, human bodies, Bluetooth signals, and WiFi signals.
The range measurement has low accuracy when disturbed, which produces a significant negative impact on the positioning result [26]. It is hence extremely important to reduce the negative effect of low-precision range measurements on position estimation. Some researchers suggested methods to solve the above problem. For example, the range measurements under a line of sight (LOS) condition were identified by the RSS value and utilized to estimate the position [27]. A compensation model under the ideal environment was constructed to adjust the range measurements to improve the ranging accuracy [28].
Guo et al. [29] analyzed the distribution of the RTT ranging error and constructed a ranging error model based on Gaussian distribution by fitting. However, it was very difficult to recognize the low-precision range measurement due to the limited positioning information, especially when only the measuring distances were known. The positioning result based on the traditional algorithms such as LS and trilateration will be away from the true location when the low accuracy measurements are not eliminated or calibrated. Moreover, the above methods did not study positioning based on WiFi RTT in harsh environments where the range measurement was always unstable and had strong ranging errors.
Thus, this paper proposes an indoor positioning method using WiFi RTT based on GPR for harsh environments, which aims to defend against the impact of harsh environments and overcome the influence of low-precision measurement on positioning accuracy. The proposed method includes two stages: model construction and location estimation. In the model construction stage, the primary task is to obtain the training data, which is the establishment of the offline ranging difference fingerprint database. We acquire the positions of some ground points according to the known locations of APs and obtain the reference distances between them and the APs. Then, the differences of squares of reference distances are used to generate the ranging difference fingerprint based on the reference distance, which is also known as the offline ranging difference fingerprint. GPR utilizes the ranging difference fingerprints based on the reference distance to build the positioning model, and its hyperparameters are solved with the PSO algorithm. In the location estimation stage, the actual measured distances between the receiver and APs are gathered and employed to produce the online ranging difference fingerprint, which is named the ranging difference fingerprint based on range measurement. The ranging difference fingerprint based on range measurement will be the input of the positioning model, and the output of the model will be the positioning result. The core of the proposed method is to utilize the GPR and ranging difference fingerprint to construct a robust positioning model that can adapt to harsh environments.

II. WiFi RTT AND RANGING DIFFERENCE FINGERPRINT A. WiFi RTT
Given the large market needs of indoor localization, the WiFi alliance published an amendment that introduced the FTM protocol on the IEEE 802.11 WiFi standard in 2016 and aimed to achieve one-meter indoor positioning accuracy. However, positioning based on WiFi FTM could not be achieved on smartphones until the appearance of WiFi RTT. The WiFi RTT was launched by Google in 2018 [30] and was built on the basis of the FTM framework. Moreover, Google provided all positioning devices for WiFi RTT, such as smartphones, application programming interfaces (APIs) [31], and operating systems (OS). With the WiFi RTT API in the Android Pie OS and the smartphones supporting WiFi RTT, a positioning system using WiFi RTT based on smartphones could be developed. The FTM protocol defined a WiFi-based two-way ranging approach that needed mutual interaction between a receiver and transmitter, like ping-pong. One important characteristic of the FTM framework is to record the arrival and received times of the round-trip signal, which avoids the time synchronization requirements between the receiver and transmitter. In this FTM protocol shown in FIGURE 1, initially, the smartphone requires sending an FTM request to an AP. Then, the smartphone and AP began to transport the FTM message and record the transmission timestamp of the message and reception timestamp of its acknowledgment (Ack) packet. Finally, based on these timestamps, the round-trip time (RTT) of the message can be calculated and employed to estimate the distance between the smartphone and AP.
One RTT measurement consists of two time-of-arrival (ToA) values and two time-of-departure (ToD) values. Based on four timing measurements, the time of flight (ToF) of the signal from the AP to the smartphone can be calculated, as shown in Equation (1).
where ToF denotes the flight time of the signal, and t ToA i and t ToD i represent the ith ToA measurement and ith ToD measurement, respectively. The flight time and speed of the signal are used to compute the distance between the receiver and AP.

B. RANGING DIFFERENCE FINGERPRINT
In this paper, we raised the concept of a ranging difference fingerprint that was the center of the positioning method. The ranging difference fingerprint is defined as the differences of squares of the range measurements. FIGURE 2 shows the principle of generating the ranging difference fingerprint. In Figure 2, (X i ,Y i , H i ) and (x, y, h) represent the position of the ith AP and smartphone, respectively. Point P (x, y, h) is the foot point at which a vertical line from the smartphone center intersects the ground, d i represents the measuring distance from the smartphone to the ith AP [which is equal to the real distance between the smartphone and AP i in theory, as shown in Equation (2)], and D i is the distance between AP i and point P (x, y,h), as shown in Equation (3).
Suppose that the mounting heights of the APs are the same or approximate; there is a rule, as shown in Equation (4). The difference between the squares of two range measurements is the same as the difference of squares of distances between the AP and two corresponding ground points. Therefore, we can use this rule to acquire the position, and utilize the ranging difference fingerprint to realize positioning.

III. PROPOSED METHOD A. OVERVIEW OF THE PROPOSED METHOD
The proposed method contains two stages: model construction, and location estimation, as shown in FIGURE 3. In this section, we introduce the process of model construction and location estimation. In the model construction stage, the main purpose is to obtain the training data and use them to establish a positioning model. The training data consist of known positions and ranging difference fingerprints.
The reference distances between ground points and APs can be obtained when the position coordinates of ground points are known. The differences of squares of reference distances are used to generate the offline ranging difference fingerprint, which is regarded as the input data of model training. Moreover, the known positions of ground points are the output data of the model. The acquisition method of training data will be described in detail in the next subsection.
In this paper, the potential mapping relationship between the ranging difference fingerprint and position is established with the GPR algorithm. The GPR hyperparameters need to be obtained for model construction. The acquisition of GPR hyperparameters has certain difficulties due to the large amount of training data. Thus, the PSO algorithm is selected to solve the hyperparameters. With the training data, a positioning model based on GPR can be built.
In the location estimation stage, the range measurements between the receiver and APs are used to generate the online ranging difference fingerprint based on the range measurement. The online ranging difference fingerprint based on range measurement is the input data of the positioning model. The output of the model is believed to be the position of the receiver. The advantages of this method are that it can adapt to harsh environments and reduce the adverse impact of unreliable range measurement on positioning accuracy.

B. ACQUISITION OF TRAINING DATA
The top priority of building the positioning model is the acquisition of training data, which is the construction of an offline ranging difference fingerprint database. In this paper, we do not need to collect the training data and only require the known positions of APs to generate the coordinates of some ground points. Then, the real distance between the ground point and AP can be calculated. This is utilized to generate the training data. FIGURE 4 shows the obtained method of the coordinates of ground points. With fixed spacing, the However, the clock-based timestamp acquisition cannot be completely correct [32], which means that the range measurement may have errors. In addition, multipath and non-line of sight (NLOS) can also cause ranging errors. There must be errors in the range measurement based on WiFi RTT. It is thus better to add a ranging error to the real distance when constructing the offline ranging difference fingerprint database. In this paper, the real distances to which the errors are added are called the reference distances, and the differences of squares of reference distances are named the ranging difference fingerprint, which is the training data of the positioning model. Guo et al. [29] proposed that the ranging error of WiFi RTT should follow a Gaussian distribution; therefore, we should add a Gaussian random error that obeys the Gaussian distribution N ∼ (µ, σ 2 ) to the real distance, as shown in Equation (5).
where µ and σ are the mean and standard deviation of the Gaussian distribution, D ij presents the real distance between the ith ground point and jth AP, and D ij is the reference distance.
In this paper, we collected the range measurements on some known points and calculated the ranging errors according to the real distances. Suppose that the ranging error follows a Gaussian distribution, and the mean and variance of the ranging errors are the mean and variance of the Gaussian distribution. The real distances plus the Gaussian random errors are the reference distances, which are utilized to compute the differences of their squares, i.e., the offline ranging difference fingerprint based on the reference distance and the actual range measurement can produce an online ranging difference fingerprint based on the range measurement, as illustrated in FIGURE 5.
The offline fingerprints on many points constitute the ranging difference fingerprint database, as shown in TABLE 1. where D ij represents the reference distance between the ith ground point and jth AP, n is the number of APs,and m is the number of ground points.  The training data for model training are also illustrated in TABLE 1. The location is the output of model training, and the ranging difference fingerprint based on the reference distance is the input of model training. An important superiority of the proposed method is that there is no need to gather the training data, which saves considerable time for data collection. The coordinates of ground points can be inferred based on the known positions of the APs, and the acquisition of coordinates is very simple. Therefore, the acquisition approach of training data in this paper is very simple and efficient compared with the previous acquisition method.

C. GAUSSIAN PROCESS REGRESSION
In this paper, we utilize GPR to construct a positioning model with a ranging difference fingerprint based on reference distances and that does not need to spend time collecting training data. The ranging difference fingerprints based on reference distances are the input data of positioning model training, which can be expressed as The output data of the model should be the position that corresponds to the ranging difference fingerprint based on the reference distance, which can be expressed as Suppose there is a mapping between the input and output data, as follows: where γ is the Gaussian noise with zero mean and variance σ 2 ,i.e., γ ∼ N(0,σ 2 ); N represents the number of training data; and g (·) represents the relationship between the input and output data. We thought that the error distribution of horizontal coordinates was the same as that of vertical coordinates in this paper. Equation (8) was seen as an implicit function that has no clear relationship, and the main purpose of positioning model training is to find the potential relation between input and output data. To our knowledge, GPR can solve the potential mapping relation of the input and output data. The Gaussian process is a set of random variables that obey a joint Gaussian distribution, which can be represented by a mean function and a covariance function, as shown in Equation (9): K(Z, Z)) (9) where g(Z) represents the Gaussian process, m (Z) is the mean function that can be seen as zero without loss of generality, and K(Z, Z) is the covariance matrix.
Here, E(·) indicates the expectation operator, and k(z i , z j ) denotes the covariance function.
[σ , δ f , l] are the hyperparameters to be solved, δ f represents the standard deviation of the input data, l is the length-scale parameter, and z i denotes the ranging difference fingerprint based on the reference distance. Equation (13) is the Gaussian kernel function and employs Euclidean distance, denoted as z i − z j , to calculate the covariance k z i , z j .
The prediction position f * and training positions F jointly follow a multivariate Gaussian distribution as follows: where Z * and Z are the test data and training data, respectively. The posterior distribution p(f * |F) can be expressed with Equations (15), (16), and (17).
In the positioning estimation stage, the actual range measurements are used to produce the online ranging difference fingerprint based on the range measurement, which is regarded as the input data of the positioning model. The output of the model is the estimated position.

D. PARTICLE SWARM OPTIMIZATION
The particle swarm optimization (PSO) algorithm was first developed in 1995 by Kennedy and Eberhart and provided a new solution to the optimization problem [33]. The PSO algorithm thinks that the process of solving unknown problems is similar to the predation course of birds, abstracts a bird as a particle, and sees a flock of birds as a particle swarm. The purpose of predation is to find a place where VOLUME 8, 2020 there is enough food to feed the bird population. Therefore, the search for the optimal solution is equivalent to looking for a location of sufficient food, and predation can be seen as a course-solving objective function. The solution process to the unknown problem is to find a particle that makes the objective function solved or approximately solved. Each particle in a particle swarm is a potential solution to the unsolved problem.
At the beginning of the PSO algorithm, we need to initialize the position of the PSO particles in the search space and then confirm the personal best position of the particle and global best position in the entire swarm [34]. With continuous iteration, the personal best position and global best position are updated until they remain unchanged or the number of iterations reaches the maximum. In each iteration, the velocities of the particles are updated to change the positions of the particles, and the adjustment of velocity and position should follow the systematic rules of the PSO algorithm. The governing equations for PSO can be given by Equations (18) and (19): (19) where w is the inertia weight, t represents the number of iterations, l i represents the ith particle (which is the potential solution of the GPR hyperparameters), l t ij is the jth element of the ith particle, v t ij represents the speed of the element l t ij , p t ij is the personal best position of the particle, and g t ij is the global best position in the entire swarm. c 1 and c 2 are the learning rates, and r t 1 and r t 2 represent random numbers between 0 and 1. In this paper, the values of learning rates c 1 and c 2 were both 1, w was 0.8, and the number of particles was 100.
The fitness function of the optimization problem can be expressed as (20) Here, fun represents the fitness function, Trace is the trace of the matrix, g (Z) represents the output of the model, and F presents the expected output of the model. The smaller the value of the fitness function, the better the hyperparameters obtained. In other words, the aim of solving hyperparameters can be transformed to minimize the fitness function. The particle that minimizes the fitness function should be the optimal solution of hyperparameters, which is the global best position. The solved hyperparameters were [0.009, 1.2385, 1.2376] in this paper.

IV. EXPERIMENTAL ANALYSIS A. TEST ENVIRONMENT AND TOOL
The experimental environment was a building surrounded by glass walls and was almost 254.28 square meters, as shown in FIGURE 6. Its length and width were 16.3 meters and 15.6 meters, respectively. There were eight RTT APs with a layout height of 4 meters in the experimental area. The RTT device carries the intel dual-band Wireless-AC8260, which supports the realization of WiFi ranging. The distribution of ground points can also be seen in this figure, and the interval of two adjacent ground points was 0.5 meters. There were also 52 traditional WiFi APs that do not support RTT and 60 Bluetooth APs in the experimental area. Thus, the signals from Bluetooth and traditional AP may interfere with the RTT signal, and the reflection and refraction of the RTT signal are very intense due to the glass. The test environment should be a dense multipath area with many interference signals. The Google Pixel 3 smartphone was chosen as the receiver and was utilized to collect the range measurements on the reference points. The ranging frequency was 1 Hz, and there were eight range measurements for each position. To acquire a better result, it is best for each position to obtain eight range measurements since the fingerprint database is constructed based on the reference distances between eight APs and ground points. Otherwise, the accuracy may be slightly lower. There were a total of 248 sets of range measurements collected. Meanwhile, to analyze the dynamic positioning effect, the experimenter walked along the designed track and gathered the range measurement in dynamic conditions, and the obtained data were utilized to analyze the effects of dynamic positioning.

B. PRECISION ANALYSIS OF RANGE
To rate the ranging precision, the range measurements between eight RTT APs and a smartphone at known points were gathered and their errors were analyzed, as shown in FIGURE 7. The results showed that the accuracy of the range measurements was very poor, and there were many large ranging errors. For example, ranging errors of greater than 10 meters could be found among measured distances between the smartphone and AP2. Even errors of almost 25 meters can be seen in the figure.
The minimums, maximums, average values (AEs), and standard deviations (SDs) of the ranging errors of eight APs  Only the AE of ranging errors of AP6 was less than one meter, and the difference between it and one meter was small at 0.192 meters. Moreover, the AEs and SDs of the ranging errors of the five APs were greater than 1.9 and 1.7 meters, respectively. There were three APs with an AE greater than 2.7 meters and an SD larger than 2.1 meters. More strikingly, the AE and SD of the ranging errors of AP4 were 4.802 and 4.135 meters, respectively. In addition, the maximum errors of all APs were larger than 3.6 meters, and errors greater than 12 meters could be found from this table. Therefore, we conclude that the experimental environment was terrible and that most range measurements based on WiFi RTT had very poor accuracy. In such an indoor environment, the previous algorithms (LS, WLS, and trilateration) cannot achieve high-precision positioning.

C. INTERVAL OF ADJACENT GROUND POINTS AND NUMBER OF APs
In this section, we first studied the impact of the interval of two adjacent ground points on the positioning accuracy. The different intervals between two adjacent ground points were employed to build an offline ranging difference fingerprint database, which was applied to the positioning test. The positioning algorithm chose the NN algorithm, and the MEs and standard deviations (SDs) of positioning errors under different spacings are shown in FIGURE 8. We can see that the ME and SD were both smallest when the interval was 0.5 meters. Thus, it is not guaranteed that the smaller the spacing, the better the positioning effect. With an interval of 0.5 meters, the NN algorithm had an ME of 2.096 meters and SD of 1.112 meters. The interval of ground points was 0.5 meters in this paper.  To study the impact of the number of APs on the positioning accuracy, we applied different numbers of APs to achieve positioning. FIGURE 9 shows the experimental results, which were the MEs and root-mean-square errors (RMSEs) under 4, 6, and 8 APs. When the number of APs was 4, 6, and 8, the MEs were 3.675, 2.325, and 2.096 meters, respectively, and the RMSEs were 4.309, 2.642, and 2.372 meters, respectively. We can see that the positioning effect was best when the number of APs was 8.

D. POSITIONING EXPERIMENTS
In this section, an experiment was conducted to test the performance of the GPR algorithm. The experimental results VOLUME 8, 2020 We can see that the GPR algorithm had a better positioning effect than the LS and NN algorithms. The maximum error of the LS algorithm was 22.223 meters, and those of the NN and GPR algorithms were 6.455 and 3.96 meters, respectively. The LS algorithm had more large errors. We could see many points where the errors of NN and GPR algorithms were much fewer than those of the LS algorithm, such as at points 129, 174, and 240. Thus, the positioning effects of the NN and GPR algorithms were more stable and better than those of the LS algorithm.
When the LS algorithm was employed, the reason for the large positioning error was the large ranging errors. In other words, range measurement with a large error must cause a large positioning error when the LS algorithm is the positioning algorithm. However, when the ranging difference fingerprint was applied, the position estimation mainly relied on the ranging differences. This indicated that there was a good positioning result when most range measurements were correct even if there was a large-ranging error. However, the positioning result of the LS algorithm was poor as long as there was a large-ranging error. Thus, the NN and GPR algorithms had strong robustness and can adapt to harsh environments compared with the LS algorithm. FIGURE 11 shows the cumulative distribution functions (CDFs) of the positioning errors of the LS, NN, and GPR algorithms. The positioning errors of the NN and LS algorithms were greater than that of the GPR algorithm for any cumulative probability. The positioning errors of the NN algorithm corresponding to all cumulative error probabilities were greater than those of the GPR algorithm. The positioning errors of LS, NN, and GPR were 6.275, 3.549, and 1.862 meters, respectively, when the cumulative probability was 90%. The probabilities of the LS, NN, and GPR algorithms with positioning errors of less than one meter were 6.45%, 19.76%, and 51.21%, respectively, which indicated that the positioning effect of the GPR algorithm was better than those of the LS and NN algorithms.
The positioning effects of the LS, NN, and GPR algorithms are described in FIGURE 12. The positioning effect of the GPR algorithm was the best among the three positioning algorithms. The outliers of the LS algorithm were greater than those of NN and GPR. The mid-values of positioning error of the LS and NN algorithms were 2.037 and 2.474 meters, respectively, and the median of positioning errors of GPR was 0.98 meters, which was lower than those of NN and LS algorithms. The maximum error of the LS algorithm was far greater than that of the GPR algorithm, and that of the NN algorithm was also larger than that of the GPR algorithm. The positioning stability of GPR was better than those of the NN and LS algorithms. The ME and RMSE of the GPR algorithm were 1.097 and 1.292 meters, respectively. Compared with the LS and NN algorithms, the ME of GPR improved by 2.387 and 0.999 meters, respectively, and the RMSE of GPR improved by 3.191 and 1.08 meters, respectively. In addition, the positioning errors of GPR were lower than those of the LS and NN algorithms when the cumulative probabilities were 50%, 70%, and 90%. This indicated that the GPR algorithm was better than the NN and LS algorithms, and its ability to adapt to harsh environments was better than that of the NN algorithm. We thus thought that the GPR algorithm was superior to the NN and LS algorithms.  shows the two dynamic positioning results of the three algorithms. The positioning effect of GPR was better than those of the NN and LS algorithms and was closer to the true path. The number of large positioning errors of the LS algorithm was greater than those of the NN and GPR algorithms, and strong jump phenomena were often seen in the positioning results based on the LS algorithm. In addition, the LS algorithm had more abnormal positioning results with large errors than the NN and GPR algorithms due to the harsh experimental environment. The unusual values of the LS algorithm were larger than those of the NN and GPR algorithms, and the unusual values of the GPR algorithm were smaller than those of the NN algorithm. This indicated that the NN and GPR algorithms could resist the influence of harsh environments on positioning accuracy and stability, and the robustness of the GPR algorithm was stronger than that of the NN algorithm.
The proposed method, indoor localization based on GPR for harsh environments, has obvious advantages compared with the NN and LS algorithms. Its ability to defend a harsh environment is better than that of the NN and LS algorithms, which have better positioning accuracy and stability. In addition, unlike most fingerprinting approaches, the construction of its ranging difference fingerprint database does not need to gather data, which saves considerable time in data collection. However, GPR also has certain shortcomings. With the expansion of the positioning area, more training data are needed, which increases the computational cost and time of model training.

V. CONCLUSION
This paper proposed an indoor positioning method based on GPR in harsh environments for WiFi RTT. This method has a good ability to resist harsh environments. The proposed method builds a positioning model without collecting training data, uses the ranging difference fingerprint to obtain the positioning result, and achieves a better positioning effect than the NN and LS algorithms in harsh environments. However, the proposed method has two disadvantages: the heights of APs must be the same or approximate, and the positioning results are two-dimensional. In the future, acquisition of the height of the positioning terminal will be the research goal.