I have a 3-axis accelerometer and a 2-axis gyroscope. I intend to measure something that only moves in the X and Z axis. I've heard of using Kalman filters to smooth out the acceleration vectors, but I can't find a good tutorial for a complete beginner to the topic. Also, I know I can double integrate acceleration to get position, but how do I do this with a finite number of sampled acceleration vectors? I would appreciate links to good tutorials for beginners on both these topics.
Here's a tutorial on implementing a direction cosine matrix for an IMU: http://gentlenav.googlecode.com/files/DCMDraft2.pdf
Take a look at the ArduIMU pages: http://code.google.com/p/ardu-imu/wiki/Theory
Here are a couple of open source projects which do this. Reading the code should give some clues:
Well, Kalman filter is a kind of magic that works mysteriously. :)
I started first with digital Filters. Well explained for starters. And easily understable. These simple filters work nicely for the roll and pitch of any system. Just need to adjust Accuracy vs Response ratio by experimenting. The trick is [ Accuracy = 1 - Response ].
Give it a try.
Then to understand about Kalman filter you will have to go through followings:
- Bayes' law
- Then will need to learn how to model simple scenarios for fitting those into the Kalman filter.
- Currently I am here so finding what to do .. will surely let you know.
And must share if you come across anything like this.
... double integrate acceleration to get position
In theory (provided you have perfect sensors and measurements) you can do that, but in practice you can not. The problem is that the accelerometer will have a constant force of 1G caused by gravity when the object is lying still (zero G in case of free falling), but this is not measured as exactly 1.00000000...G. When moving the object you will have a vector as the sum of 1G gravity and the acceleration from the movement (which is typically much smaller than 1G) and your measurements will accumulate way too much noise over time to be useful if you try to integrate measured acceleration minus 1G gravity.
I started building a quad almost 6 months ago, had a lot of problems with correct angle determination :)
First of all you should try this presentation - http://web.mit.edu/scolton/www/filter.pdf It's really comprehensive and it might help you get a better idea of what you really want, it pretty much did the trick for me.
I guess it's pretty much up to you, but, implementing the Kalman filter doesn't require only pretty solid know-how in math, system theory and in this case physics but is also very demanding regarding CPU load. In case you have in mind using, let's say an Atmega328 clocked at 16Mhz you may have problems using this kind of filter. It's really effective if you are using a DSP so you can lowpass-filter you acc input.
All in all, my advice is - try using the 1st order complementary filter or maybe even 2nd order complementary filter in case you're not satisfied with the results . If your system is free of high-frequency vibrations that should work great. Other that that JustJeff's link is the perfect place to start in case you get stuck with the implementation :)
All the best, Dan
I am also a novice and also looking some solution to my navigation work. same as you, I have a board configed with 3-axis accelerometer and 2D gyroscope. until now I have read many materials about this, likewise I decide to adopt kalman filter to my signal dealing. may be I don't have some suggestion to you, but i want to share something with you I had seen before. there are some links point to them, hope that is useful to you.
- Introduction of Kalman Filter
- CAS Robot Navigation Toolbox
- Open Source Inertial Navigation Toolbox
- Source code of A project about navigation
limited to my reputation, I only have authority to post less than 2 links. so the other two I want post as below: