1 Introduction

In recent years, indoor navigation has gained a significant attention from researchers. Indoor navigation can be traced back before smartphones came into existence [1]. RADAR [2] and Horus [3] were examples. Since people spend about 70% of their time indoors [4], the demand of indoor navigation is increasing rapidly. However, signals from the widely used Global Navigation Satellite Systems (GNSS) are often not hearable in indoor environments [5]. As a result, indoor navigation remains a difficult problem. To overcome this conundrum, researchers have developed various approaches using inertial measurement unit (IMU) [6], magnetic field [7], ultrasonic [8], radio-frequency (RF) ID tags [9], FM [10], WiFi [11], etc.

Among the above methods, WiFi-based positioning technique has been much favored in indoor environments. The advantages of WiFi are low device cost, wide infrastructure deployment and high positioning accuracy [5]. WiFi indoor navigation approaches are essentially divided into two categories: trilateration and fingerprinting [12]. In the former, a radio propagation model (RPM) is established and the distance between WiFi access points (AP) and the mobile user (MU) is estimated through RPM and the received signal strength (RSS) [13]. Due to the complexity of indoor environments, an accurate RPM cannot be found to describe propagation characteristics of WiFi signals inside buildings [14]. In the fingerprinting method, there are usually two phases: offline and online phases. In the offline stage, the main work is setting the locations of many reference points (RPs) as the shape of the square grid (each RP receives signal strength data from multiple APs) and storing the signal strength data with position coordinates of RPs in the database. In the online stage, the MU detects RSSs at positioning points and uses various matching algorithms to identify his locations by comparing RSS measurements with the reference data [12, 14]. Although fingerprinting approach needs to establish fingerprint database at the early stage, it can effectively avoid the influence of building structure. Besides, it does not require WiFi APs to be known in advance [15]. Therefore, it has gained much attention [16]. In this paper, a novel WiFi fingerprinting method with searching space limiting and mean filtering is proposed to achieve better performance (including higher computation efficiency and higher positioning accuracy) than traditional ones.

Since most of the current smartphones are equipped with inertial sensors (including accelerometers and gyroscopes), microelectromechanical system (MEMS) sensor-based navigation is becoming a popular relative and self-contained positioning technique [5]. MEMS sensors have the virtue of lower cost and small form factor [17]. For consumer portable devices, dead reckoning (DR) is commonly the algorithm applied to position with inertial sensors [16]. There are two categories of DR algorithms: inertial navigation system (INS) mechanism and pedestrian dead reckoning (PDR). INS is a system of calculating velocity by integration of the total acceleration and computing position by integration of the resultant velocity [18]. It has a simple structure and strong autonomy and is commonly used in vehicle navigation [19]. However, the navigation error of INS will appear unconstrained divergence over time [20]. In order to improve the navigation performance for pedestrians, PDR is developed to reduce the accumulated errors [21]. The basic principle of PDR is that the current location can be found out by calculating moved distance with heading angle from initial location [22]. PDR uses IMU to detect when the MU takes footsteps and how the direction changes between footsteps [23]. So far, calculating an accurate long-term heading remains the most challenging problem in PDR [24]. In this paper, a novel integrated MEMS solution applying Kalman filtering with correlated process and measurement noise is proposed to achieve better performance (much higher positioning accuracy) than traditional ones.

For the integration of WiFi and MEMS, there are a number of existed researches. Tian et al. [5] proposed a novel smartphone-based integrated WiFi/MEMS positioning algorithm based on the robust extended Kalman filter (EKF) in a multi-floor environment. Zhuang and El-Sheimy [25] originally proposed a pedestrian navigator based on tightly coupled integration of low-cost MEMS sensors and WiFi for handheld devices. Zhuang et al. [26] presented a two-filter integration for MEMS sensors and WiFi fingerprinting where a smoothed constrained fingerprinting was obtained. In our previous research [27], we proposed a novel WiFi/MEMS integration structure for indoor navigation using two-stage EKF. Using the same data from WiFi/MEMS sensors, different information fusion structures may lead to various results [16]. In the current study, the self-calibration Kalman filter (SKF) approach is introduced into indoor navigation field for WiFi/MEMS integration and a novel Kalman filter system is designed to fuse the information effectively. As a result, satisfactory navigation performance is achieved.

The rest of this paper is organized as follows. Section 2 presents the system overview. The WiFi solution and PDR solution are illustrated in Sects. 3 and 4, respectively. In Sect. 5, the SKF-based integration of WiFi and MEMS is analyzed. Section 6 provides details of experiments and results. Section 7 makes the conclusion.

2 System Overview

The block diagram of the proposed WiFi/MEMS structure for indoor navigation is shown in Fig. 1.

Fig. 1
figure 1

Block diagram

The proposed system mainly includes three modules: WiFi-based navigation, PDR-based navigation, and WiFi/MEMS integration. In WiFi solution, RSS values pass to the fingerprinting scheme to generate the MU position and a novel searching space limiting method is originally presented. In PDR solution, an attitude determination EKF with correlated process and measurement noise is presented using the gyroscope and accelerometer data, and then PDR algorithm is applied to calculate the position of the MU. In WiFi/MEMS integration, the SKF approach is applied to fuse the above information and finally achieve high-accuracy indoor navigation.

3 WiFi-Based Navigation

In WiFi fingerprinting scheme, to estimate the position of the MU, different matching algorithms have been presented [28]. There are probabilistic approaches [29, 30], deterministic approaches [31, 32], and neural networks [33, 34]. Among them, K-nearest neighbor (KNN) is one of the top algorithms in data mining [35]. As an effective method to determine the most important objects of interests, the KNN query is designed to find the top k closest objects to a specified query point, given a set of objects and a distance metric [36]. There are different types of distance metrics [12, 32, 37, 38]. Furthermore, weighted K-nearest neighbor (WKNN) method [39] has been developed. According to WKNN, the MU position is calculated utilizing the weighted mean of position coordinates of the k RPs. There are various methods to determine weights [14].

In KNN and WKNN algorithms, it is necessary to search the overall space and go through the whole database fingerprints, which usually means low efficiency and unacceptable computation time. In addition, this increases the probability of mismatching and thereby reduces the navigation accuracy. In the current study, the searching space is limited into a circle determined with the information of the latest positioning point. Firstly, as a single position may correspond to several RSS measurements, the method of inverse regression analysis and data fusion proposed in the literature [40] is introduced into WiFi fingerprinting navigation for a more accurate estimation as follows.

Let \(x\) be the argument and \(y\) be the random variable. There is a relationship between \(x\) and \(y\) as follows:

$$y = a + bx + \varepsilon$$
(1)
$$\varepsilon \sim N(0,\sigma^{2} ),$$
(2)

where \(a\), \(b\), and \(\sigma^{2}\) are undetermined parameters independent of \(x\).

Suppose \(\left( {x_{1}^{\prime } ,y_{1}^{\prime } } \right),\left( {x_{2}^{\prime } ,y_{2}^{\prime } } \right), \cdots ,\left( {x_{{n^{\prime}}}^{\prime } ,y_{{n^{\prime}}}^{\prime } } \right)\) are a sample obtained through \(n^{\prime}\) independent trials. Then, the estimates of \(a\), \(b\), and \(\sigma\) can be obtained as follows:

$$\hat{a} = \bar{y}^{\prime} - \hat{b}\bar{x}^{\prime}$$
(3)
$$\hat{b} = L_{xx}^{ - 1} L_{xy}$$
(4)
$$\hat{\sigma } = \sqrt {\sum\limits_{i = 1}^{{n^{\prime}}} {\frac{{\left( {y_{i}^{\prime } - \hat{a} - \hat{b}x_{i}^{\prime } } \right)^{2} }}{{n^{\prime} - 2}}} } ,$$
(5)

where

$$\bar{x}^{\prime} = \frac{1}{{n^{\prime}}}\sum\limits_{i = 1}^{{n^{\prime}}} {x_{i}^{\prime } }$$
(6)
$$\bar{y}^{\prime} = \frac{1}{{n^{\prime}}}\sum\limits_{i = 1}^{{n^{\prime}}} {y_{i}^{\prime } }$$
(7)
$$L_{xx} = \sum\limits_{i = 1}^{{n^{\prime}}} {\left( {x_{i}^{\prime } - \bar{x}^{\prime}} \right)^{2} }$$
(8)
$$L_{xy} = \sum\limits_{i = 1}^{{n^{\prime}}} {\left( {x_{i}^{\prime } - \bar{x}^{\prime}} \right)\left( {y_{i}^{\prime } - \bar{y}^{\prime}} \right)} .$$
(9)

Assume \(n\) independent measurements are conducted under the same condition, and \(n\) values of variable \(y\) (\(y_{1} ,y_{2} , \ldots ,y_{n}\)) are gained. Then, the estimate of \(x\) can be obtained as follows:

$$\hat{x} = {{\left( {\bar{y} - \hat{a}} \right)} \mathord{\left/ {\vphantom {{\left( {\bar{y} - \hat{a}} \right)} {\hat{b}}}} \right. \kern-0pt} {\hat{b}}},$$
(10)

where

$$\bar{y} = \frac{1}{n}\sum\limits_{i = 1}^{n} {y_{i} } .$$
(11)

When \(b > 0\), the one-side lower and upper confidence limits of \(x\) at the confidence level of \(P\) can be calculated by

$$\hat{a} + \hat{b}x_{\text{L}} + {{u_{\text{P}} S} \mathord{\left/ {\vphantom {{u_{\text{P}} S} {\sqrt n }}} \right. \kern-0pt} {\sqrt n }} = \bar{y}$$
(12)
$$\hat{a} + \hat{b}x_{\text{U}} - {{u_{\text{P}} S} \mathord{\left/ {\vphantom {{u_{\text{P}} S} {\sqrt n }}} \right. \kern-0pt} {\sqrt n }} = \bar{y},$$
(13)

where \(x_{\text{L}}\) and \(x_{\text{U}}\) are the one-side lower and upper confidence limits of \(x\), respectively; \(u_{\text{P}}\) is the \(P\) percentage point of the standard normal distribution; \(S\) is given by

$$S^{2} = \frac{1}{{n^{\prime} + n - 3}}\left[ {\left( {n^{\prime} - 2} \right)\hat{\sigma }^{2} + \sum\limits_{i = 1}^{n} {\left( {y_{i} - \bar{y}} \right)^{2} } } \right].$$
(14)

When \(b < 0\), the one-side lower and upper confidence limits of \(x\) at the confidence level of \(P\) can be calculated by

$$\hat{a} + \hat{b}x_{\text{L}} - {{u_{\text{P}} S} \mathord{\left/ {\vphantom {{u_{\text{P}} S} {\sqrt n }}} \right. \kern-0pt} {\sqrt n }} = \bar{y}$$
(15)
$$\hat{a} + \hat{b}x_{\text{U}} + {{u_{\text{P}} S} \mathord{\left/ {\vphantom {{u_{\text{P}} S} {\sqrt n }}} \right. \kern-0pt} {\sqrt n }} = \bar{y}.$$
(16)

In this paper, a novel searching space limiting method is proposed based on the above approach. In the proposed method, a probability circle of the MU’s position is determined with the information of the latest positioning point and the searching space is limited into the circle. The center of the circle is located at the latest positioning point, and its radius is determined through the following analysis.

When a test point is located, its position coordinates can be regarded as known values. Selecting \(n^{\prime}\) reference points which have the shortest RSS distances (\(D_{i}\)) to the test point, their spatial distances to the test point (\(L_{i}\)) can be calculated. It is found that \(\ln D_{i}\) varies in good linearity with \(\ln L_{i}\). Therefore, a line mode is established as shown in Eqs. (17) and (18):

$$\ln D = a + b\ln L + \varepsilon$$
(17)
$$\varepsilon \sim N(0,\sigma^{2} ),$$
(18)

where the parameters \(a\), \(b\), and \(\sigma\) can be estimated according to Eqs. (3)–(5).

When locating the next test point, the RSS distance between next point and this point (\(D^{ * }\)) can be calculated easily. According to Eqs. (13) and (14), the one-side upper limit of \(\ln L^{ * }\) is obtained as follows:

$$\left( {\ln L^{ * } } \right)_{\text{U}} = \frac{1}{{\hat{b}}}\left( {\ln D^{ * } + u_{\text{P}} S - \hat{a}} \right),$$
(19)

where

$$S^{2} = \hat{\sigma }^{2} = \sum\limits_{i = 1}^{{n^{\prime}}} {\frac{{\left( {\ln D_{i} - \hat{a} - \hat{b}\ln L_{i} } \right)^{2} }}{{n^{\prime} - 2}}} .$$
(20)

Therefore, we have the one-side upper limit of the spatial distance between these two points (\(L_{U}^{ * }\)) as follows:

$$L_{\text{U}}^{ * } = \exp \left[ {\frac{1}{{\hat{b}}}\left( {\ln D^{ * } + u_{\text{P}} S - \hat{a}} \right)} \right].$$
(21)

A circle with the radius of \(L_{\text{U}}^{ * }\) at this point is a probability circle of the MU’s position at the next point. Then, the position of the next point can be calculated within the scope of RPs in the circle plus this point. Thus, the position of this point is taken into account. Therefore, the area of searching space is significantly reduced and the navigation accuracy is increased.

In WiFi fingerprinting positioning, there is a common phenomenon named reciprocating motion, as shown in Fig. 2a. The positioning points often flock together and bounce around, resulting in poor positioning accuracy. In this paper, a seven-order mean filter is applied to the original positioning results for smoothing. After filtered, the phenomenon of reciprocating motion has been eliminated greatly, as shown in Fig. 2b. The positioning points become consistent, and the positioning accuracy is increased.

Fig. 2
figure 2

WiFi positioning results a before filtered, b after filtered

4 PDR-Based Navigation

Generally, a PDR system consists of three parts: step detection, step length estimation, and heading calculation. PDR algorithm is illustrated as follows [21]:

$$\left\{ {\begin{array}{*{20}c} {x_{i} = x_{i - 1} + s_{i} \cos \psi_{i} } \\ {y_{i} = y_{i - 1} + s_{i} \sin \psi_{i} } \\ \end{array} } \right.,$$
(22)

where \(x_{i} ,y_{i}\) are position coordinates of the MU at the ith step, \(s_{i}\) is the estimated step length of the ith step, and \(\psi_{i}\) is the heading angle of the ith step.

As described above, calculating an accurate long-term heading is the most challenging issue in PDR. In this paper, the attitude determination EKF in [27] is applied to estimate the heading of the pedestrian using the data obtained from triaxial gyroscopes and accelerometers as follows.

The state vector is written as

$${\mathbf{D}}_{k} = \left[ {\psi_{k} \, \theta_{k} \, \gamma_{k} } \right]^{T} ,$$
(23)

where \(\psi\) is the heading angle, \(\theta\) is the pitching angle, and \(\gamma\) is the roll angle.

The system model is as follows:

$$\left\{ {\begin{array}{*{20}l} {\psi_{k} = \psi_{k - 1} + \left( {\frac{{\sin \gamma_{k - 1} }}{{\cos \theta_{k - 1} }}\omega_{x,k - 1} - \frac{{\cos \gamma_{k - 1} }}{{\cos \theta_{k - 1} }}\omega_{z,k - 1} } \right)\Delta t + w_{\psi ,k - 1} } \hfill \\ {\theta_{k} = \theta_{k - 1} + \left( {\cos \gamma_{k - 1} \omega_{x,k - 1} + \sin \gamma_{k - 1} \omega_{z,k - 1} } \right)\Delta t + w_{\theta ,k - 1} } \hfill \\ {\gamma_{k} = \gamma_{k - 1} + \left( {\sin \gamma_{k - 1} \tan \theta_{k - 1} \omega_{x,k - 1} + \omega_{y,k - 1} - \cos \gamma_{k - 1} \tan \theta_{k - 1} \omega_{z,k - 1} } \right)\Delta t + w_{\gamma ,k - 1} } \hfill \\ \end{array} } \right.,$$
(24)

where \(\omega_{x} ,\omega_{y} ,\omega_{z}\) are angular velocities observed in the carrier coordinate system, \(w_{\psi } ,w_{\theta } ,w_{\gamma }\) are noise, and \(\Delta t\) is the sampling interval.

The measurement vector is written as

$${\mathbf{A}}_{k} = \left[ {a_{x,k} \, a_{y,k} \, a_{z,k} } \right]^{T} ,$$
(25)

where \(a_{x} ,a_{y} ,a_{z}\) are accelerations observed in the carrier coordinate system.

The measurement model is as follows:

$${\mathbf{A}}_{k} = {\mathbf{T}}_{k}^{ - 1} [0 \, 0 \, 1]^{T} + {\mathbf{v}}_{k} ,$$
(26)

where \({\mathbf{T}}_{k}\) is the direction cosine matrix calculated by Eq. (27) and \({\mathbf{v}}_{k}\) is the noise.

$${\mathbf{T}}_{k} = \left[ {\begin{array}{*{20}c} {\cos \psi_{k} } & { - \sin \psi_{k} } & 0 \\ {\sin \psi_{k} } & {\cos \psi_{k} } & 0 \\ 0 & 0 & 1 \\ \end{array} } \right]\left[ {\begin{array}{*{20}c} {\cos \theta_{k} } & 0 & {\sin \theta_{k} } \\ 0 & 1 & 0 \\ { - \sin \theta_{k} } & 0 & {\cos \theta_{k} } \\ \end{array} } \right]\left[ {\begin{array}{*{20}c} 1 & 0 & 0 \\ 0 & {\cos \gamma_{k} } & { - \sin \gamma_{k} } \\ 0 & {\sin \gamma_{k} } & {\cos \gamma_{k} } \\ \end{array} } \right].$$
(27)

Since perturbations while walking affect both gyroscopes and accelerometers, the process noise and measurement noise are correlated, which has been ignored by most previous studies. Therefore, in the current study, a novel navigation algorithm is proposed as follows based on the EKF with correlated process and measurement noise [41].

The navigation system is given by

$$\begin{aligned} {\mathbf{D}}_{k} & = f_{k - 1} \left( {{\mathbf{D}}_{k - 1} ,{\mathbf{u}}_{k - 1} ,{\mathbf{w}}_{k - 1} } \right) \\ {\mathbf{A}}_{k} & = h_{k} \left( {{\mathbf{D}}_{k} ,{\mathbf{v}}_{k} } \right) \\ {\mathbf{w}}_{k} & \sim\left( {0,{\mathbf{Q}}_{k} } \right) \\ {\mathbf{v}}_{k} & \sim\left( {0,{\mathbf{R}}_{k} } \right) \\ E\left[ {{\mathbf{w}}_{k} {\mathbf{w}}_{j}^{T} } \right] & = {\mathbf{Q}}_{k} \delta_{k - j} \\ E\left[ {{\mathbf{v}}_{k} {\mathbf{v}}_{j}^{T} } \right] & = {\mathbf{R}}_{k} \delta_{k - j} \\ E\left[ {{\mathbf{w}}_{k} {\mathbf{v}}_{j}^{T} } \right] & = {\mathbf{M}}_{k} \delta_{k - j + 1} , \\ \end{aligned}$$
(28)

where \(f_{k - 1} \left( \cdot \right)\) is the system model defined in Eq. (24), \(h_{k} \left( \cdot \right)\) is the measurement model defined in Eq. (26), \({\mathbf{D}}_{k}\) is the state vector, \({\mathbf{A}}_{k}\) is the measurement vector, \({\mathbf{u}}_{k - 1} = \left[ {\omega_{x,k - 1} \, \omega_{y,k - 1} \, \omega_{z,k - 1} } \right]^{T}\), \({\mathbf{w}}_{k - 1}\), and \({\mathbf{v}}_{k}\) are noise. \(\delta_{k - j}\) is the Kronecker delta function, \(\delta_{k - j} = 1\) if \(k = j\), and \(\delta_{k - j} = 0\) if \(k \ne j\).

The EKF is initialized as

$$\begin{aligned} {\hat{\mathbf{D}}}_{0}^{ + } & = E\left( {{\mathbf{D}}_{0} } \right) \\ {\mathbf{P}}_{0}^{ + } & = E\left[ {\left( {{\mathbf{D}}_{0} - {\hat{\mathbf{D}}}_{0}^{ + } } \right)\left( {{\mathbf{D}}_{0} - {\hat{\mathbf{D}}}_{0}^{ + } } \right)^{T} } \right]. \\ \end{aligned}$$
(29)

For \(k = 1,2, \cdots\), perform the following steps:

  1. (a)

    Compute the following partial derivative matrices:

    $$\begin{aligned} {\mathbf{F}}_{k - 1} & = \left. {\frac{{\partial f_{k - 1} }}{{\partial {\mathbf{D}}}}} \right|_{{{\hat{\mathbf{D}}}_{k - 1}^{ + } }} \\ {\mathbf{L}}_{k - 1} & = \left. {\frac{{\partial f_{k - 1} }}{{\partial {\mathbf{w}}}}} \right|_{{{\hat{\mathbf{D}}}_{k - 1}^{ + } }} . \\ \end{aligned}$$
    (30)
  2. (b)

    Perform the time update of the state estimate and estimation error covariance as follows:

    $$\begin{aligned} {\mathbf{P}}_{k}^{ - } & = {\mathbf{F}}_{k - 1} {\mathbf{P}}_{k - 1}^{ + } {\mathbf{F}}_{k - 1}^{T} + {\mathbf{L}}_{k - 1} {\mathbf{Q}}_{k - 1} {\mathbf{L}}_{k - 1}^{T} \\ {\hat{\mathbf{D}}}_{k}^{ - } & = f_{k - 1} \left( {{\hat{\mathbf{D}}}_{k - 1}^{ + } ,{\mathbf{u}}_{k - 1} ,0} \right). \\ \end{aligned}$$
    (31)
  3. (c)

    Compute the following partial derivative matrices:

    $$\begin{aligned} {\mathbf{H}}_{k} & = \left. {\frac{{\partial h_{k} }}{{\partial {\mathbf{D}}}}} \right|_{{{\hat{\mathbf{D}}}_{k}^{ - } }} \\ {\mathbf{N}}_{k} & = \left. {\frac{{\partial h_{k} }}{{\partial {\mathbf{v}}}}} \right|_{{{\hat{\mathbf{D}}}_{k}^{ - } }} . \\ \end{aligned}$$
    (32)
  4. (d)

    Perform the measurement update of the state estimate and estimation error covariance as follows:

    $$\begin{aligned} {\mathbf{K}}_{k} & = \left( {{\mathbf{P}}_{k}^{ - } {\mathbf{H}}_{k}^{T} + {\mathbf{M}}_{k} } \right)\left( {{\mathbf{H}}_{k} {\mathbf{P}}_{k}^{ - } {\mathbf{H}}_{k}^{T} + {\mathbf{H}}_{k} {\mathbf{M}}_{k} + {\mathbf{M}}_{k}^{T} {\mathbf{H}}_{k}^{T} + {\mathbf{N}}_{k} {\mathbf{R}}_{k} {\mathbf{N}}_{k}^{T} } \right)^{ - 1} \\ {\hat{\mathbf{D}}}_{k}^{ + } & = {\hat{\mathbf{D}}}_{k}^{ - } + {\mathbf{K}}_{k} \left[ {{\mathbf{A}}_{k} - h_{k} \left( {{\hat{\mathbf{D}}}_{k}^{ - } ,0} \right)} \right] \\ {\mathbf{P}}_{k}^{ + } & = {\mathbf{P}}_{k}^{ - } - {\mathbf{K}}_{k} \left( {{\mathbf{H}}_{k} {\mathbf{P}}_{k}^{ - } + {\mathbf{M}}_{k}^{T} } \right). \\ \end{aligned}$$
    (33)

Figure 3 depicts the comparison of heading calculation utilizing filters with correlated noise and uncorrelated noise. As shown, the heading estimation using traditional attitude determination EKF (with uncorrelated noise) deviates from the actual value obviously. When applying the proposed PDR-based navigation algorithm (with correlated noise), the heading estimation fits the actual value well. Therefore, more accurate long-term heading calculation is obtained and positioning accuracy is improved.

Fig. 3
figure 3

Heading calculation in PDR

5 SKF-Based Integration

The integration stage of the navigation algorithm is proposed in this section utilizing the information from WiFi and MEMS positioning results. To obtain an accurate and stable estimation, the SKF method proposed in [42] is introduced into indoor navigation field as follows:

Suppose we have a system given by

$$\begin{aligned} {\mathbf{X}}_{k} & = {\mathbf{F}}_{k - 1} {\mathbf{X}}_{k - 1} + {\mathbf{G}}_{k - 1} {\mathbf{u}}_{k - 1} + {\mathbf{b}}_{k - 1} + {\mathbf{w}}_{k - 1} \\ {\mathbf{Y}}_{k} & = {\mathbf{H}}_{k} {\mathbf{X}}_{k} + {\mathbf{v}}_{k} \\ {\mathbf{w}}_{k} & \sim\left( {0,{\mathbf{Q}}_{k} } \right) \\ {\mathbf{v}}_{k} & \sim\left( {0,{\mathbf{R}}_{k} } \right) \\ E\left[ {{\mathbf{w}}_{k} {\mathbf{w}}_{j}^{T} } \right] & = {\mathbf{Q}}_{k} \delta_{k - j} \\ E\left[ {{\mathbf{v}}_{k} {\mathbf{v}}_{j}^{T} } \right] & = {\mathbf{R}}_{k} \delta_{k - j} \\ E\left[ {{\mathbf{w}}_{k} {\mathbf{v}}_{j}^{T} } \right] & = 0, \\ \end{aligned}$$
(34)

where \({\mathbf{X}}_{k}\) is the state vector, \({\mathbf{Y}}_{k}\) is the measurement vector, \({\mathbf{u}}_{k - 1}\) is a known input, \({\mathbf{b}}_{k - 1}\) is an unknown input, \({\mathbf{w}}_{k - 1}\) and \({\mathbf{v}}_{k}\) are noise. \(\delta_{k - j}\) is the Kronecker delta function.

The SKF is initialized as

$$\begin{aligned} {\hat{\mathbf{X}}}_{0}^{ + } & = E\left( {{\mathbf{X}}_{0} } \right) \\ {\mathbf{P}}_{0}^{ + } & = E\left[ {\left( {{\mathbf{X}}_{0} - {\hat{\mathbf{X}}}_{0}^{ + } } \right)\left( {{\mathbf{X}}_{0} - {\hat{\mathbf{X}}}_{0}^{ + } } \right)^{T} } \right]. \\ \end{aligned}$$
(35)

For \(k = 1,2\), the Kalman filter equations are given as

$$\begin{aligned} {\mathbf{P}}_{k}^{ - } & = {\mathbf{F}}_{k - 1} {\mathbf{P}}_{k - 1}^{ + } {\mathbf{F}}_{k - 1}^{T} + {\mathbf{Q}}_{k - 1} \\ {\mathbf{K}}_{k} & = {\mathbf{P}}_{k}^{ - } {\mathbf{H}}_{k}^{T} \left( {{\mathbf{H}}_{k} {\mathbf{P}}_{k}^{ - } {\mathbf{H}}_{k}^{T} + {\mathbf{R}}_{k} } \right)^{ - 1} \\ {\hat{\mathbf{X}}}_{k}^{ - } & = {\mathbf{F}}_{k - 1} {\hat{\mathbf{X}}}_{k - 1}^{ + } + {\mathbf{G}}_{k - 1} {\mathbf{u}}_{k - 1} \\ {\hat{\mathbf{X}}}_{k}^{ + } & = {\hat{\mathbf{X}}}_{k}^{ - } + {\mathbf{K}}_{k} \left( {{\mathbf{Y}}_{k} - {\mathbf{H}}_{k} {\hat{\mathbf{X}}}_{k}^{ - } } \right) \\ {\mathbf{P}}_{k}^{ + } & = \left( {{\mathbf{I}} - {\mathbf{K}}_{k} {\mathbf{H}}_{k} } \right){\mathbf{P}}_{k}^{ - } , \\ \end{aligned}$$
(36)

where \({\mathbf{I}}\) is an identity matrix.

For \(k = 3,4, \ldots\), the SKF equations are given as

$$\begin{aligned} {\mathbf{P}}_{k}^{ - } & = \left( {{\mathbf{I}} + {\mathbf{F}}_{k - 1} } \right){\mathbf{P}}_{k - 1}^{ + } \left( {{\mathbf{I}} + {\mathbf{F}}_{k - 1} } \right)^{T} + {\mathbf{F}}_{k - 2} {\mathbf{P}}_{k - 2}^{ + } {\mathbf{F}}_{k - 2}^{T} - \left( {{\mathbf{I}} + {\mathbf{F}}_{k - 1} } \right){\mathbf{S}}_{k - 1} {\mathbf{F}}_{k - 2}^{T} \\ & \quad - \;{\mathbf{F}}_{k - 2} {\mathbf{S}}_{k - 1}^{T} \left( {{\mathbf{I}} + {\mathbf{F}}_{k - 1} } \right)^{T} - \left( {{\mathbf{I}} + {\mathbf{F}}_{k - 1} } \right)\left( {{\mathbf{I}} - {\mathbf{K}}_{k - 1} {\mathbf{H}}_{k - 1} } \right){\mathbf{Q}}_{k - 2} - \\ & {\mathbf{Q}}_{k - 2} \left( {{\mathbf{I}} - {\mathbf{K}}_{k - 1} {\mathbf{H}}_{k - 1} } \right)^{T} \left( {{\mathbf{I}} + {\mathbf{F}}_{k - 1} } \right)^{T} + {\mathbf{Q}}_{k - 1} + {\mathbf{Q}}_{k - 2} \\ {\mathbf{K}}_{k} & = {\mathbf{P}}_{k}^{ - } {\mathbf{H}}_{k}^{T} \left( {{\mathbf{H}}_{k} {\mathbf{P}}_{k}^{ - } {\mathbf{H}}_{k}^{T} + {\mathbf{R}}_{k} } \right)^{ - 1} \\ {\hat{\mathbf{X}}}_{k}^{ - } & = \left( {{\mathbf{I}} + {\mathbf{F}}_{k - 1} } \right){\hat{\mathbf{X}}}_{k - 1}^{ + } - {\mathbf{F}}_{k - 2} {\hat{\mathbf{X}}}_{k - 2}^{ + } + {\mathbf{G}}_{k - 1} {\mathbf{u}}_{k - 1} - {\mathbf{G}}_{k - 2} {\mathbf{u}}_{k - 2} \\ {\hat{\mathbf{X}}}_{k}^{ + } & = {\hat{\mathbf{X}}}_{k}^{ - } + {\mathbf{K}}_{k} \left( {{\mathbf{Y}}_{k} - {\mathbf{H}}_{k} {\hat{\mathbf{X}}}_{k}^{ - } } \right) \\ {\mathbf{P}}_{k}^{ + } & = \left( {{\mathbf{I}} - {\mathbf{K}}_{k} {\mathbf{H}}_{k} } \right){\mathbf{P}}_{k}^{ - } , \\ \end{aligned}$$
(37)

where \({\mathbf{S}}_{k - 1}\) is calculated by Eq. (38):

$$\begin{aligned} {\mathbf{S}}_{k - 1} & = E\left[ {\left( {{\mathbf{X}}_{k - 1} - {\hat{\mathbf{X}}}_{k - 1}^{ + } } \right)\left( {{\mathbf{X}}_{k - 2} - {\hat{\mathbf{X}}}_{k - 2}^{ + } } \right)^{T} } \right] = \left( {{\mathbf{I}} - {\mathbf{K}}_{k - 1} {\mathbf{H}}_{k - 1} } \right) \times \left[ {\left( {{\mathbf{I}} + {\mathbf{F}}_{k - 2} } \right){\mathbf{P}}_{k - 2}^{ + } - {\mathbf{F}}_{k - 3} {\mathbf{S}}_{k - 2}^{T} - {\mathbf{Q}}_{k - 3} \left( {{\mathbf{I}} - {\mathbf{K}}_{k - 2} {\mathbf{H}}_{k - 2} } \right)^{T} } \right] \\ {\mathbf{S}}_{1} & = {\mathbf{P}}_{1} . \\ \end{aligned}$$
(38)

Utilizing the SKF method described above, WiFi and MEMS positioning results can be integrated. In this paper, the corresponding Kalman filter system is originally designed as follows.

The state vector is written as

$${\mathbf{X}}_{k} = \left[ {x_{k} \, y_{k} } \right]^{T} ,$$
(39)

where \(x,y\) are position coordinates of the MU.

The system model is as follows:

$$\left\{ {\begin{array}{*{20}l} {x_{k} = x_{k - 1} + c\left( {x_{{{\text{WiFi}},k}} - x_{{{\text{WiFi}},k - 1}} } \right) + \left( {1 - c} \right)\left( {x_{{{\text{MEMS}},k}} - x_{{{\text{MEMS}},k - 1}} } \right) + b_{x,k - 1} + w_{x,k - 1} } \hfill \\ {y_{k} = y_{k - 1} + c\left( {y_{{{\text{WiFi}},k}} - y_{{{\text{WiFi}},k - 1}} } \right) + \left( {1 - c} \right)\left( {y_{{{\text{MEMS}},k}} - y_{{{\text{MEMS}},k - 1}} } \right) + b_{y,k - 1} + w_{y,k - 1} } \hfill \\ \end{array} } \right.,$$
(40)

where \(x_{\text{WiFi}} ,y_{\text{WiFi}}\) are position coordinates from WiFi results, \(x_{\text{MEMS}} ,y_{\text{MEMS}}\) are position coordinates from MEMS results, \(b_{x} ,b_{y}\) are unknown inputs, \(w_{x} ,w_{y}\) are noise, and \(c\) is a constant parameter (\(0 \le c \le 1\)).

The measurement vector is written as

$${\mathbf{Y}}_{k} = \left[ {\begin{array}{*{20}c} {dx_{{{\text{WiFi}},k}} + \left( {1 - d} \right)x_{{{\text{MEMS}},k}} } \\ {dy_{{{\text{WiFi,}}k}} + \left( {1 - d} \right)y_{{{\text{MEMS}},k}} } \\ \end{array} } \right],$$
(41)

where \(d\) is a constant parameter (\(0 \le d \le 1,d \ne c\)).

The measurement model is as follows:

$${\mathbf{Y}}_{k} = {\mathbf{X}}_{k} + {\mathbf{v}}_{k} ,$$
(42)

where \({\mathbf{v}}_{k}\) is the noise.

6 Experiment Description and Results

To evaluate the performance of the proposed indoor navigation approach, several experiments were conducted. The experiments were performed in the second floor of Block C, New Main Building at Beihang University. The size of the test area is around \(110 \times 30{\text{ m}}^{2}\). There were 326 RPs and 319 positioning points in all. The position coordinates of the starting point of the MU are (0, 0), and the corresponding heading, pitching, and roll angles are (0, 0, 0).

In the WiFi part, the detailed positioning accuracy of different algorithms is listed in Table 1. As shown, the running time and average positioning error of traditional WKNN algorithm are 1.18 s and 1.3248 m, respectively. When using the searching space limiting method and mean filter, the running time on the same device and average positioning error are 0.79 s and 0.9528 m, respectively. Therefore, when applying the proposed WiFi-based navigation algorithm, the running time decreases by 33% and the average positioning error decreases by 28%.

Table 1 WiFi test results

In the MEMS part, the detailed positioning accuracy of different algorithms is compared in Table 2. As depicted, the average positioning error of the proposed PDR-based navigation algorithm (using the EKF with correlated noise) reduces to 0.9534 m compared with 8.2852 m of traditional attitude determination EKF algorithm, showing great improvement.

Table 2 MEMS test results

In WiFi/MEMS integration, the SKF-based approach is applied to the originally designed Kalman filter system. The corresponding parameters are set at

$${\mathbf{Q}}_{k} = diag\left( {\left[ {\begin{array}{*{20}c} 1 & 1 \\ \end{array} } \right]} \right);$$
$${\mathbf{R}}_{k} = {\text{diag}}\left( {\left[ {\begin{array}{*{20}c} 1 & 1 \\ \end{array} } \right]} \right);$$
$${\hat{\mathbf{X}}}_{0}^{ + } = \left[ {\begin{array}{*{20}c} 0 & 0 \\ \end{array} } \right]^{T} ;$$
$${\mathbf{P}}_{0}^{ + } = {\text{diag}}\left( {\left[ {\begin{array}{*{20}c} {0.01} & {0.01} \\ \end{array} } \right]} \right);$$
$$c = 0.4;\quad d = 0.55.$$

WiFi/MEMS positioning results (with “searching space limiting,” “mean filter,” “correlated noise,” and “SKF-based integration”) are depicted in Fig. 4. As shown, the WiFi/MEMS trajectory fits the actual one well.

Fig. 4
figure 4

WiFi/MEMS positioning results

The detailed estimation errors of WiFi/MEMS illustrated above, WiFi (with “searching space limiting” and “mean filter”), and MEMS (with “correlated noise”) are listed in Table 3. As shown, the maximum error, the mean error, and the root mean square (RMS) of position errors are the smallest when using WiFi/MEMS. Therefore, WiFi/MEMS results give the best performance among the three algorithms. The maximum error of WiFi/MEMS is 1.5436 m, which is 56.12% of WiFi and 71.43% of MEMS. The mean error of WiFi/MEMS is 0.6086 m, which is 63.87% of WiFi and 63.83% of MEMS. The RMS of WiFi/MEMS position errors is 0.7015 m, which is 60.05% of WiFi and 60.61% of MEMS.

Table 3 Positioning errors

Furthermore, the error probabilities of these algorithms are depicted in Fig. 5. As shown, the performance of WiFi/MEMS is the best of the three. The cumulative error percentages of WiFi and MEMS are close. In all, this figure proves the advantage of the SKF-based WiFi/MEMS integration approach as well.

Fig. 5
figure 5

Cumulative error percentages

To further optimize the navigation performance of the proposed WiFi/MEMS solution, the number of selected APs is varied and WiFi/MEMS positioning results in different conditions are compared. The detailed estimation errors using different numbers of APs are listed in Table 4. As shown, the maximum error is the smallest when using 20 APs, while the mean error and the RMS of position errors are the smallest when using 14 APs (0.5946 m and 0.6945 m, respectively), which means positioning results using 14 APs have the optimal navigation performance. Since the computation time gets shorter when fewer APs are selected, using 14 APs instead of 20 APs is suggested in the current study.

Table 4 Positioning errors using different numbers of APs

7 Conclusion

This paper proposes a novel improved integrated WiFi/MEMS indoor navigation solution. In WiFi part, a novel searching space limiting approach is originally presented. With searching space limiting and a mean filter, the average positioning error decreases by 28% and the running time decreases by 33% compared with the traditional WKNN method. For PDR solution, an attitude determination EKF with correlated process and measurement noise is presented utilizing the information from triaxial gyroscopes and accelerometers. Through this filter, accurate heading calculation is obtained and the average positioning error decreases greatly. In WiFi/MEMS integration, the SKF approach is introduced into indoor navigation field and a novel Kalman filter system is originally designed to achieve higher accuracy.

With these improvements, the WiFi/MEMS trajectory fits the actual one well in the conducted experiments. The average positioning error of the proposed WiFi/MEMS algorithm is less than 0.6 m when 14 APs are selected. As a result, the proposed WiFi/MEMS integration has been proven in indoor tests, and its performance is illustrated to be very competitive for indoor navigation. Furthermore, it has an easy application on smartphones and a broad market prospect.