# A Fuzzy Logic-Based Energy-Adaptive Localization Scheme by Fusing WiFi and PDR

Authors: Yankan Yang; Baoqi Huang; Zhendong Xu; Runze Yang
Journal: Wireless Communications and Mobile Computing
 (2023)

---

## Abstract

Fusing WiFi fingerprint localization and pedestrian dead reckoning (PDR) on smartphones is attractive because of their obvious complementarity in localization accuracy and energy consumption. Although fusion localization algorithms tend to improve localization accuracy, extra hardware and software involved will result in extra computations, such that energy consumption is inevitably increased. Thus, in this study, we propose a novel fusion localization scheme based on fuzzy logic, which aims to achieve ideal localization accuracy by consuming as little energy as possible. Specifically, energy-efficient inertial measurement unit (IMU) sensors are routinely called to provide the displacement of a smartphone user in the manner of PDR, whereas a fuzzy inference system is employed to adaptively schedule energy-hungry WiFi scans to fulfill WiFi fingerprint localization according to a coarse metric for fusion localization errors and the remaining energy of the smartphone, so as to achieve a trade-off between localization accuracy and energy consumption. Moreover, in order to mitigate the effect of drift errors induced by PDR, straight trajectories of the user are further identified using a series of WiFi localization results to calibrate heading estimates of PDR. Extensive experimental results demonstrate that the proposed scheme achieves the same accuracy as the complementary filter, but consumes 38.02% energy than the complementary filter, confirming that the proposed scheme can effectively balance the localization accuracy and energy consumption.


---

## Body

## 1. Introduction

With the rapid development of mobile internet and the internet of things, location-based service (LBS) applications become pervasive and rely on the location information of people in indoor environments [1]. Presently, the WiFi fingerprint localization method [2, 3] has been favored because of widespread wireless infrastructures and low costs. On account of many random factors, such as diffraction, reflection, and refraction, WiFi localization results suffer severe localization errors, but keep stable in the long term. In contrast, pedestrian dead reckoning (PDR) aims to infer a pedestrian’s displacement by using inertial measurement unit (IMU) sensors embedded in a smartphone, including accelerometer, gyroscope, and magnetometer [4] and offers accurate displacement information in the short term, but incurs significant cumulative errors over time. Considering the fact that WiFi localization and PDR are complementary in localization [5], various multisensor fusion algorithms based on, say Kalman filter (KF) [6, 7], particle filter [8], and complementary filter [9], they have been applied to further improve overall localization accuracy.Nevertheless, multisensor fusion often drains a smartphone’s battery quickly. First, WiFi scan is energy-hungry [10], so that frequently running WiFi scans as well as WiFi localization will result in a rapid drop in the power of the smartphone’s battery. Second, although IMU sensors consume little energy in reading sensor data every time, a high-frequency setting of IMU sensors (which affects the accuracy of PDR [11, 12]) and a long time execution of PDR will definitely consume a significant amount of energy. Hence, both the localization accuracy of a localization system and its energy consumption are key performance metrics that restrict each other.In real life, trade-off methods have been adopted to implement energy-efficient localization. However, efficiently managing the energy consumption of a fusion localization system using WiFi and PDR remains a significant challenge for battery-limited smartphones. Few recent studies have been published on the energy-accuracy trade-off for fusion localization systems using WiFi and PDR. However, in a real situation, the energy-accuracy trade-off is an effective energy saving method. Therefore, we propose an energy-adaptive fusion localization scheme on the basis of fuzzy logic. Specifically, without establishing explicit localization error and energy consumption models, we measure a coarse fusion system error and the remaining energy of a smartphone as two fuzzy variables. Then, a fuzzy inference system (FIS) is developed to formulate trade-off strategies between localization accuracy and energy consumption. On these grounds, the proposed scheme dynamically switches the duty cycle of energy-hungry WiFi scans, achieving the self-adaptation of energy consumption in the fusion. Additionally, we incorporate a novel WiFi-assisted heading estimation method in the fusion localization scheme to mitigate the influence of drift errors incurred by PDR. Particularly, we identify straight trajectories by using WiFi localization results to calibrate the pedestrian’s heading in the fusion, thereby improving the overall localization accuracy.Extensive experiments in a real-world environment and comparisons with well-known methods in the literature are conducted to verify the proposed scheme’s performance. The experiments demonstrate that the proposed scheme can effectively balance localization accuracy against energy consumption in the fusion system, thereby achieving good energy efficiency.The main contributions of this paper are summarized as follows:(1)
We exploit a fuzzy logic controller to balance the accuracy and energy consumption in the fusion localization using WiFi and PDR(2)
We propose to utilize WiFi localization trajectory to correct the drift error of the heading estimate(3)
In order to obtain the ground truths of the trajectory of pedestrians, we obtain the real-time coordinates of pedestrians at each step by the product of the step length and the step countThe rest of the paper is organized as follows: Section II describes the related works. Section III is the overview of the proposed fusion localization scheme. The localization error of the fusion scheme is described in Section IV. Section V discusses the formulation of energy-accuracy trade-off. In Section VI., a WiFi assisted pedestrian heading estimation algorithm is proposed. The experimental setup as well as the analysis and discussion of the experimental results are presented in Section VII. Finally, we conclude our work in Section VIII.


## 2. Related Works

Due to the complementarity of these methods, WiFi localization and PDR are often integrated to achieve higher localization accuracy [13–15]. However, the fusion method causes high energy consumption. In order to achieve energy efficient localization, trade-off methods have been adopted to implement energy-efficient localization [16–20]. For instance, in [16, 17], the authors assumed that WiFi received signal strength (RSS) follows the log-normal distance path loss (LDPL) model and established mathematical models to build a fusion localization system for energy-accuracy trade-off. In [18], the authors proposed cluster heading selection algorithms using the localization accuracy and energy consumption models of mobile nodes for the energy-accuracy trade-off. In [19], the authors developed an energy-efficient localization system by adjusting the number of reference localization according to the environment. In [20], the authors proposed a dynamic multicluster header selection method based on an energy model in a HetNet-based indoor localization framework for energy-accuracy trade-off.The only existing study [16] mainly relies on the corresponding LDPL-based localization error model and energy consumption model. But, the LDPL model only accounts for large-scale fading and ignores small-scale fading induced by multipath propagation, resulting that various empirical models are, respectively, established in regards to different environments [21, 22]. The error models of PDR in [16] mainly focus on the noise and offset error induced by accelerometer, as well as the drift error from gyroscope. Therefore, model-based localization error models are difficult to be applied in real applications.More importantly, the energy consumption model essentially varies across different smartphones and is hard to be established. On the other hand, existing trade-off methods suffer from limited performance due to the fact that only a few scheduling strategies involving WiFi scanning are adopted. For instance, the authors in [16] aim to optimize the number of RSS measurements used in each localization round for energy-accuracy trade-off. In other words, existing fusion methods do not sufficiently exploit the advantages of WiFi and PDR, due to the fact that a high level fusion is conducted without considering the intrinsic relationship between WiFi localization and PDR. Therefore, we propose to exploit the fuzzy logic controller to adaptively balance the accuracy and energy consumption.


## 3. Framework of the Proposed Fusion Localization Scheme

In this section, the framework of the proposed fuzzy logic-based fusion localization scheme is introduced.As shown in Figure1, the proposed scheme comprises two modules, namely, the sensor module and indoor localization module. In the sensor module, IMU sensors collect motion data of a user carrying a smartphone in real time, and the WiFi adapter collects WiFi RSS measurements from nearby WiFi access points (APs). In the indoor localization module, four submodules, namely, PDR, WiFi localization, formulation of energy-accuracy trade-off, and distance-based fusion algorithm, are, respectively, included to achieve energy-accuracy trade-off and are described as follows.
(1)
The component of PDR is in charge of detecting steps of a user and further inferring the step length and heading. Although various fusion algorithms like KF are often used to estimate a pedestrian’s heading, we use the energy-efficient asynchronous KF (AKF) heading estimation method proposed in our previous work [12] in this study(2)
The component of WiFi localization returns the localization results of using a specific WiFi localization algorithm, say KNN based fingerprint localization algorithm. However, when to trigger a WiFi scan for the purpose of localization is controlled by the other components of the fusion localization scheme, so as to avoid unnecessary energy-hungry WiFi scans(3)
The component of the formulation of energy-accuracy trade-off develops energy-accuracy trade-off strategies using FIS. The FIS is used to fulfill the mapping from the real-time coarse fusion localization error, termedEt, and the remaining energy of smartphones, termed Pt, to the running of energy-hungry WiFi scans based on fuzzy logic. Its output is further used in the trade-off strategies. As a result, the localization accuracy and energy consumption can be balanced against based on fuzzy rules without establishing precise localization accuracy and energy models(4)
The component of the distance-based fusion algorithm is to integrate WiFi localization results with PDR, so as further to improve the localization accuracy of the fusion localization scheme. It utilizes the relatively high localization accuracy of PDR to alleviate the impact of WiFi localization outliers on the overall localization accuracyFigure 1
Framework of the proposed fusion localization scheme.


## 4. Localization Error of Our Fusion Localization Scheme

The fusion localization errors comprise WiFi localization and PDR errors. In this section, the WiFi localization error is first introduced, and then the PDR error is investigated. On these grounds, we design a coarse localization error model of the fusion localization system and discuss various factors that affect the coarse fusion localization error.


### 4.1. WiFi Localization Error

According to [23–25], it can be concluded that the number of APs, the noise level of RSS measurements, the grid spacing of a radio map, and the path loss exponent in the LDPL model affect WiFi localization errors, thereby affecting the fusion localization error. But, these factors depend on either the system costs or environments, which are difficult to be arbitrarily adjusted given a specific localization system in a dedicated environment, especially in a real-time environment. First, excessive APs (more than 9) involved in localization and multiple repeated WiFi scans (for the purpose of reducing the noise level of RSS measurements) cannot significantly reduce the WiFi localization error, but cause the increase of energy consumption and localization delay [23, 24, 26–28]. Second, it is also unrealistic to shorten the grid size by temporarily adding some additional reference points due to labour-intensive and time-consuming construction of a radio map. Finally, the path-loss exponent is determined by surrounding environments and building types and cannot be adjusted manually [24, 28].Therefore, we consider to trigger once WiFi scan in each step. Moreover, as was commonly adopted in the literature [27], the WiFi localization error, termed Ewifi, is assumed to be normal with zero mean and variance of σ2, namely,
(1)Ewifi∼N0,σ2.


### 4.2. PDR Error

PDR errors mainly involve the errors of gait detection, step length, and heading. According to [12], the sampling frequencies of both the magnetometer and the accelerometer are reduced to be 15 Hz, while the sampling frequency of the gyroscope is still set to be 60 Hz in PDR, with the result that the adopted AKF heading estimation algorithm can achieve similar heading accuracy compared with using the same high sampling frequency for all IMU sensors at low costs in energy consumption. Hence, the impact of the low sampling frequency of the accelerometer on the gait detection, as well as the step length error and the heading error, is discussed. On this basis, we derive the mathematical expression of PDR error.


#### 4.2.1. Gait Detection Error

Among various gait detection algorithms, the peak detection method [29, 30], autocorrelation analysis method [31], zero-velocity update method [32], and finite state machine method [33] have relatively high and stable step-counting accuracy. Considering low computational complexity, we adopt the window-based peak acceleration method [30] for gait detection.In this method, vertical acceleration is adopted for gait detection, due to the fact that the vertical acceleration often incurs more significant changes than those in the horizontal plane when a pedestrian is walking; namely, that the vertical acceleration is closely related with walking, as was also pointed out in [34]. Thus, in order to obtain the vertical acceleration, define the measurement of the acceleration vector excluding gravity (i.e., linear accelerations returned by the linear acceleration sensor on the Android platform) as follows:
(2)a=ax,ay,az,where ax, ay, and az represent the accelerations in the three axis, respectively. In our experiments, a tester held a smartphone in front of his chest and right side up. Since the z-axis of the tester’s device coordinate system was opposite to the gravity in the experiments, we can approximate the vertical acceleration by az for use in step detection and step length estimation.Additionally, once the sampling frequencies of accelerometer is set to be more than 20 Hz, the step-counting accuracy of the step-detection method will be slightly improved [11] even resulting that the energy consumption of the method will rise. In fact, the fastest step frequency of a pedestrian can reach 2.5 Hz in real life [35]. Therefore, the gait can be detected correctly when the sampling frequency of the accelerometer is set to be more than 10 Hz according to the Nyquist-Shannon sampling theorem. As a result, the sampling frequency of 15 Hz is appropriate. Moreover, the acceleration measurement is not disturbed by external environments. Therefore, the step-counting accuracy of the method is also stable over time and does not vary with external environments. Consequently, we consider the gait detection error as a constant value.


#### 4.2.2. Step Length Error

A well-known empirical step length estimation approach, presented by Weinberg [36, 37], is based on the vertical acceleration as follows:
(3)L=β∗azmax−azmin1/4,where L represents the step length estimate, azmax and azmin represent the maximum and minimum vertical accelerations in a gait cycle, and β is the coefficient which can be calibrated using real step lengths.Additionally, people are more concerned about the total walking distance over a period of time instead of each step length in a localization application. Thus, we can conclude that the step length error is stable, and letting the sampling frequency of the accelerometer be 15 Hz does not significantly decrease the step-counting error. Correspondingly, we can approximate the estimated step length as the true step length.


#### 4.2.3. Heading Error

The heading is a key performance factor of PDR [6]. Although we have applied the AKF heading estimation method fusing the accelerometer, the gyroscope and the magnetometer to estimate a pedestrian’s heading, the errors from magnetometer still exist because of the interference in indoor environments.Differently, a gyroscope-based heading estimation method is relatively accurate in the short term, although drift errors occur over time. Thus, the heading change estimated from the gyroscope is considered as the true value of the heading change in two adjacent steps, and the difference of the heading change between the true value and the estimated value by the AKF method in these two adjacent steps is considered as a coarse heading estimation error. Accordingly, the coarse heading estimation error, termed byΔθt, can be expressed as follows:
(4)Δθt=Hkalmant−Hkalmant−1−Hgyrot−Hgyrot−1,where Hkalmant−1 and Hkalmant represent the AKF-based heading at the t−1-th and t-th steps, respectively, and Hgyrot−1 and Hgyrot represent the gyroscope-based heading at the t−1-th and t-th steps, respectively.


#### 4.2.4. PDR Error Formula

Assume thatt is the number of a pedestrian’s walking steps, Lt is the actual step length in the t-th step, Lt^ is the estimated step length in the t-th step, ΔLt is the step length error in the t-th step, θt is the actual heading in the t-th step, θt^ is the estimated heading in the t-th step, Δθt is the heading error in the t-th step, xt,yt is the actual position coordinate in the t-th step, and xt^,yt^ is the estimated position coordinate in the t-th step. Thus, we can obtain the following formulas:
(5)Lt^=Lt+ΔLt,(6)θt^=θt+Δθt,(7)xt=xt−1+Ltcosθt,(8)yt=yt−1+Ltsinθt,(9)xt^=xt−1+Lt^cosθt,^(10)yt^=yt−1+Lt^sinθt.^Defineet as the one-step error of PDR in the t-th step and Et as the cumulative error of PDR from the first step to the t-th step. Here, we use the square of the Euclidian distance between the true and estimated positions to represent et and Et, namely,
(11)et2=xt∧−xt2+yt∧−yt2,(12)Et2=e12+e22+e32+⋯+et2.After substituting Equations (5)–(10) into Equation (11), we can derive
(13)et2=Lt2^−2LLt^cosΔθt+Lt2.Further, by using the second-order Taylor polynomial to approximate thecos function in Equation (13) and ignoring the step length error to simplify Equation (13), we can derive
(14)et2≈Lt2^Δθt2.Finally, the cumulative error for PDR from the first step to the finalN-th step, denoted as Esum, can be expressed as follows:
(15)Esum2≈L12^Δθ12+L22^Δθ22+⋯+LN2^ΔθN2+N∗estepcount,where estepcount represents the gait detection error averaged to each step, which can be a constant. It can be seen from Equation (15) that, the cumulative PDR error is mainly determined by the heading error at each step, estimated step length, gait detection error, and total step count.


### 4.3. Fusion Localization Scheme Error

In our fusion localization system, running WiFi localization is dynamically controlled by scheduling WiFi scans. Moreover, during two consecutive WiFi scans in the short term, PDR results are regarded as the final fusion results because of the relatively high accuracy in such time interval for PDR. Hence, the total error of the fusion localization scheme, denoted asEfusion, can be expressed as follows:
(16)Efusion≈Ewifi+Esum.Consequently, we can conclude that the total localization error associated with the fusion localization scheme is mainly affected by the WiFi localization error, heading error, estimated step length, and the total number of steps. However, the fusion localization scheme error calculated by Equation (16) is uncertain or ambiguous and is the coarse error of the fusion localization scheme. Hence, the heading error, estimated step length, and the total number of steps are used to calculate the coarse error of the fusion localization scheme.


## 4.1. WiFi Localization Error

According to [23–25], it can be concluded that the number of APs, the noise level of RSS measurements, the grid spacing of a radio map, and the path loss exponent in the LDPL model affect WiFi localization errors, thereby affecting the fusion localization error. But, these factors depend on either the system costs or environments, which are difficult to be arbitrarily adjusted given a specific localization system in a dedicated environment, especially in a real-time environment. First, excessive APs (more than 9) involved in localization and multiple repeated WiFi scans (for the purpose of reducing the noise level of RSS measurements) cannot significantly reduce the WiFi localization error, but cause the increase of energy consumption and localization delay [23, 24, 26–28]. Second, it is also unrealistic to shorten the grid size by temporarily adding some additional reference points due to labour-intensive and time-consuming construction of a radio map. Finally, the path-loss exponent is determined by surrounding environments and building types and cannot be adjusted manually [24, 28].Therefore, we consider to trigger once WiFi scan in each step. Moreover, as was commonly adopted in the literature [27], the WiFi localization error, termed Ewifi, is assumed to be normal with zero mean and variance of σ2, namely,
(1)Ewifi∼N0,σ2.


## 4.2. PDR Error

PDR errors mainly involve the errors of gait detection, step length, and heading. According to [12], the sampling frequencies of both the magnetometer and the accelerometer are reduced to be 15 Hz, while the sampling frequency of the gyroscope is still set to be 60 Hz in PDR, with the result that the adopted AKF heading estimation algorithm can achieve similar heading accuracy compared with using the same high sampling frequency for all IMU sensors at low costs in energy consumption. Hence, the impact of the low sampling frequency of the accelerometer on the gait detection, as well as the step length error and the heading error, is discussed. On this basis, we derive the mathematical expression of PDR error.


### 4.2.1. Gait Detection Error

Among various gait detection algorithms, the peak detection method [29, 30], autocorrelation analysis method [31], zero-velocity update method [32], and finite state machine method [33] have relatively high and stable step-counting accuracy. Considering low computational complexity, we adopt the window-based peak acceleration method [30] for gait detection.In this method, vertical acceleration is adopted for gait detection, due to the fact that the vertical acceleration often incurs more significant changes than those in the horizontal plane when a pedestrian is walking; namely, that the vertical acceleration is closely related with walking, as was also pointed out in [34]. Thus, in order to obtain the vertical acceleration, define the measurement of the acceleration vector excluding gravity (i.e., linear accelerations returned by the linear acceleration sensor on the Android platform) as follows:
(2)a=ax,ay,az,where ax, ay, and az represent the accelerations in the three axis, respectively. In our experiments, a tester held a smartphone in front of his chest and right side up. Since the z-axis of the tester’s device coordinate system was opposite to the gravity in the experiments, we can approximate the vertical acceleration by az for use in step detection and step length estimation.Additionally, once the sampling frequencies of accelerometer is set to be more than 20 Hz, the step-counting accuracy of the step-detection method will be slightly improved [11] even resulting that the energy consumption of the method will rise. In fact, the fastest step frequency of a pedestrian can reach 2.5 Hz in real life [35]. Therefore, the gait can be detected correctly when the sampling frequency of the accelerometer is set to be more than 10 Hz according to the Nyquist-Shannon sampling theorem. As a result, the sampling frequency of 15 Hz is appropriate. Moreover, the acceleration measurement is not disturbed by external environments. Therefore, the step-counting accuracy of the method is also stable over time and does not vary with external environments. Consequently, we consider the gait detection error as a constant value.


### 4.2.2. Step Length Error

A well-known empirical step length estimation approach, presented by Weinberg [36, 37], is based on the vertical acceleration as follows:
(3)L=β∗azmax−azmin1/4,where L represents the step length estimate, azmax and azmin represent the maximum and minimum vertical accelerations in a gait cycle, and β is the coefficient which can be calibrated using real step lengths.Additionally, people are more concerned about the total walking distance over a period of time instead of each step length in a localization application. Thus, we can conclude that the step length error is stable, and letting the sampling frequency of the accelerometer be 15 Hz does not significantly decrease the step-counting error. Correspondingly, we can approximate the estimated step length as the true step length.


### 4.2.3. Heading Error

The heading is a key performance factor of PDR [6]. Although we have applied the AKF heading estimation method fusing the accelerometer, the gyroscope and the magnetometer to estimate a pedestrian’s heading, the errors from magnetometer still exist because of the interference in indoor environments.Differently, a gyroscope-based heading estimation method is relatively accurate in the short term, although drift errors occur over time. Thus, the heading change estimated from the gyroscope is considered as the true value of the heading change in two adjacent steps, and the difference of the heading change between the true value and the estimated value by the AKF method in these two adjacent steps is considered as a coarse heading estimation error. Accordingly, the coarse heading estimation error, termed byΔθt, can be expressed as follows:
(4)Δθt=Hkalmant−Hkalmant−1−Hgyrot−Hgyrot−1,where Hkalmant−1 and Hkalmant represent the AKF-based heading at the t−1-th and t-th steps, respectively, and Hgyrot−1 and Hgyrot represent the gyroscope-based heading at the t−1-th and t-th steps, respectively.


### 4.2.4. PDR Error Formula

Assume thatt is the number of a pedestrian’s walking steps, Lt is the actual step length in the t-th step, Lt^ is the estimated step length in the t-th step, ΔLt is the step length error in the t-th step, θt is the actual heading in the t-th step, θt^ is the estimated heading in the t-th step, Δθt is the heading error in the t-th step, xt,yt is the actual position coordinate in the t-th step, and xt^,yt^ is the estimated position coordinate in the t-th step. Thus, we can obtain the following formulas:
(5)Lt^=Lt+ΔLt,(6)θt^=θt+Δθt,(7)xt=xt−1+Ltcosθt,(8)yt=yt−1+Ltsinθt,(9)xt^=xt−1+Lt^cosθt,^(10)yt^=yt−1+Lt^sinθt.^Defineet as the one-step error of PDR in the t-th step and Et as the cumulative error of PDR from the first step to the t-th step. Here, we use the square of the Euclidian distance between the true and estimated positions to represent et and Et, namely,
(11)et2=xt∧−xt2+yt∧−yt2,(12)Et2=e12+e22+e32+⋯+et2.After substituting Equations (5)–(10) into Equation (11), we can derive
(13)et2=Lt2^−2LLt^cosΔθt+Lt2.Further, by using the second-order Taylor polynomial to approximate thecos function in Equation (13) and ignoring the step length error to simplify Equation (13), we can derive
(14)et2≈Lt2^Δθt2.Finally, the cumulative error for PDR from the first step to the finalN-th step, denoted as Esum, can be expressed as follows:
(15)Esum2≈L12^Δθ12+L22^Δθ22+⋯+LN2^ΔθN2+N∗estepcount,where estepcount represents the gait detection error averaged to each step, which can be a constant. It can be seen from Equation (15) that, the cumulative PDR error is mainly determined by the heading error at each step, estimated step length, gait detection error, and total step count.


## 4.2.1. Gait Detection Error

Among various gait detection algorithms, the peak detection method [29, 30], autocorrelation analysis method [31], zero-velocity update method [32], and finite state machine method [33] have relatively high and stable step-counting accuracy. Considering low computational complexity, we adopt the window-based peak acceleration method [30] for gait detection.In this method, vertical acceleration is adopted for gait detection, due to the fact that the vertical acceleration often incurs more significant changes than those in the horizontal plane when a pedestrian is walking; namely, that the vertical acceleration is closely related with walking, as was also pointed out in [34]. Thus, in order to obtain the vertical acceleration, define the measurement of the acceleration vector excluding gravity (i.e., linear accelerations returned by the linear acceleration sensor on the Android platform) as follows:
(2)a=ax,ay,az,where ax, ay, and az represent the accelerations in the three axis, respectively. In our experiments, a tester held a smartphone in front of his chest and right side up. Since the z-axis of the tester’s device coordinate system was opposite to the gravity in the experiments, we can approximate the vertical acceleration by az for use in step detection and step length estimation.Additionally, once the sampling frequencies of accelerometer is set to be more than 20 Hz, the step-counting accuracy of the step-detection method will be slightly improved [11] even resulting that the energy consumption of the method will rise. In fact, the fastest step frequency of a pedestrian can reach 2.5 Hz in real life [35]. Therefore, the gait can be detected correctly when the sampling frequency of the accelerometer is set to be more than 10 Hz according to the Nyquist-Shannon sampling theorem. As a result, the sampling frequency of 15 Hz is appropriate. Moreover, the acceleration measurement is not disturbed by external environments. Therefore, the step-counting accuracy of the method is also stable over time and does not vary with external environments. Consequently, we consider the gait detection error as a constant value.


## 4.2.2. Step Length Error

A well-known empirical step length estimation approach, presented by Weinberg [36, 37], is based on the vertical acceleration as follows:
(3)L=β∗azmax−azmin1/4,where L represents the step length estimate, azmax and azmin represent the maximum and minimum vertical accelerations in a gait cycle, and β is the coefficient which can be calibrated using real step lengths.Additionally, people are more concerned about the total walking distance over a period of time instead of each step length in a localization application. Thus, we can conclude that the step length error is stable, and letting the sampling frequency of the accelerometer be 15 Hz does not significantly decrease the step-counting error. Correspondingly, we can approximate the estimated step length as the true step length.


## 4.2.3. Heading Error

The heading is a key performance factor of PDR [6]. Although we have applied the AKF heading estimation method fusing the accelerometer, the gyroscope and the magnetometer to estimate a pedestrian’s heading, the errors from magnetometer still exist because of the interference in indoor environments.Differently, a gyroscope-based heading estimation method is relatively accurate in the short term, although drift errors occur over time. Thus, the heading change estimated from the gyroscope is considered as the true value of the heading change in two adjacent steps, and the difference of the heading change between the true value and the estimated value by the AKF method in these two adjacent steps is considered as a coarse heading estimation error. Accordingly, the coarse heading estimation error, termed byΔθt, can be expressed as follows:
(4)Δθt=Hkalmant−Hkalmant−1−Hgyrot−Hgyrot−1,where Hkalmant−1 and Hkalmant represent the AKF-based heading at the t−1-th and t-th steps, respectively, and Hgyrot−1 and Hgyrot represent the gyroscope-based heading at the t−1-th and t-th steps, respectively.


## 4.2.4. PDR Error Formula

Assume thatt is the number of a pedestrian’s walking steps, Lt is the actual step length in the t-th step, Lt^ is the estimated step length in the t-th step, ΔLt is the step length error in the t-th step, θt is the actual heading in the t-th step, θt^ is the estimated heading in the t-th step, Δθt is the heading error in the t-th step, xt,yt is the actual position coordinate in the t-th step, and xt^,yt^ is the estimated position coordinate in the t-th step. Thus, we can obtain the following formulas:
(5)Lt^=Lt+ΔLt,(6)θt^=θt+Δθt,(7)xt=xt−1+Ltcosθt,(8)yt=yt−1+Ltsinθt,(9)xt^=xt−1+Lt^cosθt,^(10)yt^=yt−1+Lt^sinθt.^Defineet as the one-step error of PDR in the t-th step and Et as the cumulative error of PDR from the first step to the t-th step. Here, we use the square of the Euclidian distance between the true and estimated positions to represent et and Et, namely,
(11)et2=xt∧−xt2+yt∧−yt2,(12)Et2=e12+e22+e32+⋯+et2.After substituting Equations (5)–(10) into Equation (11), we can derive
(13)et2=Lt2^−2LLt^cosΔθt+Lt2.Further, by using the second-order Taylor polynomial to approximate thecos function in Equation (13) and ignoring the step length error to simplify Equation (13), we can derive
(14)et2≈Lt2^Δθt2.Finally, the cumulative error for PDR from the first step to the finalN-th step, denoted as Esum, can be expressed as follows:
(15)Esum2≈L12^Δθ12+L22^Δθ22+⋯+LN2^ΔθN2+N∗estepcount,where estepcount represents the gait detection error averaged to each step, which can be a constant. It can be seen from Equation (15) that, the cumulative PDR error is mainly determined by the heading error at each step, estimated step length, gait detection error, and total step count.


## 4.3. Fusion Localization Scheme Error

In our fusion localization system, running WiFi localization is dynamically controlled by scheduling WiFi scans. Moreover, during two consecutive WiFi scans in the short term, PDR results are regarded as the final fusion results because of the relatively high accuracy in such time interval for PDR. Hence, the total error of the fusion localization scheme, denoted asEfusion, can be expressed as follows:
(16)Efusion≈Ewifi+Esum.Consequently, we can conclude that the total localization error associated with the fusion localization scheme is mainly affected by the WiFi localization error, heading error, estimated step length, and the total number of steps. However, the fusion localization scheme error calculated by Equation (16) is uncertain or ambiguous and is the coarse error of the fusion localization scheme. Hence, the heading error, estimated step length, and the total number of steps are used to calculate the coarse error of the fusion localization scheme.


## 5. Formulation of Energy-Accuracy Trade-off

In this section, we systematically describe the formulation of energy-accuracy trade-off. First, the energy consumption characteristics of the fusion system are discussed. Second, the FIS is introduced. Third, we demonstrate the specific trade-off strategies between accuracy and energy consumption in the fusion localization scheme. Finally, the distance-based fusion method is proposed.


### 5.1. Energy Consumption

The energy consumption of the system has mainly three fundamental sources: WiFi scans for localization, IMU sensors for PDR, and fusion localization algorithm. Generally, a WiFi adapter is an energy-hungry component, especially in its scan status. Moreover, its power in the scan status can be greater than the total power of the three IMU sensors of a smartphone [38]. For instance, the average current in the scan status could reach above 200 mA in our experiments, whereas that of the three IMU sensors was only 100 mA. In addition, since the IMU sensors should run all the time continuously in PDR [17], the PDR power can be assumed to be constant in the whole localization process. Consequently, the energy consumption of the fusion localization scheme, denoted as P, can be written as follows:
(17)P=k∗Pwifi+t∗Powerpdr+Pfusion+c,where k represents the total number of WiFi scans, Pwifi represents the average energy consumption of once WiFi scan, t represents the total running times of PDR, Powerpdr represents the average energy consumption of running once PDR, Pfusion represents the energy consumption of the fusion algorithm, and c is the unknown constant that needs to be calibrated.Nevertheless, modelling the energy consumptions of different mobile devices may not be an easy task because of various hardware and software. Due to the fact that smartphone manufacturers often do not publish the energy-related parameters of smartphone components, the energy consumption model obtained from experimental data can only be applied to a specific smartphone model, indicating that it is not applicable for all smartphones.It is intuitive that the energy consumption of a localization system evidently affects the remaining battery (energy) of the mobile device running this localization system, and often dominates the energy consumption of the mobile device when only the localization task is performed. In fact, people usually pay more attention to the battery life of their smartphones rather than that one application consumes more energy than the others. Several studies on the energy consumption of smartphones [38–40] have adopted the remaining energy as an indicator to reflect the endurance of applications. More importantly, the remaining energy of a mobile device can be easily obtained using the interface of the mobile operating system. Thus, it is a natural choice to alternatively utilize the remaining energy of the smartphone for measuring the energy consumption of the fusion localization scheme.In summary, though the total error of the fusion localization scheme can be coarsely evaluated using Equation (16), one can effectively suppress this error through appropriately managing the duty cycle of WiFi scans. To this end, by converting the coarse error of the fusion localization scheme and the corresponding remaining energy as fuzzy variables, FIS introduced in the following subsection is implemented to adaptively schedule energy-hungry WiFi scans, so as to fulfill energy-efficient localization fusion using WiFi and PDR.


### 5.2. FIS

A Mamdani inference system is used to develop the strategies of energy-accuracy trade-off.The procedures of designing the FIS are listed as follows.


#### 5.2.1. Choice of Input and Output Linguistic Variables

The input linguistic variables comprise the fusion localization scheme error and remaining energy. The main purpose of the FIS is to dynamically schedule WiFi scans, so as to balance the fusion localization scheme error against the remaining energy. Hence, we consider the output linguistic variable as the indicator of whether or not to run once WiFi scan in each step.


#### 5.2.2. Choice of Membership Functions for All Variables

There is no uniform standard for choosing a membership function’s shape. The trapezoidal function is often used as the membership function for input and output variables due to its low computations [41]. Since the fusion localization scheme error gradually increases with the number of steps and the remaining energy gradually decreases with time, dividing too many fuzzy subsets can increase the number of fuzzy rules, with the result that more energy is consumed. In addition, considering the adaptability for various localization accuracy requirements, the coarse error of the fusion localization scheme is normalized within the interval [0, 1] as follows:
(18)e=Efusion2−Ethreshold2Ethreshold2,where e represents the normalized fusion scheme error and Ethreshold2 represents the squared error threshold. Moreover, the remaining energy is essentially a ratio within the interval [0, 1]. Thus, combined with practical experiences, both two input variables are divided into three fuzzy subsets, as shown in Figures 2(a) and 2(b), and the output variable into four fuzzy subsets, as shown in Figure 2(c).Figure 2
Fuzzy variables of FIS. (a) Fusion localization scheme error. (b) Remaining energy. (c) Probability of WiFi scan. (d) Output surface of FIS (P: the probability of WiFi scan; E: the fusion localization scheme error; R: the remaining energy).
(a)(b)(c)(d)It can be noticed that the three fuzzy sets in relation to both the fusion localization scheme error and the remaining energy are defined as large, medium, and small errors and energy, respectively, with the corresponding labels of “H,” “M,” and “L.” The four fuzzy sets in relation to the output variable, i.e., the probability of whether or not to execute a WiFi scan, are defined as high, medium, low, and very low probabilities, respectively, with the corresponding labels of “H,” “M,” “L,” and “VL,” respectively. Figure2(d) depicts the dependency of the output on these inputs, which visually describes the relationship between the three fuzzy variables.


#### 5.2.3. Design of Fuzzy If-Then Rules

In our study, the trial-error approach is adopted to generate fuzzy rules. Considering the computation complexity, the following nine fuzzy rules in Table1 are carefully designed. Additionally, as can be seen, the connective relationship of AND for the two inputs in the fuzzy rules is utilized.Table 1
Fuzzy rules.
No.Fusion localization scheme errorConnectivesRemaining energyProbability of the WiFi scan1HANDHM2HANDML3HANDLVL4MANDHM5MANDMM6MANDLL7LANDHH8LANDMM9LANDLL


### 5.3. Formulation of Trade-off Strategies

On the basis of these fuzzy rules in Table1, we adopt the centroid defuzzification method to obtain a crisp output and leverage this output to formulate trade-off strategies. Specifically, once the output, which represents the probability of running one WiFi scan, is above a given threshold, or the fusion localization scheme error is greater than a given threshold at a step, the fusion system will perform the following processes in this step: informing the system to run once new WiFi scan, so as to obtain the latest WiFi localization result; resetting the fusion localization scheme error to 0 and combining the newly obtained WiFi localization result with PDR result by using the proposed distance-based fusion method (introduced in Section Distance-Based Fusion Method) to obtain the fusion result; then, it resets the initial location of PDR with this fusion result; otherwise, the system does not trigger a new WiFi scan at this step, and before triggering a new WiFi scan, the PDR results are used as the fusion results during the two consecutive WiFi scans, the initial location of which is the last fusion result using WiFi and PDR.


### 5.4. Distance-Based Fusion Method

To mitigate the WiFi localization error, a distance-based fusion method is developed as follows to integrate the latest WiFi localization result with the PDR result after a new WiFi scan is triggered,(19)Dfusion=1−W∗Dwifi+W∗Dpdr,where Dfusion represents the final fusion result, Dwifi represents the latest WiFi localization results, Dpdr represents the PDR result, and W represents the weight.As was mentioned above, WiFi localization results are stable in the long term, but incur severe outliers and PDR results are relatively accurate in the short term, but suffer from drift errors. Hence, PDR is leveraged to reduce the influence of the outliers confronted by WiFi localization results by definingW in Equation (20) as follows:
(20)W=1−absdwifi−dpdrdwifi+dpdr,where dwifi represents the distance between the latest WiFi localization result and the last fusion result fusing WiFi and PDR, and dpdr represents the distance between the PDR result and this fusion result.


## 5.1. Energy Consumption

The energy consumption of the system has mainly three fundamental sources: WiFi scans for localization, IMU sensors for PDR, and fusion localization algorithm. Generally, a WiFi adapter is an energy-hungry component, especially in its scan status. Moreover, its power in the scan status can be greater than the total power of the three IMU sensors of a smartphone [38]. For instance, the average current in the scan status could reach above 200 mA in our experiments, whereas that of the three IMU sensors was only 100 mA. In addition, since the IMU sensors should run all the time continuously in PDR [17], the PDR power can be assumed to be constant in the whole localization process. Consequently, the energy consumption of the fusion localization scheme, denoted as P, can be written as follows:
(17)P=k∗Pwifi+t∗Powerpdr+Pfusion+c,where k represents the total number of WiFi scans, Pwifi represents the average energy consumption of once WiFi scan, t represents the total running times of PDR, Powerpdr represents the average energy consumption of running once PDR, Pfusion represents the energy consumption of the fusion algorithm, and c is the unknown constant that needs to be calibrated.Nevertheless, modelling the energy consumptions of different mobile devices may not be an easy task because of various hardware and software. Due to the fact that smartphone manufacturers often do not publish the energy-related parameters of smartphone components, the energy consumption model obtained from experimental data can only be applied to a specific smartphone model, indicating that it is not applicable for all smartphones.It is intuitive that the energy consumption of a localization system evidently affects the remaining battery (energy) of the mobile device running this localization system, and often dominates the energy consumption of the mobile device when only the localization task is performed. In fact, people usually pay more attention to the battery life of their smartphones rather than that one application consumes more energy than the others. Several studies on the energy consumption of smartphones [38–40] have adopted the remaining energy as an indicator to reflect the endurance of applications. More importantly, the remaining energy of a mobile device can be easily obtained using the interface of the mobile operating system. Thus, it is a natural choice to alternatively utilize the remaining energy of the smartphone for measuring the energy consumption of the fusion localization scheme.In summary, though the total error of the fusion localization scheme can be coarsely evaluated using Equation (16), one can effectively suppress this error through appropriately managing the duty cycle of WiFi scans. To this end, by converting the coarse error of the fusion localization scheme and the corresponding remaining energy as fuzzy variables, FIS introduced in the following subsection is implemented to adaptively schedule energy-hungry WiFi scans, so as to fulfill energy-efficient localization fusion using WiFi and PDR.


## 5.2. FIS

A Mamdani inference system is used to develop the strategies of energy-accuracy trade-off.The procedures of designing the FIS are listed as follows.


### 5.2.1. Choice of Input and Output Linguistic Variables

The input linguistic variables comprise the fusion localization scheme error and remaining energy. The main purpose of the FIS is to dynamically schedule WiFi scans, so as to balance the fusion localization scheme error against the remaining energy. Hence, we consider the output linguistic variable as the indicator of whether or not to run once WiFi scan in each step.


### 5.2.2. Choice of Membership Functions for All Variables

There is no uniform standard for choosing a membership function’s shape. The trapezoidal function is often used as the membership function for input and output variables due to its low computations [41]. Since the fusion localization scheme error gradually increases with the number of steps and the remaining energy gradually decreases with time, dividing too many fuzzy subsets can increase the number of fuzzy rules, with the result that more energy is consumed. In addition, considering the adaptability for various localization accuracy requirements, the coarse error of the fusion localization scheme is normalized within the interval [0, 1] as follows:
(18)e=Efusion2−Ethreshold2Ethreshold2,where e represents the normalized fusion scheme error and Ethreshold2 represents the squared error threshold. Moreover, the remaining energy is essentially a ratio within the interval [0, 1]. Thus, combined with practical experiences, both two input variables are divided into three fuzzy subsets, as shown in Figures 2(a) and 2(b), and the output variable into four fuzzy subsets, as shown in Figure 2(c).Figure 2
Fuzzy variables of FIS. (a) Fusion localization scheme error. (b) Remaining energy. (c) Probability of WiFi scan. (d) Output surface of FIS (P: the probability of WiFi scan; E: the fusion localization scheme error; R: the remaining energy).
(a)(b)(c)(d)It can be noticed that the three fuzzy sets in relation to both the fusion localization scheme error and the remaining energy are defined as large, medium, and small errors and energy, respectively, with the corresponding labels of “H,” “M,” and “L.” The four fuzzy sets in relation to the output variable, i.e., the probability of whether or not to execute a WiFi scan, are defined as high, medium, low, and very low probabilities, respectively, with the corresponding labels of “H,” “M,” “L,” and “VL,” respectively. Figure2(d) depicts the dependency of the output on these inputs, which visually describes the relationship between the three fuzzy variables.


### 5.2.3. Design of Fuzzy If-Then Rules

In our study, the trial-error approach is adopted to generate fuzzy rules. Considering the computation complexity, the following nine fuzzy rules in Table1 are carefully designed. Additionally, as can be seen, the connective relationship of AND for the two inputs in the fuzzy rules is utilized.Table 1
Fuzzy rules.
No.Fusion localization scheme errorConnectivesRemaining energyProbability of the WiFi scan1HANDHM2HANDML3HANDLVL4MANDHM5MANDMM6MANDLL7LANDHH8LANDMM9LANDLL


## 5.2.1. Choice of Input and Output Linguistic Variables

The input linguistic variables comprise the fusion localization scheme error and remaining energy. The main purpose of the FIS is to dynamically schedule WiFi scans, so as to balance the fusion localization scheme error against the remaining energy. Hence, we consider the output linguistic variable as the indicator of whether or not to run once WiFi scan in each step.


## 5.2.2. Choice of Membership Functions for All Variables

There is no uniform standard for choosing a membership function’s shape. The trapezoidal function is often used as the membership function for input and output variables due to its low computations [41]. Since the fusion localization scheme error gradually increases with the number of steps and the remaining energy gradually decreases with time, dividing too many fuzzy subsets can increase the number of fuzzy rules, with the result that more energy is consumed. In addition, considering the adaptability for various localization accuracy requirements, the coarse error of the fusion localization scheme is normalized within the interval [0, 1] as follows:
(18)e=Efusion2−Ethreshold2Ethreshold2,where e represents the normalized fusion scheme error and Ethreshold2 represents the squared error threshold. Moreover, the remaining energy is essentially a ratio within the interval [0, 1]. Thus, combined with practical experiences, both two input variables are divided into three fuzzy subsets, as shown in Figures 2(a) and 2(b), and the output variable into four fuzzy subsets, as shown in Figure 2(c).Figure 2
Fuzzy variables of FIS. (a) Fusion localization scheme error. (b) Remaining energy. (c) Probability of WiFi scan. (d) Output surface of FIS (P: the probability of WiFi scan; E: the fusion localization scheme error; R: the remaining energy).
(a)(b)(c)(d)It can be noticed that the three fuzzy sets in relation to both the fusion localization scheme error and the remaining energy are defined as large, medium, and small errors and energy, respectively, with the corresponding labels of “H,” “M,” and “L.” The four fuzzy sets in relation to the output variable, i.e., the probability of whether or not to execute a WiFi scan, are defined as high, medium, low, and very low probabilities, respectively, with the corresponding labels of “H,” “M,” “L,” and “VL,” respectively. Figure2(d) depicts the dependency of the output on these inputs, which visually describes the relationship between the three fuzzy variables.


## 5.2.3. Design of Fuzzy If-Then Rules

In our study, the trial-error approach is adopted to generate fuzzy rules. Considering the computation complexity, the following nine fuzzy rules in Table1 are carefully designed. Additionally, as can be seen, the connective relationship of AND for the two inputs in the fuzzy rules is utilized.Table 1
Fuzzy rules.
No.Fusion localization scheme errorConnectivesRemaining energyProbability of the WiFi scan1HANDHM2HANDML3HANDLVL4MANDHM5MANDMM6MANDLL7LANDHH8LANDMM9LANDLL


## 5.3. Formulation of Trade-off Strategies

On the basis of these fuzzy rules in Table1, we adopt the centroid defuzzification method to obtain a crisp output and leverage this output to formulate trade-off strategies. Specifically, once the output, which represents the probability of running one WiFi scan, is above a given threshold, or the fusion localization scheme error is greater than a given threshold at a step, the fusion system will perform the following processes in this step: informing the system to run once new WiFi scan, so as to obtain the latest WiFi localization result; resetting the fusion localization scheme error to 0 and combining the newly obtained WiFi localization result with PDR result by using the proposed distance-based fusion method (introduced in Section Distance-Based Fusion Method) to obtain the fusion result; then, it resets the initial location of PDR with this fusion result; otherwise, the system does not trigger a new WiFi scan at this step, and before triggering a new WiFi scan, the PDR results are used as the fusion results during the two consecutive WiFi scans, the initial location of which is the last fusion result using WiFi and PDR.


## 5.4. Distance-Based Fusion Method

To mitigate the WiFi localization error, a distance-based fusion method is developed as follows to integrate the latest WiFi localization result with the PDR result after a new WiFi scan is triggered,(19)Dfusion=1−W∗Dwifi+W∗Dpdr,where Dfusion represents the final fusion result, Dwifi represents the latest WiFi localization results, Dpdr represents the PDR result, and W represents the weight.As was mentioned above, WiFi localization results are stable in the long term, but incur severe outliers and PDR results are relatively accurate in the short term, but suffer from drift errors. Hence, PDR is leveraged to reduce the influence of the outliers confronted by WiFi localization results by definingW in Equation (20) as follows:
(20)W=1−absdwifi−dpdrdwifi+dpdr,where dwifi represents the distance between the latest WiFi localization result and the last fusion result fusing WiFi and PDR, and dpdr represents the distance between the PDR result and this fusion result.


## 6. WiFi-Assisted Heading Estimation

If the time interval between two adjacent WiFi scans is relatively long, the fusion results during this interval, which are determined by PDR results, will gradually incur obvious errors due to PDR drift errors. Thus, the WiFi-assisted heading estimation method proposed in our previous work [42] is used to calibrate the heading estimated by IMU sensors, so as to further improve the accuracy of the fusion system.We have known that a pedestrian’s WiFi localization trajectory can show an obvious straight-going trend when walking in a straight direction [43], and a gyroscope can accurately measure the rotational movement of objects in a short period. Hence, we adopt the cumulative angular velocity in each step to recognize a pedestrian’s movement (e.g., straightforward or turning) [44], so as to identify the straight-going path. The judgment condition of the turning is given by
(21)Gyrok∗Gyrok−1>0andabsGyrok>Thres,where Gyrok denotes the cumulative angular rate in the k-th step, Gyrok−1 denotes the cumulative angular rate from the gyroscope in the k−1-th step, and Thres denotes the threshold. Thus, a pedestrian’s trajectory can be segmented into several straight paths by turnings.Then, the direction of a straight path from the segmented WiFi localization trajectory is used to calibrate a pedestrian’s heading. Specifically, we propose to use the least-squares linear regression method to fit WiFi localization results. The slope of the fitted straight line represents the direction of a straight path, which can be converted into the angle representing the pedestrian’s heading by the arctan2 function. When the minimum number of corresponding WiFi localization results in a straight path is not satisfied, the heading is alternatively estimated by the AKF heading estimation method.Finally, the obtained angle value is considered as the calibrated heading in the corresponding straight path, while the heading at the turning step is calculated by using the calibrated heading in the last straight path plus the heading change estimated from the gyroscope.


## 7. Experimental Results and Discussion

In this section, we first introduce the whole experimental scheme, then discuss and analyze the experimental results to evaluate the effectiveness of the proposed methods using extensive real experiments.


### 7.1. Experimental Scheme

Our experiments were performed on the third floor of the library of Inner Mongolia University of Science and Technology, Baotou, China.The experimental field is 73 m in length and 33.5 m in width and covers a total area of approximately 2445 m2, as is shown in Figure 3. To record the location of a pedestrian, we define a customized coordinate system for this experimental field, the origin of which is set at the specified point marked with a black solid dot in Figure 3. The positive half of the x-axis of the coordinate system coincides with the true north of the library, and the positive half of its y-axis coincides with the west of the library. Thus, a pedestrian’s heading is 0 when walking toward the north, and −π toward the west.Figure 3
Floor plan of the experimental field.In addition, to build the radio map, location fingerprints were sampled at 545 reference points in the experimental area with a grid space of 1 m. The Google Nexus 6 smartphone was used in all experiments and its built-in battery fuel gauge (Maxim MAX17050) was used to measure energy consumption for the fusion localization system [45].To evaluate the performance of the proposed methods, we designed the following experimental paths. First, the tester held the smartphone in front of his chest and right side up. Then, he started walking at normal speed (i.e., 0.8 s/step) from the start point (4.48, 0.9) along the rectangular path and passing through (4.48, 0.9), (71.54, 0.9), (71.54, 34.1), and (4.48, 34.1) marked with four red stars in Figure3. Obviously, the initial heading of the tester was 0. The tester walked with the same step length at each step so as to obtain the ground truths in the custom coordinate system. In order to validate the proposed methods, the tester repeated each experiment three times along the same path.


### 7.2. Experiments of Gait Detection Error

Three gait detection experiments were performed with the accelerometer sampling frequencies of 10, 15, and 60 Hz. Table2 shows the summarized results of the three gait detection methods.Table 2
The accuracy of step counting at different sampling frequencies.
No.MethodSampling frequencies (Hz)Actual countsEstimated countsErrorsError rates (%)1Peak detection10272261114.02Peak detection10274262124.43Peak detection10274260145.14Peak detection1527326941.55Peak detection1527426862.26Peak detection1527427041.57Peak detection6027226662.28Peak detection6027426951.89Peak detection6027427400.010Autocorrelation10274263114.011Autocorrelation1027226393.312Autocorrelation10274261134.713Autocorrelation1527327031.114Autocorrelation1527427220.715Autocorrelation1527227110.416Autocorrelation6027427131.117Autocorrelation6027327210.418Autocorrelation6027427310.419Zero-velocity update10273263114.020Zero-velocity update10273263103.721Zero-velocity update10274262124.022Zero-velocity update1527227020.723Zero-velocity update1527327120.724Zero-velocity update1527427220.725Zero-velocity update6027227200.026Zero-velocity update6027427310.427Zero-velocity update6027327300.0As is shown in Table2, the maximum error rate of the peak detection method can be decreased from 5.1% to 2.2% and can no longer be significantly reduced when the sampling frequency is above 10 Hz. The other two methods also show similar characteristics to the peak detection method. However, the computational load at the sampling frequency of 60 Hz is nearly four times that at the sampling frequency of 15 Hz. Thus, from the perspective of energy efficiency, letting the sampling frequency be 15 Hz is appropriate. Additionally, nine repeated experimental results in total show that the adopted algorithm can be relatively stable and does not change over time. Hence, the step-counting error of the adopted gait detection algorithm can be considered as a constant value.


### 7.3. Experiments of Step Length Error

When performing the gait detection experiments, we ensured that the tester had the same length (0.7 m) in each step, so as to evaluate these experiments. Meanwhile, the step length is calculated in these experiments.Table3 shows that the means and variances of the step length estimates with different sampling frequencies appear to be almost the same due to the calibration of the proper value of the coefficient β. Furthermore, the means of the step length estimates are almost equal to the true value, which confirms again that the influence of the sampling frequency on the step length can be ignored by calibrating β. Accordingly, we can approximate the true step length by Equation (3).Table 3
The accuracy of step length estimates at different sampling frequencies.
No.Sampling frequencies (Hz)βMeans (m)Variances1150.5050.7010.00172200.5050.6950.00163300.4950.6970.00134400.4900.7190.00175500.4800.7180.00166600.4750.7060.0014


### 7.4. Experiments of Energy-Efficient Heading Estimation

In order to verify the performance of the energy-efficient heading estimation method, i.e., AKF, the standard KF-based heading estimation method in [43] is implemented with the sampling frequencies of 15 and 60 Hz, respectively, for comparison.Figure4 shows the cumulative distribution functions (CDFs) of the heading errors in the three cases, i.e., KF with 15 Hz sampling frequency (the green dashed curve), KF with 60 Hz sampling frequency (the red solid curve), and AKF with 15 Hz accelerometer and magnetometer sampling frequencies and 60 Hz gyroscope sampling frequency (the blue dash-dotted curve). It can be seen that a higher sampling frequency of IMU sensors can improve the heading accuracy in the case of KF, but AKF is able to achieve almost the same accuracy as KF with the sampling frequency of 60 Hz, which confirms the effectiveness of AKF. In other words, with AKF, the sampling frequency of the accelerometer and magnetometer is reduced to 1/4 of that of the gyroscope, and the computational load is reduced accordingly, but the accuracy of the heading estimation does not significantly decrease.Figure 4
CDF of the error of the heading estimation methods at different sampling frequencies.Figure5 shows the energy consumption of these heading methods after 256 s. As can be seen, the energy consumption of using KF increases with the sampling frequency, but AKF consumes less energy by 12.9% than KF with the sampling frequency of 60 Hz and almost the same energy as KF with the sampling frequency of 15 Hz. Thus, the adopted AKF-based heading estimation method can reduce energy consumption without significantly sacrificing the heading accuracy by asynchronous sampling frequencies of IMU sensors.Figure 5
Energy consumptions of the heading estimation methods at different sampling frequencies.


### 7.5. Experiments of Energy-Accuracy Trade-off

In this subsection, the performance of the proposed trade-off strategies is evaluated with respect to different combinations of the error threshold and the remaining energy of smartphones.


#### 7.5.1. The Error Threshold of 1.5 and the Power Level of 100%

The fusion localization system was set to be 1.5, and the experimental smartphone was fully charged to 100%. Then, the tester walked along the predefined path, resulting in a total of 264 steps, whereas the adopted gait detection method counted 261 steps.As shown in Figure6, the smartphone has sufficient battery energy in the whole localization process; accordingly, its normalized remaining energy, represented by the blue solid line, is always equal to 1 during this process; meanwhile, the error threshold is relatively high. Therefore, the fusion localization scheme actively triggers a new WiFi scan to ensure the accuracy requirement. It can be seen from Figure 7 that the outputs of the FIS in 35 steps out of 261 steps are above the threshold of 0.6, indicating that the fusion localization scheme decides to invoke once new WiFi scan in each of 35 steps. As a result, as shown in Figure 6, the normalized coarse errors of the fusion system do not reach 1, indicating that the fusion localization scheme always actively triggers a new WiFi scan to ensure localization accuracy on account of the sufficient remaining energy, resulting with resetting the fusion localization error to 0.Figure 6
Inputs of FIS.Figure 7
Outputs of FIS.Figure8 shows the final fusion localization results. In each step, the fusion localization scheme trades off localization accuracy against energy consumption based on the output of the FIS. Specifically, once a WiFi scan is invoked in a step, even if the coarse error of the fusion system has not reached the error threshold of 1.5, the fusion localization scheme actively performs once new WiFi scan due to the abundant battery energy. After that, the distance-based fusion method is employed to fuse the newly obtained WiFi localization result with the PDR result, so as to obtain the newly fusion result, which is also the initial position of PDR from now on (marked by red asterisks in Figure 8).Figure 8
Trajectory of the localization fusion results.Furthermore, the coarse error of the fusion localization system is set to be 0, and the initial position of PDR is updated with the newly obtained fusion localization result. Prior to the next WiFi scan or the next WiFi localization, the scheme simply returns the PDR results as the fusion localization result (marked by the blue circle in Figure8). Thus, the fusion localization scheme applies the FIS to dynamically schedule the energy-hungry WiFi scan in the whole localization process according to the remaining energy and the coarse fusion localization error.Figure9 depicts influence of the distance-based fusion method. Notably, the proposed distance-based fusion method is executed in 35 fusion locations. The local enlarged image in Figure 9 shows the details of the first weight-fusion location. In the first point, the Euclidean distance between the WiFi result and the last fusion result is 3.12 m, and the Euclidean distance between the PDR result and the last fusion result is 8.44 m. Because of relatively high accuracy for PDR in the short term and the outliers of WiFi localization, we believe that PDR is relatively more accurate than WiFi localization in the short term. Hence, the fusion weight is calculated as 0.55 by using Equation (20). Consequently, the first fusion location is almost in the middle of the WiFi localization location and the PDR location. Differently, the sixth fusion location in Figure 9 almost overlaps the WiFi localization location because of the more accurate WiFi localization than PDR. Hence, the method can weigh the accuracy of the WiFi localization result against the PDR result, so as to achieve a good fusion localization result.Figure 9
Comparison of the fusion, PDR, and WiFi results.Figure10 depicts the error comparisons of different localization methods. The PDR errors gradually increase from 0 to 18.31 m, indicating that PDR exits drift errors over time. The WiFi localization error in the 83rd step is 0.2 m and can increase to 9.1 m in the 76th step, but the maximum error of WiFi localization does not exceed 10 m. This shows that WiFi localization errors remain relatively stable in the long term, but exist outliers. However, our proposed fuzzy logic-based fusion method (marked by “FL”) not only eliminates the drift error of PDR and suppresses the instability of WiFi localization but also obtains almost the same localization accuracy as the complementary filter fusion method (marked by “CF”). Furthermore, with the aid of the calibrated heading estimates, the WiFi-assisted PDR performs not only better than PDR, but also better than all the other methods because the true initial location is used.Figure 10
Localization errors of different localization methods.The CDFs of the errors of these localization methods in Figure11 also show similar characteristics. With an increase in the CDF value, the PDR error keeps increasing, up to 20 m, whereas the maximum value of the WiFi error is just 7 m. It is noted that the blue solid curve and the black dash-dot curve in Figure 11 almost overlap, which again verifies that our proposed fusion scheme obtains similar localization accuracy as the complementary filter fusion method.Figure 11
CDF of the errors of different localization methods.Nevertheless, the energy consumption of it is just 38.02% of that of the complementary filter fusion method, as shown in Figure12. The complementary filter fusion method consumes the most energy among these localization methods, whereas PDR consumes the least energy. WiFi fingerprint localization consumes more energy than PDR. Although WiFi scan is energy-hungry, the proposed fusion localization scheme can achieve almost the same localization accuracy as the complementary filter fusion method but consumes little energy. Therefore, the proposed fusion scheme by using the FIS can dynamically schedule WiFi scans to achieve energy-efficient fusion localization.Figure 12
Energy consumption of different localization methods.


#### 7.5.2. The Error Threshold between 0.5 and 4.0 and the Power Level between 10% and 100%

When the error threshold of the fusion localization system was set between 0.5 and 4.0 and the power level was set between 10% and 100%, the experimental results with different parameter combinations are shown in Figures13–15.Figure 13
WiFi scan counts of the fusion localization scheme with different combinations.Figure 14
Mean errors of the fusion localization scheme with different combinations.Figure 15
Energy consumption of the fusion localization scheme with different combinations.As shown in Figure13, the power level is set to be 10%, which means that the smartphone has relatively low remaining energy, so the trade-off strategies formulated based on fuzzy rules are designed to trigger as few energy-hungry WiFi scans as possible to ensure that the fusion localization scheme error is below the given error threshold (i.e., 0.5, 2.0, and 4.0). In other words, the fusion localization scheme does not decide to trigger a new WiFi scan until the fusion localization scheme error is close to the error threshold. As a result, it can be seen from Figure 14 that the mean error of the fusion localization scheme is higher than that of the fusion localization scheme with the power level of 100%. To some extent, the fusion localization system scheme sacrifices localization accuracy to extend the smartphone’s battery life. In contrary, the power level is set to be 100%, which means that the smartphone has sufficient remaining energy, so the fusion localization scheme actively decides to trigger more WiFi scans to ensure the localization accuracy before the error of the fusion system increases to the given error threshold. As a result, as shown in Figure 13, the count of triggered WiFi scans of the fusion localization scheme is more than twice that of the fusion localization scheme with the power level of 10%. Accordingly, compared with the fusion localization scheme with the power level of 10%, the fusion localization scheme achieves lower error, as shown in Figure 14. Furthermore, it can be seen from Figures 13 and 14 that in the fusion localization schemes with different parameter combinations, the higher the error threshold, the higher the mean error of the fusion localization scheme, and the fewer the WiFi scans are triggered.Additionally, once the power level is set to be above 40%, as shown in Figure14, the mean error of the fusion localization scheme no longer can be decreased accordingly. This is because the fusion localization scheme error has reached the accuracy requirement and extra WiFi scans need not to be triggered.Figure15 depicts the energy consumption of the fusion localization scheme with the different combinations of the error threshold and the power level. The energy consumption increases accordingly with the increase of triggered WiFi scans. Furthermore, the lower the error threshold, the higher the energy consumption for smartphones. Consequently, it can be concluded that by using the FIS based on fuzzy logic, the fusion localization scheme can dynamically trigger energy-hungry WiFi scans to balance the localization accuracy against energy consumption, so as to achieve energy-adaptive localization. The input linguistic variables comprise the fusion localization scheme error and remaining energy. The main purpose of the FIS is to dynamically schedule WiFi scans, so as to balance the fusion localization scheme error against the remaining energy. Hence, we consider the output linguistic variable as the indicator of whether or not to run once WiFi scan in each step.


### 7.6. Experiments of WiFi-Assisted Heading Estimation

As is shown in Figure16, the cumulative angular rate from the gyroscope in steps 88-91, steps 131-133, step 216, and steps 218-219 (enclosed by blue rectangle boxes) are above the threshold of 10 radians. Therefore, it can be judged that the pedestrian is turning in these steps according to Equation (21). As a result, the whole walking trajectory can be split into four straight paths: steps 1-87, 92-130, 134-215, and 220-261.Figure 16
Accumulated gyroscope value.Accordingly, as shown in Figure17, with the help of the calibrated heading by using the straight trajectories of the WiFi localization, the heading errors on the straight paths from steps 1 to 87 and from steps 134 to 215 are almost equal to 0. However, since the number of the WiFi localization results in the straight paths from steps 92 to 130 and steps 220 to 261 does not satisfy the minimum number of the linear fitting, the heading in these paths cannot be calibrated and is still estimated by the AKF heading estimation method. While the heading in turning steps can be estimated by using the calibrated heading of the last straight path as the initial heading plus the heading change from gyroscope in each step. As a result, as shown in Figure 17, the pedestrian’s heading errors from steps 88 to 91 and from steps 131 to 133 are lower than that from the same steps due to the relatively high-heading estimation accuracy from gyroscope in the short term.Figure 17
Comparison of heading errors.Thus, the accuracy of the heading estimation is improved by using WiFi localization. As shown in Figure18, when the error is within 2.65 m, the error CDF of the standard KF heading estimation method is only 0.11, whereas the error CDF of the calibrated heading error can increase to 1. The PDR errors in Figure 19 again depict that the adopting WiFi-assisted heading estimation method can reduce the PDR error. Consequently, as is shown in Figure 10, the drift errors of PDR between the two adjacent WiFi localizations can be eliminated or reduced.Figure 18
CDF of heading errors.Figure 19
PDR errors.


## 7.1. Experimental Scheme

Our experiments were performed on the third floor of the library of Inner Mongolia University of Science and Technology, Baotou, China.The experimental field is 73 m in length and 33.5 m in width and covers a total area of approximately 2445 m2, as is shown in Figure 3. To record the location of a pedestrian, we define a customized coordinate system for this experimental field, the origin of which is set at the specified point marked with a black solid dot in Figure 3. The positive half of the x-axis of the coordinate system coincides with the true north of the library, and the positive half of its y-axis coincides with the west of the library. Thus, a pedestrian’s heading is 0 when walking toward the north, and −π toward the west.Figure 3
Floor plan of the experimental field.In addition, to build the radio map, location fingerprints were sampled at 545 reference points in the experimental area with a grid space of 1 m. The Google Nexus 6 smartphone was used in all experiments and its built-in battery fuel gauge (Maxim MAX17050) was used to measure energy consumption for the fusion localization system [45].To evaluate the performance of the proposed methods, we designed the following experimental paths. First, the tester held the smartphone in front of his chest and right side up. Then, he started walking at normal speed (i.e., 0.8 s/step) from the start point (4.48, 0.9) along the rectangular path and passing through (4.48, 0.9), (71.54, 0.9), (71.54, 34.1), and (4.48, 34.1) marked with four red stars in Figure3. Obviously, the initial heading of the tester was 0. The tester walked with the same step length at each step so as to obtain the ground truths in the custom coordinate system. In order to validate the proposed methods, the tester repeated each experiment three times along the same path.


## 7.2. Experiments of Gait Detection Error

Three gait detection experiments were performed with the accelerometer sampling frequencies of 10, 15, and 60 Hz. Table2 shows the summarized results of the three gait detection methods.Table 2
The accuracy of step counting at different sampling frequencies.
No.MethodSampling frequencies (Hz)Actual countsEstimated countsErrorsError rates (%)1Peak detection10272261114.02Peak detection10274262124.43Peak detection10274260145.14Peak detection1527326941.55Peak detection1527426862.26Peak detection1527427041.57Peak detection6027226662.28Peak detection6027426951.89Peak detection6027427400.010Autocorrelation10274263114.011Autocorrelation1027226393.312Autocorrelation10274261134.713Autocorrelation1527327031.114Autocorrelation1527427220.715Autocorrelation1527227110.416Autocorrelation6027427131.117Autocorrelation6027327210.418Autocorrelation6027427310.419Zero-velocity update10273263114.020Zero-velocity update10273263103.721Zero-velocity update10274262124.022Zero-velocity update1527227020.723Zero-velocity update1527327120.724Zero-velocity update1527427220.725Zero-velocity update6027227200.026Zero-velocity update6027427310.427Zero-velocity update6027327300.0As is shown in Table2, the maximum error rate of the peak detection method can be decreased from 5.1% to 2.2% and can no longer be significantly reduced when the sampling frequency is above 10 Hz. The other two methods also show similar characteristics to the peak detection method. However, the computational load at the sampling frequency of 60 Hz is nearly four times that at the sampling frequency of 15 Hz. Thus, from the perspective of energy efficiency, letting the sampling frequency be 15 Hz is appropriate. Additionally, nine repeated experimental results in total show that the adopted algorithm can be relatively stable and does not change over time. Hence, the step-counting error of the adopted gait detection algorithm can be considered as a constant value.


## 7.3. Experiments of Step Length Error

When performing the gait detection experiments, we ensured that the tester had the same length (0.7 m) in each step, so as to evaluate these experiments. Meanwhile, the step length is calculated in these experiments.Table3 shows that the means and variances of the step length estimates with different sampling frequencies appear to be almost the same due to the calibration of the proper value of the coefficient β. Furthermore, the means of the step length estimates are almost equal to the true value, which confirms again that the influence of the sampling frequency on the step length can be ignored by calibrating β. Accordingly, we can approximate the true step length by Equation (3).Table 3
The accuracy of step length estimates at different sampling frequencies.
No.Sampling frequencies (Hz)βMeans (m)Variances1150.5050.7010.00172200.5050.6950.00163300.4950.6970.00134400.4900.7190.00175500.4800.7180.00166600.4750.7060.0014


## 7.4. Experiments of Energy-Efficient Heading Estimation

In order to verify the performance of the energy-efficient heading estimation method, i.e., AKF, the standard KF-based heading estimation method in [43] is implemented with the sampling frequencies of 15 and 60 Hz, respectively, for comparison.Figure4 shows the cumulative distribution functions (CDFs) of the heading errors in the three cases, i.e., KF with 15 Hz sampling frequency (the green dashed curve), KF with 60 Hz sampling frequency (the red solid curve), and AKF with 15 Hz accelerometer and magnetometer sampling frequencies and 60 Hz gyroscope sampling frequency (the blue dash-dotted curve). It can be seen that a higher sampling frequency of IMU sensors can improve the heading accuracy in the case of KF, but AKF is able to achieve almost the same accuracy as KF with the sampling frequency of 60 Hz, which confirms the effectiveness of AKF. In other words, with AKF, the sampling frequency of the accelerometer and magnetometer is reduced to 1/4 of that of the gyroscope, and the computational load is reduced accordingly, but the accuracy of the heading estimation does not significantly decrease.Figure 4
CDF of the error of the heading estimation methods at different sampling frequencies.Figure5 shows the energy consumption of these heading methods after 256 s. As can be seen, the energy consumption of using KF increases with the sampling frequency, but AKF consumes less energy by 12.9% than KF with the sampling frequency of 60 Hz and almost the same energy as KF with the sampling frequency of 15 Hz. Thus, the adopted AKF-based heading estimation method can reduce energy consumption without significantly sacrificing the heading accuracy by asynchronous sampling frequencies of IMU sensors.Figure 5
Energy consumptions of the heading estimation methods at different sampling frequencies.


## 7.5. Experiments of Energy-Accuracy Trade-off

In this subsection, the performance of the proposed trade-off strategies is evaluated with respect to different combinations of the error threshold and the remaining energy of smartphones.


### 7.5.1. The Error Threshold of 1.5 and the Power Level of 100%

The fusion localization system was set to be 1.5, and the experimental smartphone was fully charged to 100%. Then, the tester walked along the predefined path, resulting in a total of 264 steps, whereas the adopted gait detection method counted 261 steps.As shown in Figure6, the smartphone has sufficient battery energy in the whole localization process; accordingly, its normalized remaining energy, represented by the blue solid line, is always equal to 1 during this process; meanwhile, the error threshold is relatively high. Therefore, the fusion localization scheme actively triggers a new WiFi scan to ensure the accuracy requirement. It can be seen from Figure 7 that the outputs of the FIS in 35 steps out of 261 steps are above the threshold of 0.6, indicating that the fusion localization scheme decides to invoke once new WiFi scan in each of 35 steps. As a result, as shown in Figure 6, the normalized coarse errors of the fusion system do not reach 1, indicating that the fusion localization scheme always actively triggers a new WiFi scan to ensure localization accuracy on account of the sufficient remaining energy, resulting with resetting the fusion localization error to 0.Figure 6
Inputs of FIS.Figure 7
Outputs of FIS.Figure8 shows the final fusion localization results. In each step, the fusion localization scheme trades off localization accuracy against energy consumption based on the output of the FIS. Specifically, once a WiFi scan is invoked in a step, even if the coarse error of the fusion system has not reached the error threshold of 1.5, the fusion localization scheme actively performs once new WiFi scan due to the abundant battery energy. After that, the distance-based fusion method is employed to fuse the newly obtained WiFi localization result with the PDR result, so as to obtain the newly fusion result, which is also the initial position of PDR from now on (marked by red asterisks in Figure 8).Figure 8
Trajectory of the localization fusion results.Furthermore, the coarse error of the fusion localization system is set to be 0, and the initial position of PDR is updated with the newly obtained fusion localization result. Prior to the next WiFi scan or the next WiFi localization, the scheme simply returns the PDR results as the fusion localization result (marked by the blue circle in Figure8). Thus, the fusion localization scheme applies the FIS to dynamically schedule the energy-hungry WiFi scan in the whole localization process according to the remaining energy and the coarse fusion localization error.Figure9 depicts influence of the distance-based fusion method. Notably, the proposed distance-based fusion method is executed in 35 fusion locations. The local enlarged image in Figure 9 shows the details of the first weight-fusion location. In the first point, the Euclidean distance between the WiFi result and the last fusion result is 3.12 m, and the Euclidean distance between the PDR result and the last fusion result is 8.44 m. Because of relatively high accuracy for PDR in the short term and the outliers of WiFi localization, we believe that PDR is relatively more accurate than WiFi localization in the short term. Hence, the fusion weight is calculated as 0.55 by using Equation (20). Consequently, the first fusion location is almost in the middle of the WiFi localization location and the PDR location. Differently, the sixth fusion location in Figure 9 almost overlaps the WiFi localization location because of the more accurate WiFi localization than PDR. Hence, the method can weigh the accuracy of the WiFi localization result against the PDR result, so as to achieve a good fusion localization result.Figure 9
Comparison of the fusion, PDR, and WiFi results.Figure10 depicts the error comparisons of different localization methods. The PDR errors gradually increase from 0 to 18.31 m, indicating that PDR exits drift errors over time. The WiFi localization error in the 83rd step is 0.2 m and can increase to 9.1 m in the 76th step, but the maximum error of WiFi localization does not exceed 10 m. This shows that WiFi localization errors remain relatively stable in the long term, but exist outliers. However, our proposed fuzzy logic-based fusion method (marked by “FL”) not only eliminates the drift error of PDR and suppresses the instability of WiFi localization but also obtains almost the same localization accuracy as the complementary filter fusion method (marked by “CF”). Furthermore, with the aid of the calibrated heading estimates, the WiFi-assisted PDR performs not only better than PDR, but also better than all the other methods because the true initial location is used.Figure 10
Localization errors of different localization methods.The CDFs of the errors of these localization methods in Figure11 also show similar characteristics. With an increase in the CDF value, the PDR error keeps increasing, up to 20 m, whereas the maximum value of the WiFi error is just 7 m. It is noted that the blue solid curve and the black dash-dot curve in Figure 11 almost overlap, which again verifies that our proposed fusion scheme obtains similar localization accuracy as the complementary filter fusion method.Figure 11
CDF of the errors of different localization methods.Nevertheless, the energy consumption of it is just 38.02% of that of the complementary filter fusion method, as shown in Figure12. The complementary filter fusion method consumes the most energy among these localization methods, whereas PDR consumes the least energy. WiFi fingerprint localization consumes more energy than PDR. Although WiFi scan is energy-hungry, the proposed fusion localization scheme can achieve almost the same localization accuracy as the complementary filter fusion method but consumes little energy. Therefore, the proposed fusion scheme by using the FIS can dynamically schedule WiFi scans to achieve energy-efficient fusion localization.Figure 12
Energy consumption of different localization methods.


### 7.5.2. The Error Threshold between 0.5 and 4.0 and the Power Level between 10% and 100%

When the error threshold of the fusion localization system was set between 0.5 and 4.0 and the power level was set between 10% and 100%, the experimental results with different parameter combinations are shown in Figures13–15.Figure 13
WiFi scan counts of the fusion localization scheme with different combinations.Figure 14
Mean errors of the fusion localization scheme with different combinations.Figure 15
Energy consumption of the fusion localization scheme with different combinations.As shown in Figure13, the power level is set to be 10%, which means that the smartphone has relatively low remaining energy, so the trade-off strategies formulated based on fuzzy rules are designed to trigger as few energy-hungry WiFi scans as possible to ensure that the fusion localization scheme error is below the given error threshold (i.e., 0.5, 2.0, and 4.0). In other words, the fusion localization scheme does not decide to trigger a new WiFi scan until the fusion localization scheme error is close to the error threshold. As a result, it can be seen from Figure 14 that the mean error of the fusion localization scheme is higher than that of the fusion localization scheme with the power level of 100%. To some extent, the fusion localization system scheme sacrifices localization accuracy to extend the smartphone’s battery life. In contrary, the power level is set to be 100%, which means that the smartphone has sufficient remaining energy, so the fusion localization scheme actively decides to trigger more WiFi scans to ensure the localization accuracy before the error of the fusion system increases to the given error threshold. As a result, as shown in Figure 13, the count of triggered WiFi scans of the fusion localization scheme is more than twice that of the fusion localization scheme with the power level of 10%. Accordingly, compared with the fusion localization scheme with the power level of 10%, the fusion localization scheme achieves lower error, as shown in Figure 14. Furthermore, it can be seen from Figures 13 and 14 that in the fusion localization schemes with different parameter combinations, the higher the error threshold, the higher the mean error of the fusion localization scheme, and the fewer the WiFi scans are triggered.Additionally, once the power level is set to be above 40%, as shown in Figure14, the mean error of the fusion localization scheme no longer can be decreased accordingly. This is because the fusion localization scheme error has reached the accuracy requirement and extra WiFi scans need not to be triggered.Figure15 depicts the energy consumption of the fusion localization scheme with the different combinations of the error threshold and the power level. The energy consumption increases accordingly with the increase of triggered WiFi scans. Furthermore, the lower the error threshold, the higher the energy consumption for smartphones. Consequently, it can be concluded that by using the FIS based on fuzzy logic, the fusion localization scheme can dynamically trigger energy-hungry WiFi scans to balance the localization accuracy against energy consumption, so as to achieve energy-adaptive localization. The input linguistic variables comprise the fusion localization scheme error and remaining energy. The main purpose of the FIS is to dynamically schedule WiFi scans, so as to balance the fusion localization scheme error against the remaining energy. Hence, we consider the output linguistic variable as the indicator of whether or not to run once WiFi scan in each step.


## 7.5.1. The Error Threshold of 1.5 and the Power Level of 100%

The fusion localization system was set to be 1.5, and the experimental smartphone was fully charged to 100%. Then, the tester walked along the predefined path, resulting in a total of 264 steps, whereas the adopted gait detection method counted 261 steps.As shown in Figure6, the smartphone has sufficient battery energy in the whole localization process; accordingly, its normalized remaining energy, represented by the blue solid line, is always equal to 1 during this process; meanwhile, the error threshold is relatively high. Therefore, the fusion localization scheme actively triggers a new WiFi scan to ensure the accuracy requirement. It can be seen from Figure 7 that the outputs of the FIS in 35 steps out of 261 steps are above the threshold of 0.6, indicating that the fusion localization scheme decides to invoke once new WiFi scan in each of 35 steps. As a result, as shown in Figure 6, the normalized coarse errors of the fusion system do not reach 1, indicating that the fusion localization scheme always actively triggers a new WiFi scan to ensure localization accuracy on account of the sufficient remaining energy, resulting with resetting the fusion localization error to 0.Figure 6
Inputs of FIS.Figure 7
Outputs of FIS.Figure8 shows the final fusion localization results. In each step, the fusion localization scheme trades off localization accuracy against energy consumption based on the output of the FIS. Specifically, once a WiFi scan is invoked in a step, even if the coarse error of the fusion system has not reached the error threshold of 1.5, the fusion localization scheme actively performs once new WiFi scan due to the abundant battery energy. After that, the distance-based fusion method is employed to fuse the newly obtained WiFi localization result with the PDR result, so as to obtain the newly fusion result, which is also the initial position of PDR from now on (marked by red asterisks in Figure 8).Figure 8
Trajectory of the localization fusion results.Furthermore, the coarse error of the fusion localization system is set to be 0, and the initial position of PDR is updated with the newly obtained fusion localization result. Prior to the next WiFi scan or the next WiFi localization, the scheme simply returns the PDR results as the fusion localization result (marked by the blue circle in Figure8). Thus, the fusion localization scheme applies the FIS to dynamically schedule the energy-hungry WiFi scan in the whole localization process according to the remaining energy and the coarse fusion localization error.Figure9 depicts influence of the distance-based fusion method. Notably, the proposed distance-based fusion method is executed in 35 fusion locations. The local enlarged image in Figure 9 shows the details of the first weight-fusion location. In the first point, the Euclidean distance between the WiFi result and the last fusion result is 3.12 m, and the Euclidean distance between the PDR result and the last fusion result is 8.44 m. Because of relatively high accuracy for PDR in the short term and the outliers of WiFi localization, we believe that PDR is relatively more accurate than WiFi localization in the short term. Hence, the fusion weight is calculated as 0.55 by using Equation (20). Consequently, the first fusion location is almost in the middle of the WiFi localization location and the PDR location. Differently, the sixth fusion location in Figure 9 almost overlaps the WiFi localization location because of the more accurate WiFi localization than PDR. Hence, the method can weigh the accuracy of the WiFi localization result against the PDR result, so as to achieve a good fusion localization result.Figure 9
Comparison of the fusion, PDR, and WiFi results.Figure10 depicts the error comparisons of different localization methods. The PDR errors gradually increase from 0 to 18.31 m, indicating that PDR exits drift errors over time. The WiFi localization error in the 83rd step is 0.2 m and can increase to 9.1 m in the 76th step, but the maximum error of WiFi localization does not exceed 10 m. This shows that WiFi localization errors remain relatively stable in the long term, but exist outliers. However, our proposed fuzzy logic-based fusion method (marked by “FL”) not only eliminates the drift error of PDR and suppresses the instability of WiFi localization but also obtains almost the same localization accuracy as the complementary filter fusion method (marked by “CF”). Furthermore, with the aid of the calibrated heading estimates, the WiFi-assisted PDR performs not only better than PDR, but also better than all the other methods because the true initial location is used.Figure 10
Localization errors of different localization methods.The CDFs of the errors of these localization methods in Figure11 also show similar characteristics. With an increase in the CDF value, the PDR error keeps increasing, up to 20 m, whereas the maximum value of the WiFi error is just 7 m. It is noted that the blue solid curve and the black dash-dot curve in Figure 11 almost overlap, which again verifies that our proposed fusion scheme obtains similar localization accuracy as the complementary filter fusion method.Figure 11
CDF of the errors of different localization methods.Nevertheless, the energy consumption of it is just 38.02% of that of the complementary filter fusion method, as shown in Figure12. The complementary filter fusion method consumes the most energy among these localization methods, whereas PDR consumes the least energy. WiFi fingerprint localization consumes more energy than PDR. Although WiFi scan is energy-hungry, the proposed fusion localization scheme can achieve almost the same localization accuracy as the complementary filter fusion method but consumes little energy. Therefore, the proposed fusion scheme by using the FIS can dynamically schedule WiFi scans to achieve energy-efficient fusion localization.Figure 12
Energy consumption of different localization methods.


## 7.5.2. The Error Threshold between 0.5 and 4.0 and the Power Level between 10% and 100%

When the error threshold of the fusion localization system was set between 0.5 and 4.0 and the power level was set between 10% and 100%, the experimental results with different parameter combinations are shown in Figures13–15.Figure 13
WiFi scan counts of the fusion localization scheme with different combinations.Figure 14
Mean errors of the fusion localization scheme with different combinations.Figure 15
Energy consumption of the fusion localization scheme with different combinations.As shown in Figure13, the power level is set to be 10%, which means that the smartphone has relatively low remaining energy, so the trade-off strategies formulated based on fuzzy rules are designed to trigger as few energy-hungry WiFi scans as possible to ensure that the fusion localization scheme error is below the given error threshold (i.e., 0.5, 2.0, and 4.0). In other words, the fusion localization scheme does not decide to trigger a new WiFi scan until the fusion localization scheme error is close to the error threshold. As a result, it can be seen from Figure 14 that the mean error of the fusion localization scheme is higher than that of the fusion localization scheme with the power level of 100%. To some extent, the fusion localization system scheme sacrifices localization accuracy to extend the smartphone’s battery life. In contrary, the power level is set to be 100%, which means that the smartphone has sufficient remaining energy, so the fusion localization scheme actively decides to trigger more WiFi scans to ensure the localization accuracy before the error of the fusion system increases to the given error threshold. As a result, as shown in Figure 13, the count of triggered WiFi scans of the fusion localization scheme is more than twice that of the fusion localization scheme with the power level of 10%. Accordingly, compared with the fusion localization scheme with the power level of 10%, the fusion localization scheme achieves lower error, as shown in Figure 14. Furthermore, it can be seen from Figures 13 and 14 that in the fusion localization schemes with different parameter combinations, the higher the error threshold, the higher the mean error of the fusion localization scheme, and the fewer the WiFi scans are triggered.Additionally, once the power level is set to be above 40%, as shown in Figure14, the mean error of the fusion localization scheme no longer can be decreased accordingly. This is because the fusion localization scheme error has reached the accuracy requirement and extra WiFi scans need not to be triggered.Figure15 depicts the energy consumption of the fusion localization scheme with the different combinations of the error threshold and the power level. The energy consumption increases accordingly with the increase of triggered WiFi scans. Furthermore, the lower the error threshold, the higher the energy consumption for smartphones. Consequently, it can be concluded that by using the FIS based on fuzzy logic, the fusion localization scheme can dynamically trigger energy-hungry WiFi scans to balance the localization accuracy against energy consumption, so as to achieve energy-adaptive localization. The input linguistic variables comprise the fusion localization scheme error and remaining energy. The main purpose of the FIS is to dynamically schedule WiFi scans, so as to balance the fusion localization scheme error against the remaining energy. Hence, we consider the output linguistic variable as the indicator of whether or not to run once WiFi scan in each step.


## 7.6. Experiments of WiFi-Assisted Heading Estimation

As is shown in Figure16, the cumulative angular rate from the gyroscope in steps 88-91, steps 131-133, step 216, and steps 218-219 (enclosed by blue rectangle boxes) are above the threshold of 10 radians. Therefore, it can be judged that the pedestrian is turning in these steps according to Equation (21). As a result, the whole walking trajectory can be split into four straight paths: steps 1-87, 92-130, 134-215, and 220-261.Figure 16
Accumulated gyroscope value.Accordingly, as shown in Figure17, with the help of the calibrated heading by using the straight trajectories of the WiFi localization, the heading errors on the straight paths from steps 1 to 87 and from steps 134 to 215 are almost equal to 0. However, since the number of the WiFi localization results in the straight paths from steps 92 to 130 and steps 220 to 261 does not satisfy the minimum number of the linear fitting, the heading in these paths cannot be calibrated and is still estimated by the AKF heading estimation method. While the heading in turning steps can be estimated by using the calibrated heading of the last straight path as the initial heading plus the heading change from gyroscope in each step. As a result, as shown in Figure 17, the pedestrian’s heading errors from steps 88 to 91 and from steps 131 to 133 are lower than that from the same steps due to the relatively high-heading estimation accuracy from gyroscope in the short term.Figure 17
Comparison of heading errors.Thus, the accuracy of the heading estimation is improved by using WiFi localization. As shown in Figure18, when the error is within 2.65 m, the error CDF of the standard KF heading estimation method is only 0.11, whereas the error CDF of the calibrated heading error can increase to 1. The PDR errors in Figure 19 again depict that the adopting WiFi-assisted heading estimation method can reduce the PDR error. Consequently, as is shown in Figure 10, the drift errors of PDR between the two adjacent WiFi localizations can be eliminated or reduced.Figure 18
CDF of heading errors.Figure 19
PDR errors.


## 8. Conclusion

In the study, we proposed an energy-adaptive fusion localization scheme by combining WiFi with PDR. The scheme uses the FIS to formulate trade-off strategies between localization accuracy and energy consumption. Without the need of establishing precise mathematical models for the fusion localization error and the energy consumption, the proposed scheme is able to dynamically schedule energy-hungry WiFi scans in the fusion localization process, thereby achieving energy efficiency without degradation in localization accuracy. Furthermore, we identified a series of WiFi localization results in straight-line paths to calibrate a pedestrian’s heading, which further improves the accuracy of the fusion localization system. Extensive experimental results showed that the proposed scheme can efficiently balance the accuracy requirement and the energy consumption in a fusion localization system using WiFi with PDR.



---

*Source: 9052477-2023-01-07.xml*