AHRS Sensor Fusion: A foothold - Page 1
Forum section: electronics / general

author: BurnedResistor
author_rank: Regular Contributor
timestamp: January 13, 2017, 09:38:38 pm
content: Dear All,As you might be able to gather from the last series of posts, I am designing a quad copter controller. This being my first in depth embedded project this might be a little impossible, but I am doing this to learn, so hey, let's just see what happens!I am using an MPU9250 9DOF IMU, (Even though the magnetometer is a little annoying to read and I have not completed, as it is a slave I2C device connected internally from what I gather, dead easy to implement with no chance of getting the full documentation *sigh*)I wanted to start researching possible sensor fusion algorithms.I realize this topic is rather complex, and I would probably get my quad copter in the air quicker if I just use someone else's implementation, but I would not learn anything from that.My goal is to take a sensor fusion algorithm and implement it myself in C, for the stm32f446 processor I am using.Right now I have found two that sound promising: a Kalman Filter, and a Madgwick Filter.I am very much tempted with the Madgwick filter, as the whole derivation of the filter is easy to find in Sebastian Madgwick's original paper, plus there is sample code, if worst comes to worst. (http://x-io.co.uk/open-source-imu-and-ahrs-algorithms/)However, I have never studied this topic before. I have looked over the paper, and while I have been able to teach myself more about quaternions, and think I have a good grasp of how they represent orientation, I am at a loss with the complexity of that paper. I really want to put the time and effort in to learn and understand this filter, but don't know what I should study as a basis.My question is, what topics (Math topics, Sensor Fusion specifics, etc...) should I definitely review before jumping into this? Are there certain prerequisite piece of knowledge I can get to know that will help me down this path? I am struggling very much with keeping up with the derivation of the filter in the Madgwick paper. Is there anything that you would have liked to know before going down a similar rabbit hole?Furthermore, is Madgwick's a good choice? Should I be learning more about Kalman's filter? This might be a stupid question, but which one is more applicable to a simple quad copter? Which one is easier to implement and understand?

author: janekm
author_rank: Unknown
timestamp: January 14, 2017, 03:58:14 am
content: Back in my PhD research days, the general approach when in this kind of situation was to take a promising paper (the Madgwick one should be a good starting point) and then trawl through the references in that paper for background reading. The original Kalman paper is the 9th reference so I'd probably try to read that one next. After that, you can follow citations forward and back (Google Scholar is helpful here) to get a good sense of the field, both the "seminal papers" and the latest research.There's a really good Udacity course called "Aritifical Intelligence for Robotics" which has a very easy to follow explanation of Kalman filters, give that one a shot (or just watch the relevant video on youtube):https://www.udacity.com/course/artificial-intelligence-for-robotics--cs373Kalman filters are fundamentally quite simple, so it makes sense to gain a good understanding of that as a foundation to really make sense of what Madgwick is doing. Of course modern MCUs don't have the same limitations that Madgwick was fighting with so you might get away with using a "regular" Kalman filter on your quad anyway.

author: BurnedResistor
author_rank: Regular Contributor
timestamp: January 14, 2017, 08:16:18 am
content: Quote from: janekm on January 14, 2017, 03:58:14 amWow. Thank you very much. I will definetly give the above resources and the kalman filter some more thought.

author: LHelge
author_rank: Contributor
timestamp: January 15, 2017, 07:30:12 am
content: Due to the nonlinearity of the problem you probably need to look into extended Kalman filters.Quaternions make things a lot easier. The alternative is probably a DCM which, in my opinion, is much less elegant. The problem with a quaternion based sensor fusion algorithm is that you still have to watch out for singularities when converting back to euler angles for inputing into your controller.I've read an interesting paper that propose to perform the control in quaternion space as well. Could be worth looking into.https://scholar.google.se/scholar?hl=en&as_sdt=0,5&cluster=11053323246744192166Skickat från min Nexus 6P via Tapatalk