Introduction

With the success of smartphones and other smart mobile devices, position and navigation information are key features for these smart devices when considering location-based service (LBS) (Liu et al. 2012; Lou 2012; Paziewski 2020). global navigation satellite system (GNSS) chips are usually embedded in smartphones to provide navigation solutions. When there are enough in-view satellites, the GNSS chip-scale receiver can provide satisfying navigation solutions (Zhang et al. 2018; Gao and Groves 2018). However, for some smartphone applications, GNSS signals might be unavailable, such as in indoor environments (Kuusniemi and Lachapelle 2004; Paziewski et al. 2019; Specht et al. 2020; Yong et al. 2021). Therefore, an alternative is to develop a multi-sensor integration position and navigation system (Chen et al. 2010.). There are many other sensors embedded in a smartphone, such as an inertial measurement unit (IMU), barometer, light sensor, camera, LiDAR, compass, WIFI, and Bluetooth (Li et al. 2016, 2015, 2017; Zhuang et al. 2015; Chen et al. 2015). These sensors can generate navigation solutions under different conditions; for example, GNSS is suitable for outdoor environments; IMU is feasible for all environments, but the position errors accumulate exponentially over time; WIFI signals are usually only available indoors.

There are many studies on seamless position systems with smartphones (Chen et al. 2015; Li et al. 2015, 2017; Basso et al. 2021). For outdoor applications (Basso et al. 2021; Angrisano et al. 2019), GNSS and IMU-based pedestrian dead reckoning (PDR) are the major positioning solutions. PDR processes the accelerometer and gyroscope measurements for detecting the step or the zero-velocity state (Zhu et al. 2019; Cho and Park 2019; Zeng et al. 2018). In smartphone applications, accelerometer measurements are typically utilized to detect the step. The heading angle is jointly estimated with a gyroscope, accelerometer, and magnetometer, and then the heading angle is utilized to update the PDR position with the step information (Yan et al. 2021; Ye et al. 2019). Therefore, the key factors determining the PDR accuracy are step detection, step length, and heading angle. The PDR position errors usually accumulate over time due to the step length, heading angle, and step detection errors. Abundant research has been conducted to improve step detection, step length estimation, and heading angle estimation (Ho et al. 2016; Park et al. 2017; Poulose et al. 2019; Chen et al. 2011). In addition, integrating the GNSS and PDR is another effective solution for smartphone-based pedestrian navigation for outdoor applications (Rehman et al. 2020; Basso et al. 2021). GNSS and PDR are naturally complementary. While GNSS works under normal conditions, it can compensate for the accumulated PDR position errors, and when GNSS is unavailable, PDR can provide navigation solutions (Rehman et al. 2020; Basso et al. 2021).

The Kalman filter (KF) is typically utilized to fuse the position from the GNSS and PDR (Rehman et al. 2020; Basso et al. 2021; Angrisano et al. 2019), and the KF works in a recursive manner for real-time applications. However, according to the Bayes theorem, the KF is constructed based on first-order Markov assumptions (Wen et al. 2021; Watson and Gross 2017). PDR works similarly to an odometer, and the step-by-step increments determine the ultimate position accuracy. Factor graph optimization (FGO) is a feasible method to optimize state estimation with a graphic model and iterative solver (Wen et al. 2021; Watson and Gross 2017). In the FGO, the relationship between the state and measurements is represented with a graphic model, and then the state estimation is converted to a nonlinear least square problem (Watson and Gross 2017). A cost function is constructed with constraints from the factors, and an iterative solver, such as the Gauss–Newton iteration method or the Levenberg–Marquardt method (Watson and Gross 2017), is utilized to find the optimal estimation by minimizing the cost function. With the motivation to inspire more interesting research in smartphone-based location and position technology, we develop an FGO-based smartphone PDR/GNSS integration method and compared it with the standalone GNSS- and KF-based integration methods for validating FGO advantages. Our contributions are summarized as follows:

  1. 1.

    Based on the GTSAM graph optimization library, we first develop a FGO-PDR/GNSS integration system for pedestrian navigation. Comparisons between the FGO-PDR/GNSS and the KF-PDR/GNSS are also carried out in this work.

  2. 2.

    The KF-PDR/GNSS and FGO-PDR/GNSS source codes are released publicly, and a detailed user manual and an example are provided together to illustrate the mechanism and how to run the code clearly. We sincerely hope the software can inspire more studies on smartphone-based navigation systems. PDR is the fundamental cornerstone to developing a smartphone-based seamless position system, and the codes are suitable for integrating PDR with more sensors and measurements, such as WIFI and Bluetooth.

The remaining sections describe the methodology, including the PDR mechanism, the step detection, step length estimation, and the position updating; then, the KF-PDR/GNSS integration is introduced; the following section describes the FGO method and the FGO-PDR/GNSS integration; the experimental section presents a testing case, and the results are revealed together with in-depth analysis. Finally, the conclusion is given.

Methodology

In this section, we present the PDR details and Kalman filter-based PDR/GNSS integration method. PDR is characterized by three critical parts: step detection, step length estimation, and position updating. Step detection and step length estimation are carried out by processing the accelerometer measurements, and the position is updated reclusively with an additional heading angle. In view of the fact that PDR position errors accumulate over time, the methodology of KF-PDR/GNSS integration is introduced.

PDR

In PDR, the position is calculated with the estimated step length and the heading angle. The position updating is expressed by

$${\mathbf{p}}_{k + 1} = {\mathbf{p}}_{k} + \Delta {\mathbf{p}}_{k,k + 1}$$
(1)
$$\Delta {\mathbf{p}}_{k,k + 1} = \left[ \begin{gathered} \Delta {\mathbf{p}}_{k,k + 1}^{E} \hfill \\ \Delta {\mathbf{p}}_{k,k + 1}^{N} \hfill \\ \end{gathered} \right] = \left[ \begin{gathered} SL_{k,k + 1} \cdot \cos \left( \phi \right) \hfill \\ SL_{k,k + 1} \cdot \sin \left( \phi \right) \hfill \\ \end{gathered} \right]$$
(2)

where \({\mathbf{p}}_{k + 1}\) and \({\mathbf{p}}_{k}\) denote the position at step \(k\) to \(k + 1\); \(\Delta {\mathbf{p}}_{k,k + 1}\) denotes the position increment from step \(k\) to \(k + 1\); \(\Delta {\mathbf{p}}_{k,k + 1}^{E}\) and \(\Delta {\mathbf{p}}_{k,k + 1}^{N}\) denote the position increments of the east and north directions; \(SL_{k,k + 1}\) refers to the step length from step \(k\) to \(k + 1\); and \(\phi\) denotes the heading angle.

As mentioned in (1–2), the step detection, step length, and heading angle are the key factors determining the PDR accuracy. Many algorithms have been proposed to detect the steps, and in the strategy, we utilize the three-axis accelerometer measurements to detect the step. The summarized three-axis accelerometer measurement calculation is expressed as

$${\text{acc}}\_{\text{mag}}_{k} = \sqrt {\left( {{\text{acc}}_{{x_{k} }}^{2} + {\text{acc}}_{{y_{k} }}^{2} + {\text{acc}}_{{z_{k} }}^{2} } \right)}$$
(3)

where \({\text{acc}}_{{x_{k} }}\),\({\text{acc}}_{{y_{k} }}\), and \({\text{acc}}_{{z_{k} }}\) denote the three-axis accelerometer measurements, and the steps are determined by detecting the signal peaks and valleys of \({\mathbf{acc\_mag}}\) during the detection window.

In terms of the step length estimation, we utilize the Weinberg algorithm (Weinberg 2002), in which the step length is expressed as

$$SL_{k,k + 1} = L \cdot \left[ {\max \left( {{\mathbf{acc\_mag}}} \right) - \min \left( {{\mathbf{acc\_mag}}} \right)} \right]^{\frac{1}{4}}$$
(4)

where \(L\) is a constant, \({\mathbf{acc\_mag}}\) denotes the accelerometer measurements during a detection window, and the functions \(\max \left( \cdot \right)\) and \({\text{m}} {\text{in}}\left( \cdot \right)\) denote finding the maximum and minimum values, respectively.

Kalman filter

Denoting the position errors of the PDR as \({\mathbf{x}}\), the state transformation of the PDR/GNSS integration is expressed as

$${\mathbf{x}}_{k + 1} = {\mathbf{F}}_{k,k + 1} \cdot {\mathbf{x}}_{k} { + }{\mathbf{w}}_{k + 1}$$
(5)
$${\mathbf{z}}_{k + 1} = {\mathbf{p}}_{k + 1}^{GNSS} - {\mathbf{p}}_{k + 1}^{PDR} = {\mathbf{H}}_{k,k + 1} \cdot {\mathbf{x}}_{k + 1} { + }{\mathbf{v}}_{k + 1}$$
(6)

where \({\mathbf{F}}_{k,k + 1} { = }\left[ \begin{gathered} 1{ 0} \hfill \\ 0 \, 1 \hfill \\ \end{gathered} \right]\) refers to the state propagation matrix; \({\mathbf{H}}_{k + 1} { = }\left[ \begin{gathered} 1 \, 0 \hfill \\ 0 \, 1 \hfill \\ \end{gathered} \right]\) denotes the observation matrix; \({\mathbf{z}}_{k + 1}\) denotes the measurement vector; \({\mathbf{w}}_{k + 1}\) refers to the process noise vector; it is assumed to be subject to a standard Gaussian distribution, which is expressed as \({\mathbf{w}}_{k + 1} \sim {\text{N}}\left( {0,{\mathbf{Q}}} \right)\); \({\mathbf{Q}}\) denotes the covariance matrix of the process noise; \({\mathbf{v}}_{k + 1}\) is the measurement noise vector, which is also assumed to be subject to a Gaussian distribution, and the distribution is expressed as \({\mathbf{v}}_{k + 1} \sim {\text{N}}\left( {0,{\mathbf{R}}} \right)\); and \({\mathbf{R}}\) denotes the convenience of the measurement noise. Therefore, the five equations for the KF are summarized as

$${\mathbf{x}}_{{k + {1}}}^{ - } = \, {\mathbf{F}}_{k,k + 1} \cdot {\mathbf{x}}_{k} \,$$
(7)
$${\mathbf{P}}_{k + 1}^{ - } = {\mathbf{F}}_{k,k + 1} \cdot {\mathbf{P}}_{k} \cdot \left( {{\mathbf{F}}_{k,k + 1} } \right)^{T} + {\mathbf{Q}}_{k}$$
(8)
$${\hat{\mathbf{x}}}_{k + 1} = {\mathbf{x}}_{{k + {1}}}^{ - } + {\mathbf{K}}_{{k{ + 1}}} \cdot \left( {{\mathbf{z}}_{{k{ + 1}}} - {\mathbf{H}}_{k + 1} \cdot {\mathbf{x}}_{{k + {1}}}^{ - } } \right)$$
(9)
$${\mathbf{K}}_{k + 1} = {\mathbf{P}}_{k + 1}^{ - } \cdot \left( {{\mathbf{H}}_{k + 1} } \right)^{T} \left[ {{\mathbf{H}}_{k + 1} \cdot {\mathbf{P}}_{k + 1}^{ - } \left( {{\mathbf{H}}_{k + 1} } \right)^{{\text{T}}} {\mathbf{ + R}}_{k + 1} } \right]^{ - 1}$$
(10)
$${\mathbf{P}}_{k + 1}^{{}} = \left( {{\mathbf{I}}_{2 \times 2} - {\mathbf{K}}_{k + 1} \cdot {\mathbf{H}}_{k + 1} } \right) \cdot {\mathbf{P}}_{k + 1}^{ - }$$
(11)

where \({\mathbf{x}}_{{k + {1}}}^{ - }\) is the predicted state through the state propagation model, \({\mathbf{P}}_{k}\) is the covariance matrix of the predicated state, \({\mathbf{K}}_{k + 1}\) denotes the Kalman gain matrix, \({\mathbf{I}}_{2 \times 2}\) denotes the identity matrix, and \({\hat{\mathbf{x}}}_{k + 1}\) denotes the ultimately estimated state.

Factor graph optimization

FGO models the sensor fusion with a probabilistic graph and converts the state estimation to a nonlinear least square problem. Ceres, G2O, and GTSAM are commonly used libraries to solve for the optimal estimation with the nonlinear least square equation (Dellaert 2012; Grisetti et al. 2011). Some researchers have explored the advances of the FGO compared with the KF, and the FGO advantages are summarized (Wen et al. 2021; Watson and Gross 2017). In our strategy, we fuse the GNSS and the PDR position from a smartphone with FGO. Since the PDR position errors accumulate with increasing steps, FGO characterizing optimizing the past states and current state together is more feasible for PDR/GNSS integration. Figure 1 shows the graphic structure of the FGO-PDR/GNSS integration. The states and measurements are correlated. According to Bayes’ theorem, the probability relationship among the measurements and states can be expressed as (Meinhold and Singpurwalla 1983; Li et al. 2018; Jiang et al. 2022):

$$\begin{gathered} P\left( {{\mathbf{x}}_{0:k} |{\mathbf{z}}_{1:k} } \right) = \frac{{P\left( {{\mathbf{z}}_{k} |{\mathbf{x}}_{k} } \right)P\left( {{\mathbf{x}}_{k} |{\mathbf{x}}_{k - 1} } \right)}}{{P\left( {{\mathbf{z}}_{k} |{\mathbf{z}}_{1:k - 1} } \right)}}.P\left( {{\mathbf{x}}_{0:k - 1} |{\mathbf{z}}_{1:k - 1} } \right) \hfill \\ {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} = \frac{{P\left( {{\mathbf{z}}_{k} |{\mathbf{x}}_{k} } \right)P\left( {{\mathbf{x}}_{k} |{\mathbf{x}}_{k - 1} } \right)}}{{P\left( {{\mathbf{z}}_{k} |{\mathbf{z}}_{1:k - 1} } \right)}}.\frac{{P\left( {{\mathbf{z}}_{k - 1} |{\mathbf{x}}_{k - 1} } \right)P\left( {{\mathbf{x}}_{k - 1} |{\mathbf{x}}_{k - 2} } \right)}}{{P\left( {{\mathbf{z}}_{k - 1} |{\mathbf{z}}_{1:k - 2} } \right)}}.P\left( {{\mathbf{x}}_{0:k - 1} |{\mathbf{z}}_{1:k - 1} } \right) \hfill \\ {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} = \frac{{P\left( {{\mathbf{z}}_{k} |{\mathbf{x}}_{k} } \right)P\left( {{\mathbf{x}}_{k} |{\mathbf{x}}_{k - 1} } \right)}}{{P\left( {{\mathbf{z}}_{k} |{\mathbf{z}}_{1:k - 1} } \right)}}.\frac{{P\left( {{\mathbf{z}}_{k - 1} |{\mathbf{x}}_{k - 1} } \right)P\left( {{\mathbf{x}}_{k - 1} |{\mathbf{x}}_{k - 2} } \right)}}{{P\left( {{\mathbf{z}}_{k - 1} |{\mathbf{z}}_{1:k - 2} } \right)}}. \cdots \hfill \\ {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} \frac{{P\left( {{\mathbf{z}}_{1} |{\mathbf{x}}_{1} } \right)P\left( {{\mathbf{x}}_{1} |{\mathbf{x}}_{0} } \right)}}{{P\left( {{\mathbf{z}}_{1} } \right)}}.P\left( {{\mathbf{x}}_{0} } \right) \hfill \\ {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} = \mathop \prod \limits_{i = 1}^{k} {\kern 1pt} \frac{{P\left( {{\mathbf{z}}_{i} |{\mathbf{x}}_{i} } \right)P\left( {{\mathbf{x}}_{i} |{\mathbf{x}}_{i - 1} } \right)}}{{P\left( {{\mathbf{z}}_{1} |{\mathbf{z}}_{1:i - 1} } \right)}}.P\left( {{\mathbf{x}}_{0} } \right) \hfill \\ \end{gathered}$$
(12)
Fig. 1
figure 1

Factor graph for GNSS/PDR integration

Then, equation (12) can be simplified as:

$$\mathop \prod \limits_{i = 1}^{k} {\kern 1pt} \frac{{P\left( {{\mathbf{z}}_{i} |{\mathbf{x}}_{i} } \right)P\left( {{\mathbf{x}}_{i} |{\mathbf{x}}_{i - 1} } \right)}}{{P\left( {{\mathbf{z}}_{1} |{\mathbf{z}}_{1:i - 1} } \right)}}.P\left( {{\mathbf{x}}_{0} } \right) \propto \mathop \prod \limits_{i = 1}^{k} {\kern 1pt} P\left( {{\mathbf{z}}_{i} |{\mathbf{x}}_{i} } \right)P\left( {{\mathbf{x}}_{i} |{\mathbf{x}}_{i - 1} } \right)$$
(13)

where \(P\left( \cdot \right)\) is the probability function and the optimal estimation of the state can be converted to find the maximum values of \(\mathop \prod \limits_{i = 1}^{k} {\kern 1pt} P\left( {{\mathbf{z}}_{i} |{\mathbf{x}}_{i} } \right)P\left( {{\mathbf{x}}_{i} |{\mathbf{x}}_{i - 1} } \right)\). Specifically, for PDR/GNSS integration, there are two factors: PDR and GNSS.

1) PDR Factor.

With the PDR algorithm shown in (1) and (2), the PDR factor is expressed as

$$\begin{aligned} \left\| {{\mathbf{e}}_{{k + 1}}^{{PDR}} } \right\|_{{\Sigma _{{k + 1}}^{{PDR}} }}^{2} = & \left\| {{\mathbf{x}}_{{k + 1}} - f\left( {{\mathbf{x}}_{k} } \right)} \right\|_{{\Sigma _{{k + 1}}^{{PDR}} }}^{2} \\ = & \left\| {{\mathbf{x}}_{{k + 1}} - \left( {{\mathbf{x}}_{k} {\text{ + }}\left[ \begin{gathered} SL_{{k,k + 1}} \cdot \cos \left( \phi \right) \hfill \\ SL_{{k,k + 1}} \cdot \sin \left( \phi \right) \hfill \\ \end{gathered} \right]} \right)} \right\|_{{\Sigma _{{k + 1}}^{{PDR}} }}^{2} \\ \end{aligned}$$
(14)

2) GNSS Factor.

In our strategy, the GNSS provides the position, and the GNSS factor is expressed as:

$$\left\| {{\mathbf{e}}_{k + 1}^{GNSS} } \right\|_{{\Sigma_{k + 1}^{GNSS} }}^{2} = \left\| {{\mathbf{x}}_{k + 1} - {\mathbf{p}}_{k + 1}^{GNSS} } \right\|_{{\Sigma_{k + 1}^{GNSS} }}^{2}$$
(15)

Denoting the optimal estimates \({\mathbf{x}}^{*} = \left[ {{\mathbf{x}}_{1}^{*} ,{\mathbf{x}}_{2}^{*} ,...,{\mathbf{x}}_{k + 1}^{*} } \right]\), \({\mathbf{x}}^{*}\) estimation can be expressed as

$${\mathbf{x}}^{*} = \arg \min \left( {\sum\limits_{i}^{k} {\left( {\left\| {{\mathbf{e}}_{i + 1}^{PDR} } \right\|_{{\Sigma_{i + 1}^{PDR} }}^{2} { + }\left\| {{\mathbf{e}}_{i + 1}^{GNSS} } \right\|_{{\Sigma_{i + 1}^{GNSS} }}^{2} } \right)} } \right) \,$$
(16)

where \(\left\| \cdot \right\|\) refers to the Mahalanobis norm, the optimal states are obtained by minimizing the cost function, and in our code, we utilize the Levenberg–Marquardt method to solve for the optimal estimates.

Experiments and results

In this section, a dynamic experiment is carried out in a sport track to quantitively assess the performance of the position errors of the proposed method. We utilize a Huawei Mate 40 Pro handset to carry out the experiments. The smartphone GNSS and accelerometer measurements collection and processing are presented. Experimental results are presented, i.e., the position errors from GNSS, KF-GNSS/PDR and FGO-GNSS/PDR.

Data collection description

The specifications of the Huawei Mate 40 Pro are listed in the datasheet, and it has a GNSS, accelerometer, gyroscope, compass, ambient light sensor, etc. Moreover, its GNSS-embedded GNSS module supports multi-GNSS multifrequency signals such as GPS L1 + L5, GLONASS, BeiDou B1I + B1C + B2a + B2b, GALILEO E1 + E5a + E5b, and QZSS L1 + L5. Its accelerometer updating frequency is 100 Hz, and the gyroscope updating frequency is 50 Hz. We utilize an open-source app to collect the raw measurements from the sensors, including the angular rates, acceleration, and multi-constellation multifrequency GNSS position (Jiménez et al. 2019). The format of the dataset is shown in the literature (Jiménez et al. 2019). Furthermore, Python software is utilized to separate the sensors’ measurements into individual files for further processing.

The data collecting equipment is shown in Fig. 2, and we fix the Novatel SPAN-CPT in a box. We simultaneously collect the GNSS and IMU raw measurements with Novatel Connect software. After postprocessing raw measurements from the IMU and GNSS with the Novatel Inertial Explorer 8.0 (IE 8.0), a reference trajectory is generated with better than 2 cm horizonal position accuracy.

Fig. 2
figure 2

Dataset collection example

Sport-track experiment with handheld smartphones

The track experiments were carried out in the Kirkkonummi sports park. By carrying the SPAN-CPT system, the tester walked clockwise along the track of the 400-m sports ground for two circles. The time length of the dataset is approximately nine minutes. The handheld smartphone experimental results are presented in Figs. 3 and  4. Figure 3 presents the trajectories of the reference, GNSS standalone solution, KF-PDR/GNSS integration solution, and FGO-PDR/GNSS integration solution. Figure 4 presents the horizontal position errors and the detailed analysis. Specifically, Fig. 4a shows the horizontal error curves against time, and Fig. 4b shows the statistical analysis. It can be observed that the FGO-PDR/GNSS integration method evidently reduces the position errors. Moreover, the statistical results are listed in Table 1, including the median and mean values. Compared with the GNSS, the mean values of the horizontal position errors from the FGO-PDR/GNSS decrease by 40.8%, and the median (50%) values decrease by 47.2%.

Fig. 3
figure 3

Trajectories

Fig. 4
figure 4

Horizontal position errors with respect to time (top); horizontal position errors statistical analysis (bottom)

Table 1 Statistical analysis of the horizontal position errors

Conclusions

We develop open-source smartphone PDR/GNSS integration software, and both a KF and FGO are implemented. An experimental test is carried out to assess the performance of the software, and the results demonstrate the effectiveness of the integration method. It can be concluded that the FGO method has great potential in improving position accuracy.

Although the preliminary results support the effectiveness of the software implemented, there remain future works of great significance for further investigation.

  1. 1.

    There is no integrity analysis of the GNSS navigation solutions and the integration module in this software. In fact, to guarantee the performance of integration in GNSS signal challenging environments, an integrity analysis or fault detection module is indispensable. It is interesting to carry out integrity analysis or fault detection considering the characteristics of the FGO.

  2. 2.

    Here, in our strategy, we directly fuse the PDR and GNSS position with the KF or FGO. Actually, it is prospective to implement tight integration of GNSS and PDR specifically, fusing the PDR and GNSS with the pseudorange measurements. In addition, we employ the PDR position in the integration, which is affected by the step length and heading angle; there are some prospective methods to improve the PDR measurement quality, such as utilizing the velocity from the GNSS to correct the heading angle and constructing the model directly using the step distance constraints instead of the PDR position to optimize the GNSS.

  3. 3.

    Currently, almost everyone has a smartphone, and cooperative PDR with multiple agents is possible; distance measurements between the multiple agents are added to the model, optimizing the position estimation.

We develop and open smartphone PDR/GNSS integration software to inspire more interesting work on pedestrian navigation with PDR and GNSS. Additionally, the software can help readers understand the PDR and its integration with the GNSS. The codes are implemented in MATLAB and released on the GPS Toolbox website at https://geodesy.noaa.gov/gps-toolbox/. Additionally, you can contact the authors (yuwei.chen@nls.fi and changhui.jiang@nls.fi) for the datasets and the codes.