Extended Kalman Filter using IMU MPU6050 on STM32F4 - Page 1
Forum section: electronics / projects

author: sarbog
author_rank: Contributor
timestamp: October 31, 2022, 06:27:53 pm
content: I implemented the Extended Kalman filter described here:and resulting Roll and Pitch plots are attached below.

author: SiliconWizard
author_rank: Super Contributor
timestamp: October 31, 2022, 06:39:20 pm
content: Is there any quantifiable benefit for this use case compared to a simple complementary filter?

author: sarbog
author_rank: Contributor
timestamp: October 31, 2022, 07:06:06 pm
content: Good question! Here is a comparison of the two......https://aip.scitation.org/doi/pdf/10.1063/1.5018520

author: SiliconWizard
author_rank: Super Contributor
timestamp: October 31, 2022, 07:27:53 pm
content: Thanks. I read the paper, but frankly, on the graphs given at the end, it's hard to see the difference. The Y scale is too compressed. It seems that the difference is most noticeable for the yaw angle, which is not too surprising.

author: sarbog
author_rank: Contributor
timestamp: November 02, 2022, 01:57:25 am
content: According to theory the Kalman filter makes a prediction and then corrects it. The extended Kalman filter uses a correlation technique... to update ..... this should be more accurate.So far Phil Salmondy's implementation is working. I have been running it for 48 hours now with out problems.Cool stuff.

author: moffy
author_rank: Super Contributor
timestamp: November 02, 2022, 02:03:52 am
content: Quote from: sarbog on November 02, 2022, 01:57:25 amSo does the Kalman filter correct a factor e.g. gain estimation, to bring the actual and the prediction closer together? Have heard of but never really studied Kalman filters.

author: uer166
author_rank: Super Contributor
timestamp: November 02, 2022, 04:28:50 am
content: If anyone has an intuitive explanation of Kalman, I'd love to see it. I've been trying to understand it since many years ago in university. Complementary filter clicked immediately from the equation one-liner, Kalman did not..

author: SiliconWizard
author_rank: Super Contributor
timestamp: November 17, 2022, 08:14:43 pm
content: Does this help a bit?https://towardsdatascience.com/kalman-filter-an-algorithm-for-making-sense-from-the-insights-of-various-sensors-fused-together-ddf67597f35e

author: SiliconWizard
author_rank: Super Contributor
timestamp: November 17, 2022, 08:36:01 pm
content: I've tried the Madgwick filter, which has become a relatively "popular" approach for determining orientation with IMUs:https://x-io.co.uk/open-source-imu-and-ahrs-algorithms/The author has spent part of his PhD thesis on this topic.I have compared it with a complementary filter (see image). Haven't compared with a Kalman filter. The Madgwick filter is said to have similar performance but less computationally intensive.As can be seen, the complementary and Madgwick filters get very similar results when the device is stationary, but differences appear when it's moving. Differences are in the order of 2° max. It doesn't look like much and may not matter at all depending on your application. But if you need an accurate estimation of orientation to remove gravity for instance (to get linear acceleration), then it definitely matters. Even a 1° error can lead significant errors in the estimation of linear acceleration. I'm going to compare that next.

author: sarbog
author_rank: Contributor
timestamp: November 18, 2022, 07:56:19 pm
content: Very cool comparison! Thank you.Here is a paper "Derivation of Extended Kalman Filtering and Smoothing Equations"https://users.ece.cmu.edu/~byronyu/papers/derive_eks.pdf