A Robust Dead Reckoning Algorithm Based on Wi-Fi FTM and Multiple Sensors

: More and more applications of location-based services lead to the development of indoor positioning technology. Wi-Fi-based indoor localization has been attractive due to its extensive distribution and low cost properties. IEEE 802.11-2016 now includes a Wi-Fi Fine Time Measurement (FTM) protocol which provides a more robust approach for Wi-Fi ranging between the mobile terminal and Wi-Fi access point (AP). To improve the positioning accuracy, in this paper, we propose a robust dead reckoning algorithm combining the results of Wi-Fi FTM and multiple sensors (DRWMs). A real-time Wi-Fi ranging model is built which can effectively reduce the Wi-Fi ranging errors, and then a multisensor multi-pattern-based dead reckoning is presented. In addition, the Unscented Kalman ﬁlter (UKF) is applied to fuse the results of Wi-Fi ranging model and multiple sensors. The experiment results show that the proposed DRWMs algorithm can achieve accurate localization performance in line-of-sight/non-line-of-sight (LOS)/(NLOS) mixed indoor environment. Compared with the traditional Wi-Fi positioning method and the traditional dead reckoning method, the proposed algorithm is more stable and has better real-time performance for indoor positioning.

Wi-Fi-based indoor localization has been more attractive compared with other signals due to its extensive application and low cost properties.Multiple characteristics estimated from Wi-Fi signals can be used for indoor localization such as received signal strength indication (RSSI) [6], channel impulse response (CIR) [7], time of arrival (TOA) [8], angle of arrival (AOA) [9], and channel state information (CSI) [10].Other Wi-Fi-based localization techniques such as multi-source fusion [11] and fingerprinting [12] can also be used in complex indoor scenarios.In 2016, IEEE 802.11 standardized the Fine Time Measurement (FTM) protocol which can provide meter-lever localization accuracy according to the Wi-Fi alliance [13].Ibrahim M and his partners analyzed the key factors and parameters which affect the Wi-Fi ranging performance based on the open platform and revisited standard error correction techniques for a Wi-Fi FTM-based localization system [14].
However, when giving a complex indoor scenario where the direct transmission path between the transceivers is blocked, the distance errors measured by Wi-Fi FTM cannot be easily eliminated due to the lack of a line-of-sight (LOS) path [15].To make it worse, the measurement errors are in The rest of this paper is organized as follows.Section 2 introduces the theoretical framework about the principle of Wi-Fi FTM-based indoor localization method and designs a multi-pattern-based dead reckoning algorithm using multiple sensors.Section 3 builds a real-time Wi-Fi ranging model which can effectively reduce the error of clock deviation, NLOS, and multipath propagation.Section 4 presents the DRWMs algorithm using Unscented Kalman filter (UKF) to fuse the results of the Wi-Fi ranging model and multiple sensors.Section 5 describes the experimental results of the proposed algorithm.Section 6 will conclude this paper and point out the future work.

Theoretical Framework
Traditional Wi-Fi-based positioning methods usually use RSSI to calculate the distance between the mobile terminal and Wi-Fi AP or use the fingerprint method to get the location of a pedestrian.Compared with the Wi-Fi FTM, the RSSI fingerprinting-based Wi-Fi positioning method is much more dependent on the environment because of the multipath propagation.RSSI is also highly interference dependent, hardware dependent, and sensitive to environmental factors such as temperature [24][25][26].In addition, the RSSI-based Wi-Fi positioning method has relatively poor real-time performance; it may take one or more seconds to get a new location by scanning nearby AP in all bands.Wi-Fi FTM uses real time measurement based on clocks, by which we can get a much higher update rate of 3Hz or more and a fine measurement result with pico-seconds-based fine-grained time recognition.The traditional dead reckoning method provides the relative position of the pedestrian by calculating the real-time heading difference and step length.It can only be used in case of walking forward; errors are cumulated when other walking patterns occur, because the heading difference remains the same as the forward walking pattern.In this section, a more robust Wi-Fi-based positioning method and multi-pattern-based dead reckoning method are proposed.

Positioning Method Based on Wi-Fi FTM
Wi-Fi FTM protocol enables distance ranging between the mobile terminal and Wi-Fi access point (AP).The whole procedure is described as follows.First, the mobile terminal sends an FTM request to the Wi-Fi AP.Then, the Wi-Fi AP receives the request and returns an ACK signal to the mobile terminal.After that, several FTM feedbacks are sent from the Wi-Fi AP to the mobile terminal, and, then, the mean round-trip time (RTT) can be calculated.This process can also be performed between several mobile terminals and Wi-Fi APs at the same time.Figure 1 shows the whole procedure in which the parameter names 'FTMs per Burst' can be changed to improve the FTM accuracy by multiple measurements.The mean RTT information within one period is calculated by Equation (1): where t 1 (k) is the timestamp when the FTM framework first sent by Wi-Fi AP, t 2 (k) is the timestamp when the FTM signal arrives to the mobile terminal, t 3 (k)is the timestamp when the mobile terminal returns the ACK signal to Wi-Fi AP, t 4 (k) is the timestamp when the ACK signal is finally received by the Wi-Fi AP, and the parameter n is the number of FTMs per burst among one ranging period.Generally, the protocol excludes the processing time on the mobile terminal by subtracting (t 3 (k)t 2 (k)) from the total round-trip time (t 4 (k) -t 1 (k)), which represents the time from the instant the FTM message is being sent (t 1 (k)) to the instant the ACK is being received (t 4 (k)).This calculation is repeated for each FTM-ACK exchange, and the final RTT is the average over the number of FTMs per burst.
In this paper, the parameter FTMs per burst n is set as 30 to minimize the measurement noise, so it will take more time to complete this procedure compared to a smaller FTMs per burst [14].The sampling rate of the RTT depends on the hardware performance of the processor and bandwidth of Wi-Fi, and the frequency of the processor should satisfy pico-seconds fine-grained requirements according to [13].
Remote Sens. 2019, 11, x FOR PEER REVIEW 3 of 22 accuracy by multiple measurements.The mean RTT information within one period is calculated by Equation ( 1): [ ] [ ] ( ) where t1(k) is the timestamp when the FTM framework first sent by Wi-Fi AP, t2(k) is the timestamp when the FTM signal arrives to the mobile terminal, t3(k)is the timestamp when the mobile terminal returns the ACK signal to Wi-Fi AP, t4(k) is the timestamp when the ACK signal is finally received by the Wi-Fi AP, and the parameter n is the number of FTMs per burst among one ranging period.Generally, the protocol excludes the processing time on the mobile terminal by subtracting (t3(k) -t2(k)) from the total round-trip time (t4(k) -t1(k)), which represents the time from the instant the FTM message is being sent (t1(k)) to the instant the ACK is being received (t4(k)).This calculation is repeated for each FTM-ACK exchange, and the final RTT is the average over the number of FTMs per burst.In this paper, the parameter FTMs per burst n is set as 30 to minimize the measurement noise, so it will take more time to complete this procedure compared to a smaller FTMs per burst [14].The sampling rate of the RTT depends on the hardware performance of the processor and bandwidth of Wi-Fi, and the frequency of the processor should satisfy pico-seconds fine-grained requirements according to [13].
The distance between mobile terminal and Wi-Fi AP can be calculated by Equation ( 2): where C is the speed of light and DRTT is the final distance calculated by one FTM period.The least squares (LS) algorithm [27] can be used for real-time localization after receiving distance information from three or more APs:

Mobile terminal
where xp is the localization result, j is the number of APs, xj and yj are the position of Wi-Fi AP, and DRTT(j) is real-time RTT data received from each Wi-Fi AP.It should be noted that the number of APs The distance between mobile terminal and Wi-Fi AP can be calculated by Equation (2): where C is the speed of light and D RTT is the final distance calculated by one FTM period.The least squares (LS) algorithm [27] can be used for real-time localization after receiving distance information from three or more APs: where x p is the localization result, j is the number of APs, x j and y j are the position of Wi-Fi AP, and D RTT (j) is real-time RTT data received from each Wi-Fi AP.It should be noted that the number of APs needed to solve the above equation is at least one more than the dimension of the x p .In theory, we can get more accurate positioning results by increasing the number of APs [28].

Multi-Pattern-Based Dead Reckoning via Multiple Sensors
Mobile phones are generally equipped with multiple MEMS (Micro-Electro-Mechanical System) sensors such as an accelerometer, a magnetometer, and a gyroscope.When pedestrians carrying mobile terminals, these sensors can reflect the movement.Therefore, the sensor data can be used for indoor localization.The walking patterns of pedestrians can significantly affect the accuracy of positioning results which should be detected.The multi-pattern-based PDR algorithm proposed in this paper mainly contains the following two steps: (1) Multi-pattern-based step detection and step-length estimation; (2) location updates.

Multi-Pattern-Based Step Detection and Step-Length Estimation
The basic principle of step number measurement is that the vertical value of acceleration data is periodically changing when walking.The number of steps can be used to update the position combining step-length and heading difference.The original data from the accelerometer contains noise which should be smoothed.A moving average filter can be used to reduce the noise, and the obvious step character can be extracted after filtering [21].
Different patterns may exist between walking procedures such as walking forward, walking backward, and lateral walking, which may cause coordinate updating error without detection.In case of walking forward, steps can be detected by a peak and valley detection algorithm [29].However, this step detection algorithm should be modified in the case of other walking patterns.In this part, a multi-pattern-based step detection algorithm is proposed to realize real-time step detection and step-length calculation based on different walking patterns.
In the step detection process with higher real-time requirements, time-domain features of acceleration can be used to identify the walking pattern.The handheld posture of mobile phone is shown in Figure 2, which is cited in [30].needed to solve the above equation is at least one more than the dimension of the xp.In theory, we can get more accurate positioning results by increasing the number of APs [28].

Multi-Pattern-Based Dead Reckoning via Multiple Sensors
Mobile phones are generally equipped with multiple MEMS (Micro-Electro-Mechanical System) sensors such as an accelerometer, a magnetometer, and a gyroscope.When pedestrians carrying mobile terminals, these sensors can reflect the movement.Therefore, the sensor data can be used for indoor localization.The walking patterns of pedestrians can significantly affect the accuracy of positioning results which should be detected.The multi-pattern-based PDR algorithm proposed in this paper mainly contains the following two steps: 1) Multi-pattern-based step detection and steplength estimation; 2) location updates.

Multi-Pattern-Based Step Detection and Step-Length Estimation
The basic principle of step number measurement is that the vertical value of acceleration data is periodically changing when walking.The number of steps can be used to update the position combining step-length and heading difference.The original data from the accelerometer contains noise which should be smoothed.A moving average filter can be used to reduce the noise, and the obvious step character can be extracted after filtering [21].
Different patterns may exist between walking procedures such as walking forward, walking backward, and lateral walking, which may cause coordinate updating error without detection.In case of walking forward, steps can be detected by a peak and valley detection algorithm [29].However, this step detection algorithm should be modified in the case of other walking patterns.In this part, a multi-pattern-based step detection algorithm is proposed to realize real-time step detection and step-length calculation based on different walking patterns.In the step detection process with higher real-time requirements, time-domain features of acceleration can be used to identify the walking pattern.The handheld posture of mobile phone is shown in Figure 2, which is cited in [30].
Acceleration shows periodic waveform characteristics when a pedestrian walks.In the case of walking forward and walking backward, the Y-axis is seen as the walking axis, and the slope of data from the Y-axis is extracted to identify the walking pattern by combining peak and valley detection of the Z-axis.The slope of the acceleration data from Y-axis defined in Equation (4).
= ( 1)-( ) where m1 is the timestamp when the peak or valley of Z-axis value is detected during one step period and Ay is the acceleration data from Y-axis.
Figure 3 shows the comparison of walking forward and backward; the tester walked forward for 8 m and then walked backward to original point.The sample rate of accelerometer is 50 Hz, and the raw data is filtered by moving average filter with a width of 10. Figure 4 is the same.The red dots show the peaks or valleys of the Z-axis data as corresponding to the red stars, which represent the Y- Acceleration shows periodic waveform characteristics when a pedestrian walks.In the case of walking forward and walking backward, the Y-axis is seen as the walking axis, and the slope of data from the Y-axis is extracted to identify the walking pattern by combining peak and valley detection of the Z-axis.The slope of the acceleration data from Y-axis defined in Equation (4).
where m 1 is the timestamp when the peak or valley of Z-axis value is detected during one step period and A y is the acceleration data from Y-axis. Figure 3 shows the comparison of walking forward and backward; the tester walked forward for 8 m and then walked backward to original point.The sample rate of accelerometer is 50 Hz, and the raw data is filtered by moving average filter with a width of 10. Figure 4 is the same.The red dots show the peaks or valleys of the Z-axis data as corresponding to the red stars, which represent the Y-axis data at the moment m 1 .When the conditions K 1 > 0 and K 2 > 0 are met, in the case of walking forward, m 1 is the timestamp when the peak of Z-axis value is detected.In case of walking backward, m 1 is the timestamp when the valley of the Z-axis value is detected.
In case of left lateral walking and right lateral walking, the X-axis is seen as the walking axis.The data slope of the X-axis is extracted to identify the walking pattern by combining the peak and valley detections of the Z-axis.The slope of acceleration data from X-axis defined in Equation (5).
where m 2 is the timestamp when the peak of Z-axis value is detected during one step period and A x is the acceleration data from X-axis. Figure 4 shows the comparison of left lateral walking and right lateral walking.The tester walked left laterally for 6 m and then walked right laterally to the original point.The red dots show the peaks or valleys of the Z-axis data, as corresponding to the red stars, which represent the X-axis data at the moment m 2 .When the conditions K 3 < 0 and K 4 < 0 are met, in case of left lateral walking, m 2 is the timestamp when the peak of the Z-axis value is detected.When the conditions K 3 > 0 and K 4 > 0 are conformed, in case of right lateral walking, m 2 is the timestamp when the peak of the Z-axis value is detected.Only a texting pattern is considered in this work; as shown in Figure 2, subtle tilt does not affect the recognition results because the Equations ( 4) and ( 5) calculate the changing trend of the acceleration data.
Remote Sens. 2019, 11, x FOR PEER REVIEW 5 of 22 axis data at the moment m1.When the conditions K1 > 0 and K2 > 0 are met, in the case of walking forward, m1 is the timestamp when the peak of Z-axis value is detected.In case of walking backward, m1 is the timestamp when the valley of the Z-axis value is detected.
In case of left lateral walking and right lateral walking, the X-axis is seen as the walking axis.The data slope of the X-axis is extracted to identify the walking pattern by combining the peak and valley detections of the Z-axis.The slope of acceleration data from X-axis defined in Equation (5).= ( )-( = ( 1)-( ) where m2 is the timestamp when the peak of Z-axis value is detected during one step period and Ax is the acceleration data from X-axis. Figure 4 shows the comparison of left lateral walking and right lateral walking.The tester walked left laterally for 6 m and then walked right laterally to the original point.The red dots show the peaks or valleys of the Z-axis data, as corresponding to the red stars, which represent the X-axis data at the moment m2.When the conditions K3 < 0 and K4 < 0 are met, in case of left lateral walking, m2 is the timestamp when the peak of the Z-axis value is detected.When the conditions K3 > 0 and K4 > 0 are conformed, in case of right lateral walking, m2 is the timestamp when the peak of the Z-axis value is detected.Only a texting pattern is considered in this work; as shown in Figure 2, subtle tilt does not affect the recognition results because the Equations ( 4) and ( 5) calculate the changing trend of the acceleration data.After the multi-pattern-based step detection is completed, the Weinberg model is used to calculate the real-time step length [31], described as follows: axis data at the moment m1.When the conditions K1 > 0 and K2 > 0 are met, in the case of walking forward, m1 is the timestamp when the peak of Z-axis value is detected.In case of walking backward, m1 is the timestamp when the valley of the Z-axis value is detected.
In case of left lateral walking and right lateral walking, the X-axis is seen as the walking axis.The data slope of the X-axis is extracted to identify the walking pattern by combining the peak and valley detections of the Z-axis.The slope of acceleration data from X-axis defined in Equation (5).= ( )-( = ( 1)-( ) where m2 is the timestamp when the peak of Z-axis value is detected during one step period and Ax is the acceleration data from X-axis. Figure 4 shows the comparison of left lateral walking and right lateral walking.The tester walked left laterally for 6 m and then walked right laterally to the original point.The red dots show the peaks or valleys of the Z-axis data, as corresponding to the red stars, which represent the X-axis data at the moment m2.When the conditions K3 < 0 and K4 < 0 are met, in case of left lateral walking, m2 is the timestamp when the peak of the Z-axis value is detected.When the conditions K3 > 0 and K4 > 0 are conformed, in case of right lateral walking, m2 is the timestamp when the peak of the Z-axis value is detected.Only a texting pattern is considered in this work; as shown in Figure 2, subtle tilt does not affect the recognition results because the Equations ( 4) and ( 5) calculate the changing trend of the acceleration data.After the multi-pattern-based step detection is completed, the Weinberg model is used to calculate the real-time step length [31], described as follows: After the multi-pattern-based step detection is completed, the Weinberg model is used to calculate the real-time step length [31], described as follows: where A max and A min are the maximum and minimum values of the Z-axis acceleration during one step period and K is the ratio of the real and the estimated distance:

Location Update
A traditional dead reckoning algorithm is used to calculate the real-time position coordinates of a pedestrian in the case of walking forward.In the cases of walking backward, left lateral walking, and right lateral walking-since the pedestrian's heading angle remains unchanged-the positioning trajectory will continue updating forward while the true trajectory should be updated in the opposite or perpendicular direction to avoid causing the accumulation of positioning errors.By using the multi-pattern step detection algorithm, different walking patterns are detected, and the corresponding step length is calculated.Using a location updating algorithm based on multiple walking patterns can effectively reduce the cumulative error of dead reckoning.
For the backward walking pattern, as shown in Figure 5, the pedestrian starts from the original location, continuously walks to point A and point B, and then walks backwards from point B to point A. The final position coordinates of the pedestrian measured by the traditional dead reckoning (DR) algorithm is the D point, which is opposite to the actual walking trajectory of the pedestrian.In case of either a left lateral walking pattern or right lateral walking pattern, the pedestrian walks from point A to point B and then walks laterally to point C 1 and C 2 .When using the traditional DR algorithm, the walking trajectory still shows from point B to point D, perpendicular to the actual trajectory of the pedestrian.
Remote Sens. 2019, 11, x FOR PEER REVIEW 6 of 22 where Amax and Amin are the maximum and minimum values of the Z-axis acceleration during one step period and K is the ratio of the real and the estimated distance:

Location Update
A traditional dead reckoning algorithm is used to calculate the real-time position coordinates of a pedestrian in the case of walking forward.In the cases of walking backward, left lateral walking, and right lateral walking-since the pedestrian's heading angle remains unchanged-the positioning trajectory will continue updating forward while the true trajectory should be updated in the opposite or perpendicular direction to avoid causing the accumulation of positioning errors.By using the multi-pattern step detection algorithm, different walking patterns are detected, and the corresponding step length is calculated.Using a location updating algorithm based on multiple walking patterns can effectively reduce the cumulative error of dead reckoning.
For the backward walking pattern, as shown in Figure 5, the pedestrian starts from the original location, continuously walks to point A and point B, and then walks backwards from point B to point A. The final position coordinates of the pedestrian measured by the traditional dead reckoning (DR) algorithm is the D point, which is opposite to the actual walking trajectory of the pedestrian.In case of either a left lateral walking pattern or right lateral walking pattern, the pedestrian walks from point A to point B and then walks laterally to point C1 and C2.When using the traditional DR algorithm, the walking trajectory still shows from point B to point D, perpendicular to the actual trajectory of the pedestrian.For the above four walking patterns, the multi-pattern-based location updating equation is described as follows: where Lk is the step-length and θk is the difference of heading angle compared with initial heading which is provided by the calibrated magnetometer [32].The real-time heading is calculated by an EKF filter which combines the outputs of the gyroscope and magnetometer [30].A threshold Δh is used to eliminate the heading jitter when walking and keep the heading unchanged when the heading increment is smaller than Δh .Sk is the flag of detected walking patterns, including walking forwards and backwards.Sk is set to 1 when a walking forwards pattern is detected, while Sk is set to For the above four walking patterns, the multi-pattern-based location updating equation is described as follows: where L k is the step-length and θ k is the difference of heading angle compared with initial heading which is provided by the calibrated magnetometer [32].The real-time heading is calculated by an EKF filter which combines the outputs of the gyroscope and magnetometer [30].A threshold ∆h is used to eliminate the heading jitter when walking and keep the heading unchanged when the heading increment is smaller than ∆h.S k is the flag of detected walking patterns, including walking forwards and backwards.S k is set to 1 when a walking forwards pattern is detected, while S k is set to −1 when a walking backwards pattern detected.In case of other walking patterns, S k is set to 0. U k is the flag of lateral walking patterns.U k is set to −1 when a left lateral walking pattern detected, and U k is set to 1 when a right lateral walking pattern detected.In case of other walking patterns, U k is set to 0. The real-time location of pedestrians can be accurately updated using the above equation.Compared with the traditional location updating method provided in [30], when backwards or lateral walking patterns happen, the proposed location updating algorithm can effectively classify the different walking patterns and go on to decrease the positioning error caused by misjudgment.

Challenges of Indoor Positioning for Pedestrians
The Wi-Fi FTM protocol included in IEEE 802.11-2016 enables Wi-Fi ranging between the mobile terminal and Wi-Fi AP and provides a new direction for Wi-Fi-based indoor positioning.PDR is based on multiple sensors and calculates the step length and heading difference to update the relative coordinates of pedestrian.These two methods are the focus of recent research.However, in summarizing the work of predecessors, this paper found that the Wi-Fi FTM-based approach and PDR algorithm continue to face the following challenges: 1. Clock Deviation of Wi-Fi FTM IEEE 802.11-2016 gives a definition about Wi-Fi ranging which supports exchange of FTM information and timestamps captured between the mobile terminal and Wi-Fi AP [13].TOA and DOA methods [33,34] are included in parameters of each single FTM exchange.The clock-based timestamps capture cannot be absolutely precise; thus, one of the most important factors that causes the Wi-Fi ranging error is the clock deviation error, which is caused by an initial deviation and a random error, which are inconsistent with different mobile terminals and Wi-Fi APs.Generally, the initial deviation can be calibrated by calculating the difference between the true value and the measurement in field tests [14].The random clock error causes a fluctuation of the received RTT data on the mobile terminal, which can be eliminated by filters such as the Kalman Filter (KF) [35], Mean filter [36], Gaussian filter [37].

NLOS and Multipath Propagation
In a complex indoor environment, the Wi-Fi ranging results may contain NLOS distance which may not be easily detected.The existence of NLOS errors will significantly degrade the localization performance, and, hence, the mitigation of NLOS errors becomes an urgent task [38,39].In indoor scenarios, the direct path between transceivers are easily blocked due to the complexity of the indoor layout.The propagation of the waves' path may lengthen due to reflection, refraction, and scattering, all of which can cause large positioning errors for indoor navigation with ranged-based methods [40,41].

Cumulative Error of Inertial Sensors
In the PDR method, the current location is based on the continuous reckoning of the previous locations and pedestrian steps.The step-length error and step-count deviation caused by cumulative error of inertial sensors will influence positioning accuracy [42].In addition, heading drift is also an important factor [43].In [44], it is noted that the cumulative error is always existing and growing with time, while the requirement of indoor localization is within 5 m.Therefore, it is necessary to eliminate the cumulative error.

Ranging Model of Wi-Fi FTM
IEEE 802.11-2016 enhanced Wi-Fi ranging by providing Wi-Fi FTM-any mobile terminals which support this new protocol can use this function.However, the raw data from FTM contains a clock deviation error and could be influenced by NLOS and multipath propagation.In this section, a real-time ranging model which can effectively reduce the error caused by clock deviation, NLOS, and multipath is proposed.

Model of Clock Deviation Error
It can be noticed from Figure 1 that the final RTT data is calculated by the different timestamps carried by the Wi-Fi FTM framework.In other words, the detection precision of the timestamps determines the accuracy of the calculated RTT.However, these timestamps are not the true time instant when the signals arrive or leave the Wi-Fi AP and mobile terminal due to the procedure of signal processing and hardware delay.The true RTT data finally calculated by the Wi-Fi AP contains an initial time difference called ∆t delay , which is inconsistent between different hardware structures and processing methods of the signal-similar as TOA and DOA technology.∆t delay in one period of RTT can be described as follows: where RTT true is the true ranging result after subtracting ∆t delay from real-time measurement result RTT measurement -t is defined in Equation ( 1).The random error of the clock exists during the each FTM processing due to the status of the system and signal propagation in different environments.When the distance is finally calculated, it fluctuates within a range due to random error.In general, ∆t random can be assumed as Gaussian-distributed variables with zero mean and variance after calibration, which is described in Equation ( 10): where m is the timestamp.With the understanding of the initial clock deviation and random error of the clock, RTT in one period can be described as follows: (11) where ∆t delay exists before ranging which can't be easily detected directly by hardware.As such, before using the Wi-Fi ranging system, some calibration measurements have to be done to eliminate the initial clock deviation ∆t delay .∆t random exists during the ranging process which can result in signal fluctuation.Both errors cannot be fully eliminated by calibration and filter, so a further processing algorithm is needed.

Model of NLOS and Multipath Propagation
It is important to consider an indoor environment with several available APs which support the Wi-Fi FTM.In the case that the mobile terminal is moving, parts of APs may be blocked in a short time that cause the NLOS and multipath propagation which may not be detected by themselves.In order to solve the problem, a ranging model containing the effects of NLOS and multipath propagation is proposed.Locations of Responders/APs is indicated as P i , and location of the mobile terminal is indicated as P. Taking the effect of NLOS and multipath into consideration can result in the following model: Remote Sens. 2019, 11, 504 where L i is the measured distance, i is used to differentiate different APs, L 0 is the extra ranging distance caused by multipath, P = [x 0 y 0 ] T indicates the location of mobile terminal, P i is the location of Wi-Fi AP, P −P i is the matrix norm that indicates the Euclidean distance between mobile terminal and Wi-Fi AP, e i is the NLOS error which indicates the difference between the final propagation distance of the signal and the true straight line distance when LOS path is lacked [45], d random is the random error of measurements which confront to a zero-mean Gaussian distribution with a variance of 0.25 [14], and ∆t random is defined in Equation (10).We assume that e i is much larger than d random , with a boundary of b i , which always indicates the distance between mobile terminal to the farthest AP.Since d random is always between −0.5m and 0.5m according to [14], we move e i to the left side, square both sides, and neglect the d 2 random : Then d random can be obtained as: Then define a function on e i : The LS [45] algorithm can be used to solve Equation ( 15) with the condition 0 < e i < b i .Assuming that the number of available Wi-Fi APs is N: With the condition 0< e i < b i , max e i f (e i ) can be divided into two cases: First case: Then Equation ( 16) can be translated as: min Introducing variables y = P 2 , r = L 0 2 , k i = 2L 0 P−P i creates the following equation: min Based on the assumption that e i >> |d random |, Equation ( 18) can be transformed into a more tightened problem: Problem ( 19) is non-convex.With the constraints y = P 2 , r = L 0 2 , the commonly used standard second-order cone relaxation technique can be applied to relax them as P 2 ≤ y and L 0 2 ≤ r.For the constraint k i = 2L 0 P − P i (L i ≤ b i ), transforming the equation to a convex one can result in the following constraint: Utilizing the relaxations for constraints and the approximations in Equation ( 19), a convex second-order cone program is as follows: min The optimal estimated value of P − P i can be gotten from the above formulas and constraints, which approximate to the true value of RTT data from each Wi-Fi AP.

Integrated Localization Based on Wi-Fi FTM and PDR
This work provides multiple sensors and a Wi-Fi ranging model to estimate pedestrian position.The two methods have their own advantages and disadvantages.The positioning method based on Wi-Fi FTM can provide the exact coordinates directly, but it is affected by NLOS and multipath propagation.Multi-sensor estimation is more accurate within a short distance, but there exist cumulative errors which cannot be used for a long time.This paper combines the two methods to overcome the shortage of each.The estimation based on Wi-Fi FTM could eliminate the cumulative error caused by multi-sensor estimation and could provide an initial location to UKF model.Multi-sensor estimation has good time-recursive performance and can decrease error of NLOS and multipath propagation caused by Wi-Fi FTM.Since UKF does not ignore high-order terms, it has higher filtering accuracy than EKF under the same conditions, and the computational complexity is smaller than PF; thus, the UKF is selected for data fusion in this paper which combines the proposed two methods to achieve higher positioning accuracy.The whole framework of proposed DRWMs algorithm is shown in Figure 6.

System Model Based on Unscented Kalman filter
In the process of fusion, the difference of position estimated by multiple sensors is calculated as predicted value, and the distance calculated by the Wi-Fi FTM-based ranging model is used as the observed value.The system state equation is as follows: x t x t t S t t t where [x(t−1) y(t−1)] T are the 2D coordinates of the pedestrian at time t−1, S(t) is the real-time steplength, v is the Gaussian noise with a noise matrix Q, ψ is a unit matrix, and  6) and are used for multi-pattern step detection.The initial location (x(0), y(0)) is provided by the LS algorithm, which is defined in Equation (3).
The distance between the mobile terminal and each Wi-Fi AP is calculated by Wi-Fi FTM and is called the round-trip time (RTT); it can be used as an observed value after pre-processing by the ranging model proposed in Section 3. The accuracy of position estimation can be improved using multiple Wi-Fi APs.The observation equation is as follows: x

t x y t y x t x y t y t x t x y t y
where U is the random error of Wi-Fi FTM with a noise matrix R, , and drandom is defined in Equation (12).x(t) and y(t) are estimated by the system state equation.The Euclidean distance between the predicted position and each Wi-Fi AP is calculated as observation value, j is the number of Wi-Fi AP, and xj and yj indicate the position of each AP.

Data Fusion via Unscented Kalman filter
The UKF is a well-known nonlinear state estimation method which shows superior performance at nonlinear estimation and data fusion [46,47].The Unscented Kalman filter proposed in this paper is divided into eight steps:

System Model Based on Unscented Kalman filter
In the process of fusion, the difference of position estimated by multiple sensors is calculated as predicted value, and the distance calculated by the Wi-Fi FTM-based ranging model is used as the observed value.The system state equation is as follows: where [x(t − 1) y(t − 1)] T are the 2D coordinates of the pedestrian at time t − 1, S(t) is the real-time step-length, v is the Gaussian noise with a noise matrix Q,ψ is a unit matrix, and B = [S t sin θ t + U t cos θ t S t cos θ t − U t sin θ t ] T , indicates the difference of heading angle compared with initial heading.S k and U k are defined in Equation ( 6) and are used for multi-pattern step detection.The initial location (x(0), y(0)) is provided by the LS algorithm, which is defined in Equation (3).The distance between the mobile terminal and each Wi-Fi AP is calculated by Wi-Fi FTM and is called the round-trip time (RTT); it can be used as an observed value after pre-processing by the ranging model proposed in Section 3. The accuracy of position estimation can be improved using multiple Wi-Fi APs.The observation equation is as follows: where U is the random error of Wi-Fi FTM with a noise matrix and d random is defined in Equation ( 12).x(t) and y(t) are estimated by the system state equation.The Euclidean distance between the predicted position and each Wi-Fi AP is calculated as observation value, j is the number of Wi-Fi AP, and x j and y j indicate the position of each AP.

Data Fusion via Unscented Kalman filter
The UKF is a well-known nonlinear state estimation method which shows superior performance at nonlinear estimation and data fusion [46,47].The Unscented Kalman filter proposed in this paper is divided into eight steps: (1) Getting sigma point set based on the previous location ∧ X(t|t) and the corresponding weight: where β is the dimension of the state value, η is the corresponding number of sigma point set, and λ is the proportional parameter which is used to scale of the weight.φ(t|t) is the state covariance matrix at the current moment t.
(4) Getting the sigma point set again using UT transform based on the predicted state value.
where φ z t z t is the covariance matrix calculated by ∧ Z(t + 1|t) and Z (η) (t + 1|t), and φ x t z t is the covariance matrix calculated by ∧ Z(t + 1|t) and X (η) (t + 1|t).
The state equation describes the recursive relationship between input and output.The location updating equation for multiple sensors is used as the state equation.Compared with the 3 Hz sampling rate of Wi-Fi FTM, multi-sensor-based dead reckoning has better timing recursion because of much higher sampling rate of 50 Hz, which could be used as the state equation.The estimated by the Wi-Fi FTM-based ranging model is obtained as the observation.There is no cumulative error in the process of Wi-Fi FTM, so the estimation distance between the mobile terminal and each Wi-Fi AP can be used as the observed value.What one has to be aware of is that the UKF can only solve the random error, which could be seen as the Gaussian noise.In this paper, the Wi-Fi ranging model can effectively reduce the initial clock error, NLOS, and multipath effect, while random error-which is defined in Equation ( 10)-is added in the UKF model.Based on the covariance in the Unscented Kalman filter, this paper can obtain the corresponding weight of the Wi-Fi ranging model and the multi-sensor estimation and go on to get the most optimal position estimation.
To summarize, the proposed UKF fuses the estimation results of the two methods.On the one hand, the absolute position provided through the Wi-Fi FTM-based ranging model eliminates the cumulative error caused by multiple sensors; on the other hand, the multi-sensor recursive results for continuous trajectory reduce the effect of NLOS and multipath propagation caused by Wi-Fi FTM.Hence, a more accurate localization result is provided through the Unscented Kalman filter.

Experimental Results of DRWMs
In this section, several experiments are designed to verify the multi-pattern-based PDR algorithm, Wi-Fi FTM-based ranging model, and the proposed DRWMs algorithm.Two typical indoor environments were selected as the experimental sites.One contained a rectangular office and a long corridor; the other was part of a shopping mall.The Wi-Fi AP uses an Intel 8260 Wireless card and an Ubuntu 16.04 LTS as hardware and software platforms, which were custom-made by this work.A Google Pixel 3 was used as mobile terminal which supports Android P-based Wi-Fi FTM and can get real-time RTT data from surrounding Wi-Fi Aps.In addition, the Google Pixel 3 contained the sensors such as the accelerometer, gyroscope, and magnetometer.The sampling rates of the multi-sensor and Wi-Fi FTM was 50 Hz and 3 Hz, based on Google Pixel 3. The real-time location information calculated by UKF was acquired with frequency of 3 Hz.Timestamps within the multi-sensor method and Wi-Fi FTM were synchronized based on the time when RTT data returned.∆h was set to 2.5 • to eliminate the little heading jitter when walking.In the first experimental site, four APs were fixed on the stands with a 1.5m height in different locations of a rectangular office which contains NLOS and multipath propagation effects such as glass, partition shades, and a wall column.The tester could almost walk through the location of each AP, which ensured that the RTT data could be received anywhere in the office (12 m * 12 m).The position of each Wi-Fi AP is shown in Figure 7.
The tester could almost walk through the location of each AP, which ensured that the RTT data could be received anywhere in the office (12 m * 12 m).The position of each Wi-Fi AP is shown in Figure 7.

Evaluation of Multi-Pattern-Based Dead Reckoning
The estimation of steps and step-length acquired by multiple sensors is the base of dead reckoning.The analysis of step detection and step-length error of each walking pattern is shown in Tables 1 and 2. Comparing the detected steps with the true steps, the error rate was no more than 8%.The error of multi-pattern-based step-length was no more than 4.84% compared with the true distance.Thus, the proposed multi-pattern-based step detection algorithm and the step-length model can obtain accurate estimation results.The multi-pattern-based location updating algorithm can obtain real-time location information when the pedestrian executes different walking patterns indoors.A traditional dead reckoning algorithm can only be used in case of walking forward.In the case of walking backward, left lateral walking, and right lateral walking, the multi-pattern-based location updating algorithm is used to minimize the coordinate updating error due to the misjudgment of step detection.By using the multipattern step detection algorithm, different walking patterns are detected and the corresponding step length is calculated; then, location updating based on multiple walking patterns can effectively reduce the cumulative error of dead reckoning.
The walking path is shown in Figure 8a.The pedestrian started from the position of AP1 (0,0), walked forward to AP2 (0,10), right laterally walked to AP3 (10,10), walked backward to AP4 (10,0), and, finally, left laterally walked to AP1.The step-length model in Equation ( 6) was used, and the output frequency of location is 50 Hz was based on PDR only.In the traditional PDR method, the

Evaluation of Multi-Pattern-Based Dead Reckoning
The estimation of steps and step-length acquired by multiple sensors is the base of dead reckoning.The analysis of step detection and step-length error of each walking pattern is shown in Tables 1 and 2. Comparing the detected steps with the true steps, the error rate was no more than 8%.The error of multi-pattern-based step-length was no more than 4.84% compared with the true distance.Thus, the proposed multi-pattern-based step detection algorithm and the step-length model can obtain accurate estimation results.The multi-pattern-based location updating algorithm can obtain real-time location information when the pedestrian executes different walking patterns indoors.A traditional dead reckoning algorithm can only be used in case of walking forward.In the case of walking backward, left lateral walking, and right lateral walking, the multi-pattern-based location updating algorithm is used to minimize the coordinate updating error due to the misjudgment of step detection.By using the multi-pattern step detection algorithm, different walking patterns are detected and the corresponding step length is calculated; then, location updating based on multiple walking patterns can effectively reduce the cumulative error of dead reckoning.
The walking path is shown in Figure 8a.The pedestrian started from the position of AP1 (0,0), walked forward to AP2 (0,10), right laterally walked to AP3 (10,10), walked backward to AP4 (10,0), and, finally, left laterally walked to AP1.The step-length model in Equation ( 6) was used, and the output frequency of location is 50 Hz was based on PDR only.In the traditional PDR method, the backward and lateral walking patterns can only be detected as a forward walking pattern; thus, the forward walking pattern and mixed walking pattern are compared in this work.A set of forward walking samples were collected with the same walking path for comparison.The positioning result is shown in Figure 8b.In order to estimate the short-term accuracy of the multi-pattern-based PDR algorithm, 20 sets of data were collected using the same walking route and corresponding pattern for testing the closed loop accuracy of the multi-pattern-based PDR algorithm; a mean error of 1.95 m was gotten by calculating the Euclidean distance from the end point to the starting point, as shown in Figure 9.The experimental results show that the proposed multi-pattern-based PDR algorithm provided high accuracy among a short time, and the single forward pattern had higher accuracy than the mixed pattern.

Experiment Results of Wi-Fi FTM-Based Ranging Model
The process of Wi-Fi FTM is affected by clock deviation, NLOS, and multipath propagation.The initial clock deviation can be estimated by the specific calibration method proposed in [14], and it can then be calibrated on an Android P-based Google Pixel 3 by subtracting the initial clock deviation from acquired RTT data.In case of NLOS and multipath propagation, a ranging model build in Section 3 can be used to limit the measurement error of Wi-Fi FTM.The experimental site containing a walking path is shown in Figure 8a, and the LS algorithm [27] was used to calculate the real-time In order to estimate the short-term accuracy of the multi-pattern-based PDR algorithm, 20 sets of data were collected using the same walking route and corresponding pattern for testing the closed loop accuracy of the multi-pattern-based PDR algorithm; a mean error of 1.95 m was gotten by calculating the Euclidean distance from the end point to the starting point, as shown in Figure 9.The experimental results show that the proposed multi-pattern-based PDR algorithm provided high accuracy among a short time, and the single forward pattern had higher accuracy than the mixed pattern.In order to estimate the short-term accuracy of the multi-pattern-based PDR algorithm, 20 sets of data were collected using the same walking route and corresponding pattern for testing the closed loop accuracy of the multi-pattern-based PDR algorithm; a mean error of 1.95 m was gotten by calculating the Euclidean distance from the end point to the starting point, as shown in Figure 9.The experimental results show that the proposed multi-pattern-based PDR algorithm provided high accuracy among a short time, and the single forward pattern had higher accuracy than the mixed pattern.

Experiment Results of Wi-Fi FTM-Based Ranging Model
The process of Wi-Fi FTM is affected by clock deviation, NLOS, and multipath propagation.The initial clock deviation can be estimated by the specific calibration method proposed in [14], and it can then be calibrated on an Android P-based Google Pixel 3 by subtracting the initial clock deviation from acquired RTT data.In case of NLOS and multipath propagation, a ranging model build in Section 3 can be used to limit the measurement error of Wi-Fi FTM.The experimental site containing a walking path is shown in Figure 8a, and the LS algorithm [27] was used to calculate the real-time

Experiment Results of Wi-Fi FTM-Based Ranging Model
The process of Wi-Fi FTM is affected by clock deviation, NLOS, and multipath propagation.The initial clock deviation can be estimated by the specific calibration method proposed in [14], and it can then be calibrated on an Android P-based Google Pixel 3 by subtracting the initial clock deviation from acquired RTT data.In case of NLOS and multipath propagation, a ranging model build in Section 3 can be used to limit the measurement error of Wi-Fi FTM.The experimental site containing a walking path is shown in Figure 8a, and the LS algorithm [27] was used to calculate the real-time location.In the case of using the LS algorithm without a ranging model, the acquired RTT data will be affected by the ranging error mentioned above.In the case of using the LS algorithm with the ranging model, the ranging error is decreased, and better localization performance is realized.The comparison result is shown in Figure 10.The place marked by the triangle in Figure 10a is a pillar which could causes NLOS distance.
Remote Sens. 2019, 11, x FOR PEER REVIEW 16 of 22 location.In the case of using the LS algorithm without a ranging model, the acquired RTT data will be affected by the ranging error mentioned above.In the case of using the LS algorithm with the ranging model, the ranging error is decreased, and better localization performance is realized.The comparison result is shown in Figure 10.The place marked by the triangle in Figure 10a is a pillar which could causes NLOS distance.In order to estimate the robustness of the proposed Wi-Fi ranging model in an LOS/NLOS mixed environment, 20 sets of data were collected using the same walking route in Figure 8a.Due to the occlusion of the pillar shown in Figure 7, the acquired RTT data at location of AP3 always contained effects of NLOS, while the locations of AP1, AP2, and AP4 did not.Figure 10b gives a comparison of the presence or absence of the Wi-Fi ranging model using the LS algorithm.The positioning error at each location of each AP was calculated by Euclidean distance.It can be found in Figure 10b that the proposed Wi-Fi ranging model effectively improves the accuracy of Wi-Fi ranging result, especially when there are obstacles blocking in the transmission path of the Wi-Fi signal.Thus, the NLOS-based error is effectively eliminated by the proposed ranging model, which contributes to the improvement of positioning accuracy.

Experiment Results of DRWMs Algorithm
Section 5.1 presented the accuracy of the multi-pattern-based PDR algorithm in a relatively short time.However, the PDR-based algorithm is not suitable for long-term localization due to the cumulative error of heading, step-length, and the location updating method.The Wi-Fi FTM-based positioning method has no cumulative error, but it is affected by NLOS and multipath propagation.In this paper, a multi-pattern-based PDR algorithm is proposed to eliminate error of step detection and location updating.Then a Wi-Fi FTM-based ranging model is established to minimize the ranging error caused by clock deviation, NLOS, and multipath propagation.Based on these, DRWMs are proposed to fuse the short-term accuracy of multi-pattern-based PDR and long-term accuracy of Wi-Fi ranging.In order to estimate the long-term localization performance of proposed DRWMs, a rectangular room was used as an experimental site, which is shown in Figure 7.The pedestrian started from the position of AP1 (0,0), walked forward to AP2 (0,10), right laterally walked to AP3 (10,10), walked backward to AP4 (10,0), and finally left laterally walked to AP1.The walking path is shown in Figure 8a.This process was continuously repeated 10 times to estimate the long-term accuracy of DRWMs compared with multi-pattern-based PDR algorithm.All experimental processes were continuous and there was no pause between walking procedure.The experimental result is shown in Figure 11.In order to estimate the robustness of the proposed Wi-Fi ranging model in an LOS/NLOS mixed environment, 20 sets of data were collected using the same walking route in Figure 8a.Due to the occlusion of the pillar shown in Figure 7, the acquired RTT data at location of AP3 always contained effects of NLOS, while the locations of AP1, AP2, and AP4 did not.Figure 10b gives a comparison of the presence or absence of the Wi-Fi ranging model using the LS algorithm.The positioning error at each location of each AP was calculated by Euclidean distance.It can be found in Figure 10b that the proposed Wi-Fi ranging model effectively improves the accuracy of Wi-Fi ranging result, especially when there are obstacles blocking in the transmission path of the Wi-Fi signal.Thus, the NLOS-based error is effectively eliminated by the proposed ranging model, which contributes to the improvement of positioning accuracy.

Experiment Results of DRWMs Algorithm
Section 5.1 presented the accuracy of the multi-pattern-based PDR algorithm in a relatively short time.However, the PDR-based algorithm is not suitable for long-term localization due to the cumulative error of heading, step-length, and the location updating method.The Wi-Fi FTM-based positioning method has no cumulative error, but it is affected by NLOS and multipath propagation.In this paper, a multi-pattern-based PDR algorithm is proposed to eliminate error of step detection and location updating.Then a Wi-Fi FTM-based ranging model is established to minimize the ranging error caused by clock deviation, NLOS, and multipath propagation.Based on these, DRWMs are proposed to fuse the short-term accuracy of multi-pattern-based PDR and long-term accuracy of Wi-Fi ranging.In order to estimate the long-term localization performance of proposed DRWMs, a rectangular room was used as an experimental site, which is shown in Figure 7.The pedestrian started from the position of AP1 (0,0), walked forward to AP2 (0,10), right laterally walked to AP3 (10,10), walked backward to AP4 (10,0), and finally left laterally walked to AP1.The walking path is shown in Figure 8a.This process was continuously repeated 10 times to estimate the long-term accuracy of DRWMs compared with multi-pattern-based PDR algorithm.All experimental processes were continuous and there was no pause between walking procedure.The experimental result is shown in Figure 11.In Figure 11, the proposed DRWMs algorithm, which is based on UKF, shows high accuracy and stability compared with multi-pattern-based PDR using the proposed step detection and step-length calculation method through long-term estimation.In the process of long-term measurements, the step-length of the PDR method causes the error of the final localization performance.It is foreseeable that with the duration of testing, the cumulative error caused by PDR method increases.Using the DRWMs algorithm obviously improves the long-term accuracy.We recorded the real-time locations when passing the reference point AP1 between the process of testing and got the comparison of position error by calculating the Euclidean distance between the real-time location and the position of the reference AP.Experimental results are shown in Figure 12.It can be found in Figure 12 that after a long period of continuous testing, the error of PDR-based method begins increasing while the proposed DRWMs algorithm maintains high precision.In Figure 11, the proposed DRWMs algorithm, which is based on UKF, shows high accuracy and stability compared with multi-pattern-based PDR using the proposed step detection and step-length calculation method through long-term estimation.In the process of long-term measurements, the step-length of the PDR method causes the error of the final localization performance.It is foreseeable that with the duration of testing, the cumulative error caused by PDR method increases.Using the DRWMs algorithm obviously improves the long-term accuracy.We recorded the real-time locations when passing the reference point AP1 between the process of testing and got the comparison of position error by calculating the Euclidean distance between the real-time location and the position of the reference AP.Experimental results are shown in Figure 12.In Figure 11, the proposed DRWMs algorithm, which is based on UKF, shows high accuracy and stability compared with multi-pattern-based PDR using the proposed step detection and step-length calculation method through long-term estimation.In the process of long-term measurements, the step-length of the PDR method causes the error of the final localization performance.It is foreseeable that with the duration of testing, the cumulative error caused by PDR method increases.Using the DRWMs algorithm obviously improves the long-term accuracy.We recorded the real-time locations when passing the reference point AP1 between the process of testing and got the comparison of position error by calculating the Euclidean distance between the real-time location and the position of the reference AP.Experimental results are shown in Figure 12.It can be found in Figure 12 that after a long period of continuous testing, the error of PDR-based method begins increasing while the proposed DRWMs algorithm maintains high precision.It can be found in Figure 12 that after a long period of continuous testing, the error of PDR-based method begins increasing while the proposed DRWMs algorithm maintains high precision.
In order to estimate the expandability and stability of the proposed DRWMs, a rectangular office (12 m * 12 m) and a vertical corridor (45 m) was chosen as the first experimental site.The pedestrian started from the position of AP1 (0,0), walked forward to AP2 (0,10), right laterally walked to AP3 (10,10), walked backward to AP4 (10,0), left laterally walked to AP1, walked forward out of the office, walked forward to AP6 (−34,−2), and finally returned to AP1-as shown in Figure 13.When the corridor could be seen as the one-dimensional environment, just two APs (AP5 and AP6) were available.Five APs (AP1, AP2, AP3, AP4, AP6) were chosen as reference points.10 sets of data were collected using the same walking route by different people, and the corresponding walking patterns and positioning errors at each reference point are shown in Figure 14: In order to estimate the expandability and stability of the proposed DRWMs, a rectangular office (12 m * 12 m) and a vertical corridor (45 m) was chosen as the first experimental site.The pedestrian started from the position of AP1 (0,0), walked forward to AP2 (0,10), right laterally walked to AP3 (10,10), walked backward to AP4 (10,0), left laterally walked to AP1, walked forward out of the office, walked forward to AP6 (−34,−2), and finally returned to AP1-as shown in Figure 13.When the corridor could be seen as the one-dimensional environment, just two APs (AP5 and AP6) were available.Five APs (AP1, AP2, AP3, AP4, AP6) were chosen as reference points.10 sets of data were collected using the same walking route by different people, and the corresponding walking patterns and positioning errors at each reference point are shown in Figure 14: Figure 14 shows that the maximum errors at each reference point are all within 2 m.This process was repeated 10 times to estimate the long-term accuracy and stability of the proposed DRWMs.All walking processes were continuous, and there was no pause between walking procedures.The total distance of walking was about 760 m, which took 10 minutes.The real-time location was recorded each time when passing the AP1, and the comparison of the position error was gotten by calculating the Euclidean distance between the real-time location and reference AP.Experimental results are shown in Figure 15.In order to estimate the expandability and stability of the proposed DRWMs, a rectangular office (12 m * 12 m) and a vertical corridor (45 m) was chosen as the first experimental site.The pedestrian started from the position of AP1 (0,0), walked forward to AP2 (0,10), right laterally walked to AP3 (10,10), walked backward to AP4 (10,0), left laterally walked to AP1, walked forward out of the office, walked forward to AP6 (−34,−2), and finally returned to AP1-as shown in Figure 13.When the corridor could be seen as the one-dimensional environment, just two APs (AP5 and AP6) were available.Five APs (AP1, AP2, AP3, AP4, AP6) were chosen as reference points.10 sets of data were collected using the same walking route by different people, and the corresponding walking patterns and positioning errors at each reference point are shown in Figure 14: Figure 14 shows that the maximum errors at each reference point are all within 2 m.This process was repeated 10 times to estimate the long-term accuracy and stability of the proposed DRWMs.All walking processes were continuous, and there was no pause between walking procedures.The total distance of walking was about 760 m, which took 10 minutes.The real-time location was recorded each time when passing the AP1, and the comparison of the position error was gotten by calculating the Euclidean distance between the real-time location and reference AP.Experimental results are shown in Figure 15. Figure 14 shows that the maximum errors at each reference point are all within 2 m.This process was repeated 10 times to estimate the long-term accuracy and stability of the proposed DRWMs.All walking processes were continuous, and there was no pause between walking procedures.The total distance of walking was about 760 m, which took 10 minutes.The real-time location was recorded each time when passing the AP1, and the comparison of the position error was gotten by calculating the Euclidean distance between the real-time location and reference AP.Experimental results are shown in Figure 15.Then, a shopping mall was chosen as the second experimental site.The dotted line in Figure 16a indicates wooden shelf: The location of each AP shown in Figure 16a.The pedestrian started from the position of A(18,0), walked forward to B(0,15) and C(0,−5), left laterally walked to D(8,−5), walked backward to E(8,0), and then turned and right laterally walked to A(18,0).This process was continuously repeated 10 times, and the point E was selected as the reference point.The total distance of walking was about 780 m, which took 11 minutes.The real-time location was recorded each time when passing point E, and the comparison of position error was gotten by calculating the Euclidean distance between the real-time location and point E. Experimental results are shown in Figure 16b and indicate a higher precision and stability of the proposed DRWMs algorithm compared with the single multi-pattern-based PDR and Wi-Fi FTM-based ranging models.Then, a shopping mall was chosen as the second experimental site.The dotted line in Figure 16a indicates wooden shelf: The location of each AP shown in Figure 16a.The pedestrian started from the position of A(18,0), walked forward to B(0,15) and C(0,−5), left laterally walked to D(8,−5), walked backward to E(8,0), and then turned and right laterally walked to A(18,0).This process was continuously repeated 10 times, and the point E was selected as the reference point.The total distance of walking was about 780 m, which took 11 minutes.The real-time location was recorded each time when passing point E, and the comparison of position error was gotten by calculating the Euclidean distance between the real-time location and point E. Experimental results are shown in Figure 16b and indicate a higher precision and stability of the proposed DRWMs algorithm compared with the single multi-pattern-based PDR and Wi-Fi FTM-based ranging models.
Thus, the proposed DRWMs combine the advantages of the PDR method and Wi-Fi FTM-based ranging model and obtains more accurate location information.In general, the continuous improvements of the algorithm increase the localization performance.

Conclusion
To improve the accuracy and stability of indoor localization, this paper proposed the DRWMs algorithm, which is divided into three parts: 1) Multi-pattern-based dead reckoning via multiple sensors; 2) Wi-Fi FTM-based ranging model; 3) integrated localization using UKF.The initial location Thus, the proposed DRWMs combine the advantages of the PDR method and Wi-Fi FTM-based ranging model and obtains more accurate location information.In general, the continuous improvements of the algorithm increase the localization performance.

Conclusions
To improve the accuracy and stability of indoor localization, this paper proposed the DRWMs algorithm, which is divided into three parts: (1) Multi-pattern-based dead reckoning via multiple sensors; (2) Wi-Fi FTM-based ranging model; (3) integrated localization using UKF.The initial location of UKF is provided by the LS method, and, then, dead reckoning begins.The step information contains walking patterns, and step-length is detected and calculated by the time-domain features of acceleration.The corresponding location updating algorithm takes different walking patterns into consideration and improves the flexibility and precision of multi-sensor estimation.The Wi-Fi FTM-based ranging model contains the effects of clock deviation, NLOS, and multipath propagation, which can effectively reduce the Wi-Fi ranging error and provides better localization performance.Finally, the multi-sensor estimation and Wi-Fi ranging model estimation are fused by UKF, and the advantages of two methods are combined to obtain higher positioning accuracy.The experimental results show that the proposed DRWMs algorithm achieves more precise and stable localization performance and satisfies different walking modes and indoor environment requirements.The final positioning error is within 2 m.
In the future, it is foreseen that the precise positioning results provided by Wi-Fi FTM and multiple sensors can gain further improvement by fusing multiple sources of information estimated from Wi-Fi signal such as RSSI, AOA, and CSI.With more and more Wi-Fi chipsets in mobile devices supporting large bandwidth transmission-up to 160 MHz or more-the precision of RTT ranging Wi-Fi FTM will largely improve, which will be benefit to the high accuracy indoor localization.

Figure 1 .
Figure 1.Procedure of Wi-Fi Fine Time Measurement (FTM)

Figure 1 .
Figure 1.Procedure of Wi-Fi Fine Time Measurement (FTM)

Figure 2 .
Figure 2. Handheld posture of mobile phone.

Figure 2 .
Figure 2. Handheld posture of mobile phone.

Figure 3 .
Figure 3.Comparison of walking forward and backward.

Figure 3 .
Figure 3.Comparison of walking forward and backward.

Figure 3 .
Figure 3.Comparison of walking forward and backward.

Figure 6 .
Figure 6.Framework of the Wi-Fi FTM and multiple sensors (DRWM)s algorithm.

1 )
Getting sigma point set based on the previous location ( | ) t t ∧ X and the corresponding weight:

Figure 6 .
Figure 6.Framework of the Wi-Fi FTM and multiple sensors (DRWM)s algorithm.
Remote Sens. 2019, 11, x FOR PEER REVIEW 15 of 22 backward and lateral walking patterns can only be detected as a forward walking pattern; thus, the forward walking pattern and mixed walking pattern are compared in this work.A set of forward walking samples were collected with the same walking path for comparison.The positioning result is shown in Figure 8b.Reference walking path.( b) Comparison of mixed and forward pattern.

Figure 8 .
Figure 8.Comparison result of multi-pattern and forward-pattern.

Figure 9 .
Figure 9. Positioning error of mixed-pattern and forward-pattern.

Figure 8 .
Figure 8.Comparison result of multi-pattern and forward-pattern.
Remote Sens. 2019, 11, x FOR PEER REVIEW 15 of 22 backward and lateral walking patterns can only be detected as a forward walking pattern; thus, the forward walking pattern and mixed walking pattern are compared in this work.A set of forward walking samples were collected with the same walking path for comparison.The positioning result is shown in Figure 8b.Reference walking path.( b) Comparison of mixed and forward pattern.

Figure 8 .
Figure 8.Comparison result of multi-pattern and forward-pattern.

Figure 9 .
Figure 9. Positioning error of mixed-pattern and forward-pattern.

Figure 9 .
Figure 9. Positioning error of mixed-pattern and forward-pattern.
(a) Comparison of the least squares (LS) algorithm.(b) Location error of ranging model.

Figure 12 .
Figure 12.Comparison of error with long-term estimation.

Figure 12 .
Figure 12.Comparison of error with long-term estimation.

Figure 12 .
Figure 12.Comparison of error with long-term estimation.

Figure 13 .
Figure 13.Experimental site contains office and corridor.

Figure 14 .
Figure 14.Positioning errors at each reference point.

Figure 14 .
Figure 14.Positioning errors at each reference point.

Figure 14 .
Figure 14.Positioning errors at each reference point.

22 Figure 15 .
Figure 15.Long-term estimation in first experimental site.

Figure 15 suggests
Figure 15 suggests the high precision and stability of the proposed DRWMs algorithm compared with the single multi-pattern-based PDR and Wi-Fi FTM-based ranging model.

Figure 15 .
Figure 15.Long-term estimation in first experimental site.

Figure 15
Figure 15 suggests the high precision and stability of the proposed DRWMs algorithm compared with the single multi-pattern-based PDR and Wi-Fi FTM-based ranging model.Then, a shopping mall was chosen as the second experimental site.The dotted line in Figure16aindicates wooden shelf: The location of each AP shown in Figure16a.The pedestrian started from the position of A(18,0), walked forward to B(0,15) and C(0,−5), left laterally walked to D(8,−5), walked backward to E(8,0), and then turned and right laterally walked to A(18,0).This process was continuously repeated 10 times, and the point E was selected as the reference point.The total distance of walking was about 780 m, which took 11 minutes.The real-time location was recorded each time when passing point E, and the comparison of position error was gotten by calculating the Euclidean distance between the real-time location and point E. Experimental results are shown in Figure16band indicate a higher precision and stability of the proposed DRWMs algorithm compared with the single multi-pattern-based PDR and Wi-Fi FTM-based ranging models.

Figure 15 .
Figure 15.Long-term estimation in first experimental site.

Figure 15
Figure 15 suggests the high precision and stability of the proposed DRWMs algorithm compared with the single multi-pattern-based PDR and Wi-Fi FTM-based ranging model.

Figure 16 .
Figure 16.Long-term estimation in second experimental site.

Figure 16 .
Figure 16.Long-term estimation in second experimental site.

Table 1 .
Error of multi-pattern-based step detection.

Table 2 .
Error of multi-pattern-based step-length.

Table 1 .
Error of multi-pattern-based step detection.

Table 2 .
Error of multi-pattern-based step-length.