- Open Access
Pedestrian dead reckoning for MARG navigation using a smartphone
EURASIP Journal on Advances in Signal Processing volume 2014, Article number: 65 (2014)
The demand for navigating pedestrian by using a hand-held mobile device increased remarkably over the past few years, especially in GPS-denied scenario. We propose a new pedestrian dead reckoning (PDR)-based navigation algorithm by using magnetic, angular rate, and gravity (MARG) sensors which are equipped in existing commercial smartphone. Our proposed navigation algorithm consists of step detection, stride length estimation, and heading estimation. To eliminate the gauge step errors of the random bouncing motions, we designed a reliable algorithm for step detection. We developed a BP neural network-based stride length estimation algorithm to apply to different users. In response to the challenge of magnetic disturbance, a quaternion-based extended Kalman filter (EKF) is introduced to determine the user's heading direction for each step. The performance of our proposed pedestrian navigation algorithm is verified by using a smartphone in providing accurate, reliable, and continuous location tracking services.
A large number of navigation systems, such as GPS, can only be applied to the outdoor and open sky scenarios since the microwaves are easily blocked by the buildings and ground. To solve this problem, the multi-MEMS inertial sensor-based navigation systems are more favored in recent 5 years [1, 2]. Inertial sensors are independent of the external information, involve no radiation energy to the environment, and require no external reference frame. On this basis, it can be recognized as an autonomous navigation system providing location, heading, and attitude angle [3, 4]. The navigation information obtained from the inertial system is featured with continuity, high data-updating rate, good short-term accuracy, and stability. The magnetic, angular rate, and gravity (MARG) sensors involved in MEMS technology have been widely used in smartphones for pedestrian inertial navigation and are expected to become one of the key components of a variety of localization and tracking systems [5, 6].
As far as we know, the pedestrian inertial navigation systems are normally based on pedestrian dead reckoning (PDR) algorithm which is independent of the integration of acceleration values. Based on the physiological characteristics of pedestrian movement, we can use the cyclical characteristics and statistics of acceleration waveform and features which are associated with the walking speed to estimate the stride length. Moreover, the heading is obtained from the integration of gyroscope or from the combination of magnetometer and accelerometer. Due to the randomness of pedestrian hand-held way, the attitude angle of a smartphone cannot be constant. Hence, the accuracy of heading can be guaranteed only after the real-time attitude angle has been calculated. Therefore, the way to obtain an accurate attitude angle solution in different environmental conditions without the external absolute reference signals forms one of the significant challenges to be concerned [7, 8].
There are two categories of algorithms for attitude angle updating by using the angular rate of gyroscope: the Euler angle algorithm and the quaternion algorithm. The Euler angle algorithm relies on the Euler angle differential equations to calculate the yaw, pitch, and roll angles. Since the pitch angle in Euler angles can result to degenerations, the yaw and roll angles cannot be determined uniquely when the pitch angle is close to 90°. The quaternion algorithm avoids the singularity problem involved in Euler angles by solving four linear differential equations. On this basis, the quaternion algorithm is featured with simple computation cost and is easy to be operated for a wide application. In quaternion algorithm, since the gyroscope is suffered by the accumulated measurement errors, it is not effective to measure the angles over a long period of time. To obtain a stable and reliable attitude angle, the gyroscope should be integrated with accelerometer and magnetometer. To this end, the complementary filter, Kalman filter, and gradient descent algorithm are widely used to conduct data fusion. The work in  proposed the quaternion-based gradient descent algorithm to merge the measured absolute angle and angular velocity and then obtain three degrees of freedom (DOF) for attitude measurement. The algorithm in  is simple and is easy to be implemented, but the related accuracy performance is not good. The quaternion-based extended Kalman filter (EKF) algorithm in  is recognized to be more accurate, but more system state vectors and higher computation cost are required, which is not appropriate for the real-time processing on a smartphone platform. There is significant accuracy deterioration by using the aforementioned conventional algorithms when a large linear acceleration occurs or the magnetometer is seriously interfered by the surrounding noise, such as the blocking by iron products. To solve this problem, this paper shows a new pedestrian dead reckoning-based MARG navigation algorithm, which is highly accurate and is easy to be implemented on smartphones.
This paper is organized as follows. Section 2 gives the system framework. Section 3 presents the algorithms for step detection and stride length estimation. The heading estimation algorithm is discussed in Section 4. Section 5 shows some testing results and the related discussion. Finally, we conclude this paper in Section 6.
2 System framework
Our system is based on the PDR algorithm which is recognized as a relative positioning algorithm, as shown in Figure 1[11–15]. In Figure 1, notations E and N denote the east and north directions, respectively.
where θ i and d i (i = 1,.., k) stand for the heading angle and the stride length of step i. Hence, the user's position coordinates can be calculated by (1) as soon as the parameters d i and θ i are estimated.
The system architecture is shown in Figure 2. In concrete terms, we first conduct low-pass filtering to smooth the modulus of the three-axis accelerometer data. Second, the filtered accelerometer data is used to detect the user's steps for location updating. Third, the empirical model is applied to estimate the pedestrian stride length as the displacement between every two adjacent positions. Fourth, using the quaternion-based extended Kalman filter, we merge the data collected from MARG sensors to calculate the quaternion rotation matrix. Fifth, after the Butterworth low-pass filtering, we obtain a stable heading angle for each step. Finally, the PDR algorithm is performed to calculate the user's locations in a real-time manner.
3 Step detection and stride length estimation
Based on the physiological characteristics of the pedestrian, the waveform for the three-axis accelerometer modulus values can be obtained for the formation of cyclical changes. Therefore, the cyclical and characteristic values can be used to detect the steps. We calculate the three-axis accelerometer modulus values in (2).
where a x , a y , and a z are the output data of triaxial accelerometer in the X, Y, and Z directions respectively. Then, we can obtain a single peak curve of accelerometer modulus by using a digital low-pass filter, detect the peak point accurately, and consequently calculate the step number. Some small jitters could be produced during walking when the pedestrian is holding the phone. On this basis, the peaks appear in the output waveform of accelerometer modulus values, as shown in Figure 3. We set a threshold to eliminate the gauge errors of steps which resulted from the shaking of smartphone, such that
where ΔT stands for the time interval between every two adjacent peaks, g is the local acceleration of gravity. TTh and ATh stand for the time threshold and the peak threshold, respectively.
where Amax and Amin stand for the maximum and minimum of modulus values of accelerometer which are obtained from the step detection. C is the proportionality coefficient. Since the step lengths are determined by height, attitude, and frequency, the value of C which is significantly influenced by the pedestrian height and stride frequency cannot be constant. Considering the nonlinear relations of the proportion coefficient C, pedestrian height, and stride length, we use a back propagation (BP) neural network to obtain this nonlinear mapping for the sake of predicting the value C accurately and real timely. The structure of our addressed BP neural network is shown in Figure 4.
4 Heading estimation
4.1 Gyroscope attitude estimation
The angular velocities x, y, and z in the coordinates of smartphone are measured by a three-axis gyroscope. The attitude of the smartphone is obtained from the integration of the quaternion-based rigid body kinematic equations. The quaternion-based rigid body kinematic equations are
where the quaternion Q = q0 + q1i + q2j + q3k, q i (i = 0, 1, 2, and 3) is a real number. t0 is the initial time of the user's movement. Q0 is the initial quaternion. W = 0 + w1i + w2j + w3k is the quaternion of the attitude angular velocity in the coordinates of smartphone. ⊗ denotes the multiplication of quaternion. We can represent (5) in matrix form as
where ω i (i = 1, 2, and 3) is the angular velocity. We assume that the angular velocity is a constant value in the same sampling interval. By calculating the differential equations in (6), the formula of quaternion discrete time can be obtained by
where . Based on the relationship between attitude rotation matrix and quaternion, the rotation matrix can be calculated as
In (8), the parameter q i (i = 0,…, 3) can be used to update the attitude rotation matrix. Finally, we calculate the roll, pitch, and yaw as
4.2 Extended Kalman filter design
In practical use, the attitude angles collected from the gyroscope may start from incorrect initial conditions. When the accelerometer is not stationary or the magnetometer is exposed to interferences, the accumulated errors by the gyroscope measurement noise and the absolute attitude angles from magnetometer/accelerometer could provide an incorrect estimation on the heading angle. Therefore, the integration of gyroscope, accelerometer, and magnetometer for the calculation of attitude angles can effectively improve the heading precision. The extended Kalman filter is used in the paper to merge all the sensors' information to obtain an accurate estimation on attitude angles. The EKF model is shown in (10).
Using the discrete time model to update attitude angles, the state vector can be described by the rotation quaternion. The state transition vector equation is shown in (11).
where is the state transition matrix. w k is the vector of processing noise. The measurement model is constructed by stacking the normalized accelerometer and the magnetometer measurement vectors as
where is the quaternion-based attitude rotation matrix. g is the vector of normalized gravity. h is the vector of normalized magnetic field intensity. The vectors of measurement noise in accelerometer and magnetometer are notated as avk + 1 and mvk + 1 which can be recognized as the uncorrelated zero-mean white noise processes with the corresponding covariance matrix R.
From the observation equation, we can find that the relationship between state vector and measurement vector is nonlinear. Therefore, we linearize the first part on the right side of (12) to calculate the observation matrix H as
In the static scenario without magnetic interference, the measurement noise in accelerometer and magnetometer is not changed. When the linear acceleration or the magnetic interference exists, the errors of attitude in accelerometer and magnetometer could be significantly large. To solve this problem, we use an adaptive approach to construct the observation variance and for the sake of modifying the weight of measurement values in a real-time manner. This process is illustrated in (17) and (18).
where ||a k || and ||m k || are the modulus values of accelerometer and magnetometer. ki 1 and ki 2 are the weighting factors. var(ik − N/2: ik + N/2) (i = a, m) is the variance of modulus values in the sliding window with the size of N. When the smartphone has a large linear acceleration or is suffered by the external magnetic interference, both modulus value and variance of accelerometer and magnetometer are increased. In this case, to reduce the influence of the linear acceleration and the external magnetic interference, we distribute large values to the observation variance, and , to guarantee that the filtering process is determined by the output of gyroscope.
4. 3 Heading correction
During the walking, the smartphone is suffered by not only the upward and forward movement, but also the swings. From the curve of heading angles obtained by EKF, we can find that the smartphone swings severely. To reduce the impact of swing on heading estimation, we use the second-order Butterworth digital low-pass filter to conduct heading correction.
The quaternion representation is discontinuous in the rotation angles of 360°. For example, the angle of 361° should be represented as the angle of 1°. The low-pass filtering could result in an unexpected behavior when the heading is in the vicinity of 360° or 0°, as shown in Figure 5. In contrast, the estimation by rotation matrix is not suffered by the discontinuities. After the low-pass filtered rotation matrix is obtained, the heading angle can be calculated by (8). The solid curve in Figure 6 is the result of corrected heading angles.
5 Testing results
In our testing, the MARG sensors equipped in Huawei smartphone is selected as the inertial measurement unit consisting of a three-axis accelerometer (ST LIS3DH), a three-axis magnetometer (akm8963), and a three-axis gyroscope (ST L3G4200D). The smartphone is based on the Android operating system to provide application programming interface (API). We collect the raw data from sensors using the API with the sampling rate of 50 Hz. Considering the sensor behavior and structure, we do the necessary calibration as one of the important pre-processing modules to integrate the three different sensors. The signal conditioning is required to get rid of the residual bias and scale-factor errors in a fine alignment procedure. As shown in Figure 7, the smartphone is hand-held during walking.
5.1 Step detection and stride length estimation
A dataset is collected to examine the performance of our proposed step detection approach. The results of step detection and a magnified part of the detection are shown in Figure 8. From Figure 8, we can find that the probability of step detection is close to 100%.
We use five groups of data collected by five different persons with different heights to examine performance of stride length estimation. The walking length in total is about 105 m. Table 1 shows the results of stride length (SL) estimation.
5.2 Heading estimation
We choose the corridors in a building in CQUPT as the testing bed to examine the ability of our proposed approach resisting to the anti-magnetic interference. The testing bed has different intersections and is suffered by variable magnetic interference. As shown in Figure 9, the irregular changes of magnetometer modulus values indicate that strong magnetic interference exists in the environment.
Figure 10 compares two different attitude fusion methods: the conventional gradient descent algorithm (GDA) and our proposed EKF. The ‘Reference’ indicates the direction of testing path. From Figure 10, we observe that the proposed EKF can provide more accurate and stable estimation of pedestrian heading compared to the GDA, especially in the environment where the magnetic disturbance exists.
5.3 Trace tracking
Since the error for each step cannot be easily labeled, we use an actual walking trace in a loop (i.e., the starting position and ending position coincide) instead for our testing. The distance between the starting position and the ending position on the tracked trace (or called tracking error) is selected to evaluate the positioning accuracy. In this case, the smaller distance between the starting position and the ending position indicates the higher positioning accuracy to be obtained. In Figure 11, Reference and ‘Trajectory’ stand for the real trace and the tracked trace, respectively.
The tracking results by our proposed pedestrian navigation algorithm are shown in Table 2. Ten groups of data collected by ten different people are used to evaluate the positioning accuracy. For the trace with 400 m in length, the tracking errors are only within 8 m.
This paper presents a new pedestrian navigation algorithm based on the MARG sensors equipped in Huawei smartphone. The testing results on the smartphone platform show that the accurate, reliable, and continuous localization and tracking can be provided. Our proposed algorithm can be applicable to many other types of smartphones and also provide an important guidance to the design of the integrated Wi-Fi and MEMS navigation systems [18–20]. Furthermore, the optimization of heading estimation algorithm forms another interesting work in future.
Soehren W, Hawkinson W: A prototype personal navigation system. IEEE Aerospace and Electronic Systems Magazine 2008, 6(23):10-18.
Evennou F, Marx F: Advanced integration of WiFi and inertial navigation systems for indoor mobile positioning. EURASIP J Adv Sign Process 2006, 2006: 164-164.
Nilsson JO, Zachariah D, Skog I, Händel P: Cooperative localization by dual foot-mounted inertial sensors and inter-agent ranging. arXiv preprint arXiv 2013, 1304: 3663.
Li F, Zhao C, Ding G, Gong J, Liu C, Zhao F: A reliable and accurate indoor localization method using phone inertial sensors. In Proceedings of the 2012 ACM Conference on Ubiquitous Computing. New York: ACM; 2012:421-430.
Ali A, Siddharth S, Syed Z, El-Sheimy N: An improved personal dead-reckoning algorithm for dynamically changing smartphone user modes. In Proceedings of the 25th International Technical Meeting of the Satellite Division of the Institute of Navigation (ION GNSS 2012). Nashville: ; 2432-2439. 17–21 September 2012
Beauregard S, Haas H: Pedestrian dead reckoning: a basis for personal positioning. In Proceedings of the 3rd Workshop on Positioning, Navigation and Communication (WPNC’06). Hannover: ; 27-35. 16 March 2006
Wan EA, Van Der Merwe R: The unscented Kalman filter for nonlinear estimation. In Adaptive Systems for Signal Processing, Communications, and Control Symposium 2000. Lake Louise, Alta: AS-SPCC; 153-158. 1–4 October 2000
Munguia R, Grau A: An attitude and heading reference system (AHRS) based in a dual filter. In 2011 IEEE 16th Conference on Emerging Technologies & Factory Automation (ETFA). Toulouse: ; 1-8. 5–9 September 2011
Madgwick SOH, Harrison AJL, Vaidyanathan R: Estimation of IMU and MARG orientation using a gradient descent algorithm. In 2011 IEEE International Conference on Rehabilitation Robotics (ICORR). Zurich; 1-7. 29 June to 1 July 2011
Sabatini AM: Quaternion-based extended Kalman filter for determining orientation by inertial and magnetic sensing. IEEE Trans Biomed Eng 2006, 53(7):1346-1356. 10.1109/TBME.2006.875664
Ren H, Kazanzides P: Investigation of attitude tracking using an integrated inertial and magnetic navigation system for hand-held surgical instruments. IEEE-ASME Trans Mech 2012, 17(2):210-217.
Setoodeh P, Khayatian A, Frajah E: Attitude estimation by separate-bias Kalman filter-based data fusion. JNav 2004, 57(2):261-273.
Yun X, Bachmann ER: Design, implementation, and experimental results of a quaternion-based Kalman filter for human body motion tracking. IEEE Transactions on Robotics 2006, 22(6):1216-1227.
Marins JL, Yun X, Bachmann ER, McGhee RB, Zyda MJ: An extended Kalman filter for quaternion-based orientation estimation using MARG sensors. In Proceedings of 2001 IEEE/RSJ International Conference on Intelligent Robots and Systems, vol 4. Maui, HI; 2001:2003-2011.
Shin SH, Park CG, Kim JW, Hong HS, Lee JM: Adaptive step length estimation algorithm using low-cost MEMS inertial sensors. In Sensors Applications Symposium, 2007. SAS'07. San Diego; 1-5. 6–8 February 2007
Jahn J, Batzer U, Seitz J, Patino-Studencka L, Gutiérrez Boronat J: Comparison and evaluation of acceleration based step length estimators for handheld devices. In 2010 International Conference on Indoor Positioning and Indoor Navigation (IPIN). Zurich; 1-6. 15–17 September 2010
Shih WY, Chen LY, Lan KC: Estimating walking distance with a smart phone. In 2012 Fifth International Symposium on Parallel Architectures, Algorithms and Programming (PAAP). Taipei; 166-171. 17–20 December 2012
Shin B, Lee JH, Lee H, Kim E, Kim J, Lee S, Cho Y, Park S, Lee T: Indoor 3D pedestrian tracking algorithm based on PDR using smarthphone. In 2012 12th International Conference on Control, Automation and systems (ICCAS). Jeju Island: ICC; 1442-1445. 17–21 October 2012
Chon J, Cha H: Lifemap: a smartphone-based context provider for location-based services. Pervasive Comput 2011, 10(2):58-67.
Klingbeil L, Wark T: A wireless sensor network for real-time indoor localisation and motion monitoring. In International Conference on Information processing in sensor networks, 2008. St. Louis: IPSN'08; 39-50. 22–24 April 2008
This work was supported in part by the Program for Changjiang Scholars and Innovative Research Team in University (IRT1299), National Natural Science Foundation of China (61301126), Special Fund of Chongqing Key Laboratory (CSTC), Fundamental and Frontier Research Project of Chongqing (cstc2013jcyjA40032, cstc2013jcyjA40034, cstc2013jcyjA40041), Scientific and Technological Research Program of Chongqing Municipal Education Commission (KJ130528), Startup Foundation for Doctors of CQUPT (A2012-33), Science Foundation for Young Scientists of CQUPT (A2012-77), Natural Science Foundation Project of CQ CSTC(CSTC2012jjB40009), and the Key Laboratory of Optoelectronic Devices and Systems of Ministry of Education and Guangdong Province.
The authors have no connection to any company whose products are referenced in the article. The authors declare that they have no competing interests.
Authors’ original submitted files for images
Below are the links to the authors’ original submitted files for images.
About this article
Cite this article
Tian, Z., Zhang, Y., Zhou, M. et al. Pedestrian dead reckoning for MARG navigation using a smartphone. EURASIP J. Adv. Signal Process. 2014, 65 (2014). https://doi.org/10.1186/1687-6180-2014-65
- Pedestrian navigation
- Dead reckoning
- MARG sensors