To develop the proposed pedestrian navigation system (PNS) the following steps are needed:
In the following sections, each of these points will be examined in depth in order to provide a clear understanding of the used methods.
2.2.1. Sensor Fusion for Device Orientation Estimation
As it is known, each inertial and magnetic sensor measures a specific physical quantity, but can also be used to derive other information such as the ones related to velocity, orientation, position. Due to the errors that are always present in the measurement, the sensor’s information has to be manipulated (e.g., direct integration of the accelerometer data to estimate the velocity) and the cumulative error on the derived information grows with time. A technique that is used to obtain a more accurate information from the one which is obtained by sensors is the fusion. The aim of the sensor fusion technique for the orientation estimation is to obtain a combined information and to define a stable AHRS. The latter allows to represent the sensor data, originally expressed in the sensor body frame, in a reference frame which permits to represent the sensor orientation on the Earth surface, namely the North-East-Down (NED) frame for this work. The operating systems of Android or iOS devices commonly provide information on the orientation as a function of the Euler angles. In this paper, representing the orientation via unitary quaternion was preferred to Euler angles in order to avoid the gimbal lock problem. When dealing with Euler angles, the gimbal lock phenomenon occurs when one of the sensor axes, used to estimate the angles, aligns with the gravity vector causing a loss of information; this scenario can easily occur when the phone is in the pocket. As a result a Madgwick filter was then implemented to merge the accelerometer, gyroscope and magnetometer data. This filter, reported first time in 2010 by Sebastian O.H. Madgwick [
10], represents an efficient way to fuse data for estimating the orientation with respect to a reference fixed navigation frame
<e> using quaternion representation. It uses a gradient-descent algorithm to compute the direction of the gyroscope measurement error as a quaternion derivative [
11]. The main idea behind the Madgwick filter is to evaluate the orientation from the angular velocity of the gyroscope and correct the resulting bias by evaluating the orientation from homogeneous fields, such as Earth magnetic and gravitational fields, and finally perform a compensation of magnetic distortion.
It is possible to consider the quaternion representation for the rate of change of the Earth frame relative to the sensor frame as
where the
accent denotes a normalized vector of the unit length,
is the quaternion representation of the angular rate elements at time
t from gyroscope expressed in
referred to sensor frame, and the symbol ⊗ represents the quaternion product that can be determined using the Hamilton rule:
The quaternion that expresses the orientation of the Earth frame relative to the sensor frame considering only the gyroscope data can be calculated through direct integration as follows:
where
is the sample time.
It is necessary to obtain the orientation from the accelerometer and the magnetometer to compensate for the errors that are made in the integration of the gyro bias. The attitude estimation from the accelerometer or magnetometer is done by using a gradient descent algorithm to solve the following minimization problem. The orientation of the sensor frame, , is that which aligns a predefined reference direction of the field in the Earth’s frame, , with the measured direction of the field in the sensor frame , using the rotation operation
therefore,
, can be determined by solving
where
defines the objective function:
Although there are many optimization algorithms in literature, the gradient descent is one of the commonly implemented [
12].
2.2.2. Step Detection
In order to perform an effective pedestrian dead reckoning algorithm, the design of a procedure capable of determining the occurrence of each step performed by the user becomes crucial. The step identification from the acquired inertial data can be achieved by means of various techniques that are referred in the literature, including the identification of peaks on the acceleration signal, the use of phase-locked loop (PLL) systems to build a signal that is easier to analyze [
13], or the use of wavelet transform to detect the step boundaries over time [
14,
15]. All these systems are based on a preliminary gait analysis: in fact the signals coming from the inertial sensors strongly depend on the area of body in which the device is worn and its relative orientation between this part and the direction of motion. The study done in
Section 2.2.1 allows us not to worry about the orientation as it is possible to bring the data from the sensor body frame to a reference fixed one, so permitting to consider only the area of the body where the device is worn. In this work, the device is considered worn in the pocket of the user who is assumed to perform a walking activity or to remain stationary. Particular actions or movements such as jumping, sitting down or standing up are not taken into consideration in this work.
A discrete Fourier transform (DFT) analysis has been performed off-line on the available data referred to the vertical acceleration in NED frame. The aim of this evaluation is to indicate where the dominant frequencies associated to the step frequency can lie in the frequency domain. The results show a main harmonic component at 1.8 Hz which is used by the system in the real-time implementation to initialize the free running frequency of the PLL. In addition to the main harmonic component, the vertical acceleration presents higher frequency content for several reasons: the oscillatory motion of the pelvis, the vibration due to a device not rigidly attached to the body, and the noise. In order to highlight the main harmonic component associated to the step frequency, the vertical acceleration in the NED frame has been pre-processed through a low-pass filtering operation. A Chebyshev low-pass infinite impulse response (IIR) filter with a cut-off frequency of 15 Hz has been used. Since the group delay of the IIR filer is not constant, the latency introduced by the filtering depends on the frequency of the input signal; for what concerns the input signal considered in this work, the mean latency is about 0.4 s. The cut-off frequency of 15 Hz has been chosen because the principal information content in the frequency domain of the acquired vertical acceleration signal lies on the 0–15 Hz interval, as shown in
Figure 4. Therefore, the frequency content above 15 Hz has been considered as a noise signal.
The main harmonic component of the signal represents the step frequency and each maximum acceleration peak identifies the step event. A suitable PLL has been developed in order to create a sinusoidal signal which is locked in phase to the vertical acceleration signal with a free running frequency close to that considered valid for walking, i.e., equal to 1.8 Hz.
Figure 5 compares the vertical acceleration in the NED frame and the sinusoidal signal that is the output of the PLL. The latter simplifies the identification of the steps occurred by coupling them with the relative maxima in a real-time implementation. In order to avoid that the PLL locks onto signals that are not related to walking, it is useful to implement a logic circuitry that automatically recognizes the carried out activity. Therefore, the variance of the vertical acceleration in the NED frame has been considered to evaluate the motion intensity of the user. In particular, the variance analysis has been performed over a 4-s moving window and the threshold of 1.5 m
2/s
4 has been empirically determined to distinguish the motion activity from the stationary case.
2.2.3. Heading Estimation
The heading angle is defined as the angle between the North direction and the motion direction of the person wearing the device. Estimating the motion direction is the most critical part of a pedestrian inertial navigation system due to the complexity of the body motion and the degrees of freedom of the human body. In fact, the walking motion, that can theoretically change at every single step, is not predictable. There are several ways to deal with this problem; for example, it is possible to fix the position of the inertial sensors in a rigid way at chest level or in a belt in order to be able to have a preferential direction of motion [
14,
15]. This drastically reduces the degrees of freedom of the system, but represents a situation that cannot be reproduced in a common scenario, in fact a phone is normally kept in a pocket or held in the hand during a walk or in an armband for running. For this reason, a system that is independent of the choice of the device location on body is needed. The considered method, which will be described below, exploits the fact that the acceleration data reported in NED frame can be used to determine the direction of motion. Considering the phone worn on the upper part of the leg, then the acceleration values in the North and East directions are related to the direction of motion and can be used to determine the heading angle. As reported in [
13], by analyzing the accelerations on the North and East axes in the NED frame (
and
) at each couples of steps, it is possible to identify pseudo-ellipses, as shown in
Figure 6.
Even if the shape of the double ellipse is not exactly reproduced at each pair of steps, it is still possible to determine the direction of the motion quite clearly within a tip-to-tail method, except in the case of irregular steps. This method is based on the direct use of the filtered acceleration data. Despite the implementation of the filter, it is possible that the signal is distorted by harmonics higher than that relating to the dynamics of the steps. The idea behind the real-time implementation of this method is to find a direct formula that can provide the heading angle starting from the Fourier series decomposition of the input planar acceleration signal. It is well known from theory that any periodic signal can be decomposed into the sum of an infinite set of simple oscillating functions, namely sines and cosines. Though the walking signal is not periodic, however, if the period of the single step and consequently its frequency can be determined with some accuracy, it is possible to consider a periodic extension of this signal on which applying the Fourier series decomposition that is valid only in the considered step period. An accurate step tracking system using a PLL to analyze acceleration data can relate the steps taken with the stride characteristics, thereby providing a trigger signal for the forward direction estimation algorithm.
The Fourier series at each single step detect is defined as:
where the subscript
k identifies the number of the step occurred,
is the period of the last detected step that can be calculated as the time between the start of the step (
) and its end, that is also the start of the next step (
):
and
are the so called Fourier coefficients that are computed as follows:
where
n is the number of harmonics considered for the approximation. With this method the direction estimate takes place considering only the time interval of the last step and not of the last two as for the previously described method. Let
be the planar acceleration vector
and considering the first harmonic of the corresponding Fourier series
where
It can be shown that Equation (
10) represents an ellipse centered at the origin whose principle axis is rotated by a certain angle. Indeed, it is possible to rewrite (
10) as
where the four values of integrals described in (
8) become
Now the objective is to find a relationship between the four values of the integrals and the inclination angle of the rotated ellipse that represents the direction of motion. This problem can be solved under the following assumption (1st order approximation):
Referring to
Figure 7, the goal is to find the point
, where
To this aim, the square of the 2-norm of the planar acceleration can be approximated as
Finally, assuming
and exploiting common trigonometric formulas yields
In order to find the time
corresponding to the maximal value of the planar acceleration, it is necessary to set to zero the derivative with respect to time
which yields
By substituting the actual values of
,
A,
B it is possible to write
as a function of the four integrals
where the correct solution is the first one providing a negative second order derivative
Finally, considering the point
, the heading angle in the NED frame results in
By averaging two consecutive values of the heading angle, it is possible to obtain a smoothed signal for which the occurring spikes or errors given by the pelvis rotation during walking are reduced.
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 (
) and heading angle (
) is available each time a new step is detected [
18,
19]. Let
and
the position of the device in the reference system at
k-th step detected, the PDR technique expresses its evolution as
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 gives information 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.