Which Kalman Filter is best for gait state estimation?

The EKF controller study I performed prompted some further questions. We used the Extended Kalman Filter (EKF) yes, but there were other Kalman Filters out there, maybe some that could outperform the EKF for the gait state estimation challenge. Additionally, there was the open question of exactly which sensors available on a lower-limb robot platform would be most useful for the estimation challenge. If you could only pick a few sensors, say due to hardware or computational constraints, which sensors should you prioritize using the Bayesian Filter approach?

I happened to be taking a course at the time at UMich suitable for answering these questions: AEROSP 567, Statistical Inference, Estimation, and Learning, in short, a crash-course on practical statistical estimation techniques, with a heavy emphasis on Monte Carlo techniques. For the final project, which involved solving any statistical estimation challenge, I posed to answer the questions above: which Kalman Filter is best suited for the gait state estimation challenge, and which sensors are most useful? Doing so would inform future implementations of the Bayesian filter approach, and serve as a useful guideline for researchers to choose sensors for wearable lower-limb robots.

As a quick primer, we seek to learn the gait state, the set of variables that describes how a person walks, as it evolves during locomotion. The gait state as defined in our prior work is composed of the gait phase, a mechanical variable taking values between 0 and 1 that tells you how far along you are in a stride; phase rate, the time derivative of phase that describes the speed of progression through stride; stride length, the distance traveled during stride; and incline, the inclination of the ground. Together, these gait state variables are capable of parametrizing a wide variety of walking gaits (though by no means are you strictly limited to these, you can include more!). The gait state vector x(t) is then:

with phase, phase rate, stride length, and incline, left to right respectively.

At the heart of any Kalman Filter lies a measurement model that relates the (hidden) state vector, in our case the gait state, to some directly measurable quantities. In our past work, we used a variety of lower-limb kinematic variables. In this experiment, I tried out the following measurements: foot angle, shank angle, thigh angle, and pelvis angle, along with their respective time derivatives. These represent a plausible set of variables that could be estimated using the sensors on a lower-limb robot like an exoskeleton. To obtain the relationship between the gait state and these kinematics, I used the data from an open-source walking data-set, which contained different walking conditions on an instrumented treadmill over various speeds and inclines. This data-set also contained the ‘ground-truth’ gait state variables corresponding to each condition’s kinematics, and thus could be used to regress a continuous gait model that mapped gait state to kinematics, which was precisely what I needed. In short, I used constrained least-squares to fit a series of Bezier polynomial functions in 4D space to obtain this gait model shown below:

Additionally, having the dataset like this let me do something else pretty cool for the Kalman Filters. Ordinarily, Kalman Filters have a set of fixed gains in their process noise matrices and measurement noise matrices, which capture uncertainty in the dynamics process and measurement sensors respectively. The measurement noise matrix is typically informed by sensor spec sheets and lets the filter know how much trust it should place in each measurement. The process noise matrix then acts as your tunable parameters to control how fast the Filter updates, and thus, your response times and stability. However, what if the sensors had different levels of trustworthiness depending on the state vector? In that case, the measurement noise matrix would be heteroscedastic and could change its values dynamically (depending on how you look at it this could count as gain scheduling). For instance, consider the fact that, during normal locomotion, your foot’s global angle in the sagittal plane must be roughly equal to the incline of the ground slope during early stance. Consequently, you’d expect the foot angle signal to be highly informative of incline during that period of phase.

With this idea in mind, I also developed a heteroscedastic noise model within the Kalman Filters, which took the covariances of all the measurements as a function of phase and constructed a series of noise matrices from them. As the gait phase evolved, so too did the elements of the noise matrix (right).

As expected, the foot angle covariance (blue) noticeable decreases during early stance between 0.2 and 0.4 phase. This informs the Filter that the foot signal should be trusted more during early stance when the foot is contacting the ground. Similarly, the covariances between the foot angle and the other kinematics also drops during this region. This heteroscedastic model produced some really good estimates of ramp during testing, and let us have faster response times without sacrificing accuracy.

Now we move on to one of the highlights of this project: comparing the Kalman Filters. We already established the EKF as a suitable candidate, but what about some alternatives? I considered the Unscented Kalman Filter (UKF), which uses specialized integration techniques to approximate the update step of the Kalman Filter. This Filter should theoretically be able to perfectly integrate functions of up to the third order, and is pretty commonly used within the walking robot space (at least at UMich).

Next, I also considered the Ensemble Kalman Filter (EnKF), which uses Monte Carlo techniques (i.e. a bunch of particles) to approximate the update step of the Filter. Each particle is fed through the dynamics and then aggregated to produce the mean, which corresponds to the updated state. 567 granted the necessary background to implement these filters in silico: full implementation detail can be seen here. In this experiment, I tested EnKFs with 100 and 1000 particles, to evaluation the trade-off between computational times and accuracy.

Once the filters were set up, it was time to simulate walking. We used the same walking data from the dataset to simulate locomotion through different speeds and inclines. Simulations were performed in Python, with heavy use of the NumPy library. The measurements from the walking trials were sequentially fed into each filter (EKF, UKF, EnKF100, and EnKF1000), which produced estimates of the gait state. The estimated gait state was then compared to the ground truth gait state from the data to evaluate each filter.

Additionally, to investigate the impact of different sensors on estimation performance, I repeated this experiment but for different sensor configurations available to the Kalman Filters. In other words, I simulated if the Filters had access to all four lower-limb measurements (foot, shank, thigh, pelvis), combinations of just three, combinations of just two, and only a single sensor. By doing this and comparing the performance to the base case (the full configuration), we could evaluate how important each sensor was to the estimation of the gait state.

On the left is some representative results from the simulations with the full sensor configuration and for a single subject. Left to right is EKF, UKF, EnKF1000, and EnKF100. In blue is the simulated estimates of the gait states, with red being the ground truth. Top to bottom are the gait states of phase rate, stride length, and incline Phase isn’t shown cause at this scale it’s basically compressed in time and not interpretable, but phase rate encodes the same information.

It’s evident that the EKF and UKF are pretty similar in performances, and they slam-dunk estimate the phase rate and incline, with reasonable estimation of stride length. Conversely, the EnKF1000 is noticeable worse at phase and especially incline, and the EnKF100 is obviously failing to keep track of the state.

Here is a figure describing the overall results for all the subjects and the different measurement configurations. Each dot represents an average, with the vertical lines denoting standard deviations. Looking at the graph, it’s obvious that the EKF and UKF are by far and away the best Filters especially for the sensor configurations with more sensors. Conversely, you can really see the EnKF1000 and EnKF100 start to struggle overall. Combined with the fact that these are the slowest Filters to evaluate computationally, I’d rule the EnKF for the gait state estimation challenge.

In terms of sensor configs, it’s not surprise that the full configuration resulted in the best estimation. However, some reduced configurations, such as foot-shank-thigh (fst), foot-shank (fs), or shank-thigh (st), had pretty similar estimation performances. This suggests that the pelvis measurement isn’t particularly informative to the gait state, whereas we could pick combinations of the other three and get away with using a limited sensor array if we were computationally limited. This validates our choice to include foot and shank in our practical EKF controller.

This was also a pretty fun project to do. Huge thanks to Dr. Gorodetsky and AE 567 for giving the opportunity to learn about estimation and inference like this (and for the excuse to delve deeper into Kalman Filtering). Takeaways from this project include the endorsement of the EKF and UKF for the gait state estimation challenge. Additionally, we now know that the pelvis isn’t that great a sensor, and that thigh, shank, or foot are instead better choices to drive the estimation of the gait state.

Previous
Previous

The Value of Exoskeletons

Next
Next

Unmanned Underwater Vehicle