# A Real-Time GNSS/PDR Navigation System for Mobile Devices
## 2 Materials and Methods
### Methods
#### 2.2.6 GNSS/PDR Integration  
By estimating the step length and the heading angle, it is possible to determine the user's trajectory by using pedestrian dead reckoning techniques, where the information of step length (\(Sl_{k}\)) and heading angle (\(\theta_{k}\)) is available each time a new step is detected [18; 19]. Let \(x_{k}\) and \(y_{k}\) the position of the device in the reference system at \(k\)-th step detected, the PDR technique expresses its evolution as  
\[\begin{cases}x_{k+1}=x_{k}+Sl_{k}\cos\theta_{k}\\ y_{k+1}=y_{k}+Sl_{k}\sin\theta_{k}\,.\end{cases} \tag{24}\]  
In this algorithm, it is evident that the estimation of the step length plays a fundamental role: small errors on this parameter, being added step by step, can lead to large errors in the reconstruction of the path on the map. On the other hand, errors on the heading angle, as expected, can lead to a deviation from the true path.  
The PDR technique alone is not able to perform an absolute positioning of the device, and therefore must necessarily be integrated with a satellite navigation system. A global navigation satellite system (GNSS) can be used to integrate a PDR and correct errors that accumulate over time, but nevertheless it causes a high energy consumption in mobile devices and the accuracy of its readings are highly dependent on the operational context as it is based on the use of an infrastructure, i.e., how many satellites are visible in the constellation and the quality of the received signals. For these reasons, it is useful to implement a filter that merges the data coming from the inertial sensors with the satellite ones, as shown in detail in [17]. The proposed Kalman filter (KF) does not evolve at each sampling time, but that is executed following a trigger event, which in this case is provided by the procedure of the step detection. It is also right to underline the fact that the signals coming from the PDR and GNSS are generally asynchronous, in fact the PDR processes information at each step detected, while the GNSS data can usually update at 4 Hz as maximum frequency and as mentioned will not always be available. With an extrapolation technique it is possible associate last valid data from GNSS measurement with last step occurred. In this application, a GNSS signal is constantly acquired and a signal that givesinformation about its validity is associated to. To correctly implement the KF, a signal that triggers the failure of the GNSS is necessary. There are two different solutions to implement the lost of signal and both refers to a multi-rate KF:  
* _covariance-varying approach:_ when no GNSS signals are available, it can be modeled as a sensor with a high covariance matrix related on its measure, so by varying the covariance the KF will not consider the readings in its update [20];
* _size-varying approach:_ when no GNSS signals are available, it can be modeled as a changing of the number sensor used for measurement and as consequence the dimension of measurement equations and its covariance matrix will change [21]. A size-varying approach was chosen in order to implement two different strategies:
* _best performance algorithm:_ the KF continuously uses the satellite data, when present, by correcting the positioning errors deriving from the estimate that is made using only inertial data;
* _energy-saving algorithm:_ the KF uses the satellite data at regular time intervals in order to allow the satellite receiver to be switched off.  
Thus, the designed structure of the filter can be seen as a state machine that evolves every time a new step is detected and has a different behavior depending on the presence or not of the satellite data. Furthermore, between one restart and the subsequent one of the GNSS, it is possible to implement a compensation strategy of the systematic errors that are committed on the determination of the estimate of the step length and the heading angle [17]. Figure 8 shows a block diagram of the operating principle of the described filter.