Search tips
Search criteria 


Logo of nihpaAbout Author manuscriptsSubmit a manuscriptHHS Public Access; Author Manuscript; Accepted for publication in peer reviewed journal;
Proc Am Control Conf. Author manuscript; available in PMC 2017 March 23.
Published in final edited form as:
PMCID: PMC5363411

An Extended Kalman Filter to Estimate Human Gait Parameters and Walking Distance


In this work, we present a novel method to estimate joint angles and distance traveled by a human while walking. We model the human leg as a two-link revolute robot. Inertial measurement sensors placed on the thigh and shin provide the required measurement inputs. The model and inputs are then used to estimate the desired state parameters associated with forward motion using an extended Kalman filter (EKF). Experimental results with subjects walking in a straight line show that distance walked can be measured with accuracy comparable to a state of the art motion tracking systems. The EKF had an average RMSE of 7 cm over the trials with an average accuracy of greater than 97% for linear displacement.

I. Introduction

Gait analysis has the potential to provide diagnostic information about the functioning of the musculoskeletal, vestibular, and central and peripheral nervous system. It can detect functional degradation in these systems associated with age, disease, obesity, and trauma. The analysis and monitoring of walking patterns and gait offer many useful applications in geriatrics [1], fall risk assessment [2], disease monitoring [3], [4], sports training [5], and rehabilitation [6]. Recently, indoor pedestrian localization has received increased attention, with applications in navigation and assisting first responders and security personnel [7]–[10]. These projects seek to estimate a person’s position and/or displacement over time in GPS denied environments. We present a novel approach that can simultaneously address both of these problems by leveraging the kinematics of the human leg.

Gait analysis requires accurate measurements or estimates of body position, mechanics, and movements. Estimating related parameters with the fewest, smallest sensors is a challenging research problem. Many rsearchers have focused on inertial measurement units (IMUs), including gyroscopes and accelerometers, as portable sensors for gait analysis. Some previous research has employed only gyroscopes for gait analysis. Tong et. al. used multiple gyroscope configurations to measure angular velocities and inclination for each segment of the leg along with the knee angle [11]. They used this data along with force sensitive resistors to determine stride length and gait phases. In [12], Aminian et. al. used a gyroscope on each shin and on the right thigh to analyze velocity and stride length based on wavelet analysis. Further research in this area has used IMUs with a combination of accelerometers and gyroscopes. Using a single IMU on the shin, Li et. al. [13] calculate real time stride-by-stride walking speed and slope. Sabatini et. al. used a single IMU on the foot to measure stride length, walking speed, and incline [14]. Alvarez et. al. also use a single IMU placed on the foot [15] to estimate walking distance. Lan and Shih use a waist-mounted IMU and detect the oscillations that a human undergoes while walking and use this to estimate stride length [10]. Alvarez et al. use a similar method of stride length estimation from a waist-worn IMU and add orientation from gyroscopes [9]. Bebek et al. implement a shoe-worn IMU with sensors to detect when the foot is on the ground to reduce estimation error [16].

Our previous work developed a linear Kalman filter to estimate gait parameters and distance traveled [17]. In this work, we propose an extended Kalman filter (EKF) model that utilizes a robotic kinematic model and knowledge of human motion to estimate displacement based on gyroscope measurements. While several previous researchers have used Kalman filters to estimate displacement, they seem to be based on Inertial Navigation Systems (INS), in which gyroscopes and accelerometers are integrated to give velocity and displacement. To our knowledge, this is the first time kinematics of the leg have been used to design an extended Kalman filter.

Our EKF model exploits the similarities between the kinematics of a two-link robot arm and the kinematics of the human leg. We place gyroscopes on the thigh and the shin. A forward kinematic model uses the measurements to obtain joint angle displacement over time. The geometry of our work is similar to one of the configurations in [11] where a two segment model is considered using gyroscopes for turning and gait phase analysis. Our work uses the gyroscope measurements to inform an EKF model based on robot kinematics. We use this to estimate the linear distance traveled by a subject walking. The displacement estimates of the EKF correspond to the foot with respect to the hip, and the joint angles and angular velocities correspond to the hip and knee. To get the forward displacement, we estimate position based on cumulative displacement of the foot. This research is an important initial investigation as it could be extended towards accurate human positioning with wearable sensors. Compared to our previous development in [17], the nonlinear model allowed by the EKF has lead to increased accuracy. For foot displacement over an average walking distance of 3.55 meters, the new EKF has an average error of 6.89 cm versus 19.8 cm in the prior design, using the same input data.

The paper is arranged as follows. Section II discusses theory behind the kinematics considered and how it relates to human gait. Section III describes the basics of the EKF and the state space model for our discussion. Section IV gives the details on the experimental set up and Section V gives an analysis of the results obtained.

II. Kinematics of the Human Leg

In order to design an effective EKF, we need a model of the human leg. A kinematic model helps us to relate the angles and positions of individual limbs and the actual forward displacement of the body. The primary joints in the human leg used for locomotion (as opposed to balance) while walking are the hip and the knee. During straight line walking, hip and knee flexion and extension occur while keeping both the shin and thigh in a single plane which is approximately parallel to the direction of motion.

A. Forward Kinematics

To establish the forward kinematics, we model the human leg as a two-link revolute robot. In taking a single step forward, the human leg is similar to a two-link robot manipulator with the hip and knee as two joints. We assign three-dimensional Cartesian reference frames to each joint, as seen in Fig. 1. Frames F0, F1 and F2 are assigned to the hip, knee and foot, respectively. Frame F0 is oriented such that the x-axis is in the direction of motion, the y-axis is up, and the z-axis is out from the hip to the right. The subsequent frames are chosen as per Denavit-Hartenberg (D-H) convention [18]. Homogeneous transformation matrices are used to map the coordinates of a point in one frame into another frame. The homogeneous transformation matrices between the frames are given by



where (1) maps F0 to F1 while (2) maps F1 to F2. The scalars a1 and a2 are the limb lengths of the human under consideration. Length a1 corresponds to the length between the hip and the knee while a2 corresponds to teh length between the knee and the heel of the foot. θ1 and θ2 are the relative joint angles as seen in Fig. 1. The transformation between F0 and F2 is obtained by multiplying the transformations above and is seen in (3). The first and second rows of the fourth column in (3) represent the equations for the x and y displacement of the foot relative to the hip frame.

Fig. 1
Kinematics in human leg

III. Extended Kalman Filter Model

In this section, we present the state space model and EKF model considered in our system. The state vector is


where x and y correspond to the horizontal and vertical position of the heel of the foot (i.e. the origin of F2) relative to the origin of the hip frame F0. θ1 is the angle of the thigh relative to the hip frame and ω1 is the corresponding angular velocity. θ2 and ω2 are the angle and corresponding angular velocity between the shin and the thigh. β1 and β2 are the biases from thigh gyroscope and shin gyroscope respectively and are assumed to be constant or very slowly time varying. From (3), the derivative of (4) is


This is rewritten as x = Fx Where



The sensors are gyroscopes on the thigh and shin and measure the angular velocities of the two links. The measurement vector is given by


where s1 reflects the fact that the thigh angular velocity measurement includes the thigh rotation and the gyro 1 bias. Similarly, the shin angular velocity measurement, s2, is a combination of shin rotation, thigh rotation, and the bias of gyro 2, as the shin is connected to the thigh.

The state equations are continuous, but we implement a discrete time EKF. Furthermore, trigonometric terms require linearization of the state equations at each iteration. Following the procedure in [19], we approximate the discrete time matrix as


where TS is the length of each step. This leads to a discrete time state space system as in [20]



where k [set membership] N is the discrete time index, xk [set membership] R8 is the state vector at the time instant k, yk [set membership] R 2 is the measurement vector. H [set membership] R 2×8 is the matrix that relates the states to the measurements and is given by


The terms wk and vk are white, zero-mean Gaussian noise processes with covariance matrices Q [set membership] R 8×8 and R [set membership] R 2×2, given by



The process noise matrix Q is constant with a block-diagonal structure. We model the process noise on the x, y, and βi variables as independent, and the blocks for the θi, ωi, [set membership] 1, 2 terms reflect a random walk process. The σxy, σθ, and σβ terms in Q are determined by tuning for best performance. The elements of R are constant and determined by taking the sample standard deviation of the measurement data during an initialization stage when the subject is not in motion.

The EKF assumes that the state at the current time index evolves from the state from previous time index in a Markov process. The expected value of the state is derived from (8), providing the prediction stage of the EKF. It should also be noted that the state transition matrix must be updated at each time index. The equations corresponding to the prediction stage are given as



where Pk is the estimate of the error covariance matrix at time k. After the prediction, the estimates are updated using the measurement. The equations involved in the update stage are




where Kk is called the Kalman gain. Note that Kk weights the effects of the measurements as a function of the sensor noise and estimation error covariance matrices.

IV. Implementation

A. Sensors and Signal Processing

The sensors are Telos motes with custom-designed sensor boards [21]. Each sensor consists of a 3-axis accelerometer (LIS3LV02DQ) and an integrated dual-axis gyroscope (IDG-300). The gyros have a a full scale range of ±500°/sec and a sensitivity of 2mV/°/sec. The sensors collect the data and transfer it wirelessly to a base station PC at 50Hz. Matlab is used to read and analyze the data. A median filter, over a window of 5 samples, is applied on the data to account for packet losses. While both the gyro and accelerometer data were collected, only the gyro data is used for this work.

B. Experimental Setup

For the experiment, two sensors are placed on the right leg of the subject. Sensor 1 is placed on the thigh and sensor 2 was placed on the shin . The sensors are placed on the front of the leg and aligned vertically as shown in Figure 2, and they are oriented to collect the angular velocities of the upper and lower leg. A third sensor was placed on the hip. Reflective markers were placed on the sensors to allow motion tracking using a Vicon system.

Fig. 2
Sensor Placement

V. Analysis and Results

Each trial begins and ends with the subject standing with feet parallel. This leads to initial state estimates x = 0 m, y = 0 m, θ1=π2 radians, θ2 = 0 radians, ω1=0radsec, ω2=0radsec, β1=μ1radsec, β2=μ2radsec, where μ1 and μ2 are the average values of the thigh and shin gyroscopes respectively collected during initialization when the subject is not moving. The subjects walked between 3 and 4 meters with an average distance of 3.55 meters. Angular velocities are collected from the two sensors as the subjects walk in a straight line. As described in Section III, the measurement vector consists of angular velocities from the two gyroscopes.

In these trials, the hip and foot start and end aligned vertically. Therefore, we can assume the displacement of the hip is equivalent to that of the foot at the end of each trial. In the 2-link kinematic model, the origin frame, F0, is assumed stationary. For the human leg, this would mean the hip does not move when the person walks. Additionally, the 2-link model only factors in distance to the heel of the foot. The distance gained by the ball of the foot pushing off, and the rear knee bending is not included in the current model. We acknowledge these errors in our model, which are a sacrifice for simplicity of the model.

To assess the performance of the system, the subject’s motion was also captured using an 8-camera Vicon Time (seconds) system and Vicon Nexus software (Vicon, Oxford, UK). The results using the proposed EKF and sensors are shown for one of the experiments and compared against the data collected from the Vicon system. Vicon systems are accurate within 1 millimeter and are considered one of the most accurate motion measurement systems. Figure 3 shows the estimate of the EKF vs the Vicon data for θ1, the angle between the hip and thigh. The EKF estimate tracks well during forward motion of the leg (i.e. increasing angle) and the back swing phase of motion. Fig. 4 shows the the EKF estimate vs. the Vicon data for θ2, the angle between the thigh and the shin. This angle has some ringing which occurs around 0 degrees and doesn’t track as well on the positive angles when compared to the Vicon data. The estimate also overshoots slightly at the negative extrema. This may be due to the foot pushing off of the ground at this time and the body moving forward. These motions won’t necessarily change the angle of the leg, but can add additional angular velocity to the sensors. Even with the differences discussed, the angles track well in time and magnitude in relation to the Vicon Data. Figures 5 and and66 show the estimates of the horizontal and vertical displacement of the foot relative to the hip.

Fig. 3
Estimate of the angle between hip and thigh (θ1).
Fig. 4
Estimate of the angle between thigh and shin (θ2).
Fig. 5
Estimate of x displacement of foot relative to the hip.
Fig. 6
Estimate of y displacement of the foot relative to the hip

To determine the distance covered during the walk, we accumulate all positive displacement in the x-axis of the foot frame. To estimate the additional distance from the foot and other model limitations, the vertical displacement estimate in the y-axis is accumulated and added to the x-axis displacement. Figure 7 compares the displacement estimate of the EKF and the Vicon displacement measurement. The results of the proposed sensors and EKF are very similar to the Vicon data. Our displacement estimate has longer plateaus due to our method of accumulation. The Vicon data is smoother because it is measuring the location of the sensor on the shin, which is stationary for less time than the foot when walking. Considering these differences, the average RMSE over the entire distance walked for all trials averaged 7.00 cm. The EKF distance estimate was, on average, within 3% of the Vicon measurement for linear displacement over all trials. Table II shows the average results for the trials.

Fig. 7
Displacement along x-axis of the hip frame considering only the forward motion of leg
Total Displacement & RMSE

The distance estimate had an average error of 6.89 cm where the subjects covered a total distance of 3.55 m on an average. We can see that the EKF estimates are accurate for determining walking distances.

VI. Conclusion

In this work, we modeled the human leg as a two-link robot with an extended Kalman filter and exploited the kinematics to estimate linear distance walked. The EKF was used to estimate the displacement for a person walking in a straight line with high accuracy. We believe that this is an important initial step as we plan to extend this research for a person walking freely and over larger distances. Future efforts will seek to maintain accuracy while allowing for general walking patterns and activities beyond walking. Using accelerometer data in addition to the gyroscope data would allow for tracking of more complex movements such as running and jumping. Additionally, we can look into using IMUs on the feet and the other leg to get a more accurate model of the complete system.

Definition of State Variables


This work was supported in part by the National Science Foundation, under grants CNS-1150079 and CNS-1138396, the National Institute of Health, under grant R15AG037971 and the STARnet, a Semiconductor Research Corporation program sponsored by MARCO and DARPA. Any opinions, findings, conclusions, or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the funding organizations.


1. Reuben D, Siu A. An objective measure of physical function of elderly outpatients: The physical performance test. Journal of the American Geriatrics Society. 1990;38(10):1105–1112. [PubMed]
2. Tinetti M, Speechley M, Ginter S. Risk factors for falls among elderly persons living in the community. New England Journal of Medicine. 1988;319(26):1701–1707. [PubMed]
3. Salarian A, Russmann H, Vingerhoets F, Dehollain C, Blanc Y, Burkhard P, Aminian K. Gait assessment in parkinson’s disease: Toward an ambulatory system for long-term monitoring. IEEE Transactions on Biomedical Engineering. 2004;518:1434–1443. [PubMed]
4. Hausdorff J, Cudkowicz M, Firtion R, Wei J, Goldberger A. Gait variability and basal ganglia disorders: Stride-to-stride variations of gait cycle timing in parkinson’s disease and huntington’s disease. Movement Disorders. 1998;13(3):428–437. [PubMed]
5. Novacheck T. The biomechanics of running. Gait and Posture. 1998;7(1):77–95. [PubMed]
6. Pohl M, Mehrholz J, Ritschel C, Ruckriem S. Speed-dependent treadmill training in ambulatory hemiparetic stroke patients: A randomized controlled trial. Stroke. 2002;33(2):553–558. [PubMed]
7. Gdeke T, Schmid J, Stork W, Mller-Glaser K. Pedestrian dead reckoning as a complementary method for wireless sensor network ad-hoc person localization. Proc of the International Conference on Sensor Networks; 2012.
8. Ojeda L, Borenstein J. Non-gps navigation for security personnel and first responders. Journal of Navigation. 2007:391–407.
9. Alvarez JC, Alvarez D, Lpez A, Gonzlez RC. Pedestrian navigation based on a waist-worn inertial sensor. Sensors. 2012;12(8):10536–10549. [PMC free article] [PubMed]
10. Lan K-C, Shih W-Y. Using simple harmonic motion to estimate walking distance for waist-mounted pdr. Wireless Communications and Networking Conference (WCNC), 2012 IEEE; Apr, 2012. pp. 2445–2450.
11. Tong K, Granat M. A practical gait analysis system using gyroscopes. Medical Engineering and Physics. 1999:87–94. [PubMed]
12. Aminian K, Najafi B, Bula C, Leyvraz P, Robert P. Spatio-temporal parameters of gait measured by an ambulatory system using miniature gyroscopes. Journal of Biomechanics. 2002:689–699. [PubMed]
13. Li MYQ, Naing V, Donelan JM. Walking speed and slope estimation using shank-mounted inertial measurement units. ICORR 2009. 2009:839–844.
14. Sabatini AM, Martelloni C, Scapellato S, Cavallo F. Assessment of walking features from foot inertial sensing. IEEE Transactions on Biomedical Engineering. 2005 Mar;52:486–494. [PubMed]
15. Alvarez JC, Gonzalez RC, Diego Alvarez AML, Rodriguezuria J. Multisensor approach to walking distance estimation with foot inertial sensing. Conference of the IEEE EMBS; Aug, 2007. pp. 5719–5722. [PubMed]
16. Bebek O, Suster M, Rajgopal S, Fu M, Huang X, Cavusoglu MC, Young D, Mehregany M, van den Bogert A, Mastrangelo C. Personal navigation via high-resolution gait-corrected inertial measurement units. Instrumentation and Measurement, IEEE Transactions on. 2010 Nov;59:3018–3027.
17. Nagarajan K, Gans N, Jafari R. Modeling human gait using a kalman filter to measure walking distance. Proc Wireless Health Conference; 2011.
18. Spong MW, Hutchinson S, Vidyasagar M. Robot Modelling and Control. John Whiley and Sons, Inc; 2006.
19. Zarchan P, Musoff H. Fudamentals of Kalman Filtering: A Practical Approach. Third Edition. AIAA; 2009.
20. Welch GBG. An Introduction to the Kalman Filter. University of North Carolina; Chapel Hill, NC: 2006.
21. Polastre J, Szewczyk R, Culler D. Telos: enabling ultra-low power wireless research. Proceedings of the 4th international symposium on Information processing in sensor networks, IPSN ’05; 2005.