Pages: [1]   Go Down
Author Topic: How does the Kalman Filter Works?  (Read 4194 times)
0 Members and 1 Guest are viewing this topic.
Brazil
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Guys,

I've seen a lot of codes and videos, applying the Kalman filter. But I did not find an easy, and well explained text on this subject yet.

I got one question about this, as far I see people use accelerometer + gyros... Is there an way to apply Kalman's filter on a single 3 axis accelerometer?

Thanks in Advance,

Tony
« Last Edit: August 16, 2009, 04:44:50 pm by moraesgyn » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Antonio,

I have done a lot of research about Kalman filters recently and found many publications and papers on the Internet which I have downloaded.

Here is the link to the zipped documents. It´s about 43 MB:

http://dl.getdropbox.com/u/697605/Kalman.zip

Maybe there is a text that is interesting for you.

Paul
Logged

Brazil
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Dude!

thanks for your reply... I tried the link but its broken...

thanks again,

Tony

« Last Edit: August 17, 2009, 03:34:43 pm by moraesgyn » Logged

0
Offline Offline
Jr. Member
**
Karma: 2
Posts: 81
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Link works for me ....
Logged

Erkläre es mir, ich werde es vergessen. Zeige es mir, ich werde es vielleicht behalten. Lass es mich tun, und ich werde es können. Indisches

Brazil
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

wow, it works now... I guess it was bad luck... maybe site on maintenance or something....

thanks!
Logged

0
Offline Offline
Jr. Member
**
Karma: 2
Posts: 81
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I also would like to say thanks. Even geman papers within. That helps a lot smiley-grin

Need some weekends...
Logged

Erkläre es mir, ich werde es vergessen. Zeige es mir, ich werde es vielleicht behalten. Lass es mich tun, und ich werde es können. Indisches

0
Offline Offline
Full Member
***
Karma: 0
Posts: 113
Arduino paper
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi - I will say right up - I really suck at maths smiley Also - I don't have anywhere near the grasp of Kalman that some of the other guys working on the Nunchuk/MP integration have.

But, from my lucid understanding.. if you want to smooth *just* an accelerometer, then... "This is not the filter you are looking for ".... smiley
It can work with just one input - but its a lot of work and Im not sure how much benefit it would bring to a single input versus iterative integrations of two.

This is all *very* lay terminology - so forgive me maths geniuses smiley Kalman smooths 'noisy' samples, and does that by integrating another set of samples from a sensor that is 'more accurate' over shorter times based on 'weighting' the results between the two.

The best example I can give is with the accelerometers and the gyro.

The accelerometers suffer very little drift over time compared to the gyro but are very sensitive, even at rest. Small movements can be lost. The Gyro's are very accurate in short bursts, but rapidly (compared to accelerometer drift) get distorted by drift... One could say the two sensors exhibit the complimentary behavior of each other.

So by using Kalman, we can predict an accurate result and cancel out noisy (i.e, not fitting within the prediction matrix for that particular sample ), thus smoothing the input from each and then combine the results to produce a set of very accurate numbers - using one sensor to cancel out the other sensors issues. In this instance, the Kalman wants to 'prefer' the gyro in the first instance, but as sampling continues, it wants to shift that weight to preferring the now more accurate accelerometer data. This produces a "smooth" plot of movement, without confusing plots based on 'noise' or 'drift' within each particular sensor. The hard part is tweaking those 'weightings' to produce smooth data - thats all the tuning that people refer to with Kalman. Not only the weighting of the integration, but also the weighting of the first stage of 'smoothing'..

One could also modify GPS data to interpolate with the accelerometers - I say modify because to the best of my knowledge, you need everything in the same "units of measure", thus you need to compute the acceleration between two GPS sample points and the Heading as discreet values and then use them to integrate in Kalman (i.e, you can't just plonk in the lat/lng and use that as an Int smiley )

If you haven't seen Tom Pykes excelent MAV-blog, then thats probably one of the more comprehensive explanations of how to apply Kalman filters to IMU's.. http://tom.pycke.be/mav/71/kalman-filtering-of-imu-data

I'd love to have a better understanding of the actual Maths... but like I said originally.. I suck at maths  ;D My apologies if I have really butchered this explanation....
« Last Edit: August 17, 2009, 06:39:24 pm by adr1an » Logged

Checkout my projects development blog @ SLiDA

Brazil
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Adr1an,

this is the best explanation so far... Thanks for taking your time and sharing this with us. =)

I think after reading and reading and reading... and going thru all the math, this is the most simple, and most compreensive text on Kalman filters I ever read.... and some times thats all we need  smiley-wink

thanks for posting,

Tony
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 88
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you are looking for an intro to Kalman filters, this might also be useful (see also the entries on accelerometers and gyros):

http://tom.pycke.be/mav/71/kalman-filtering-of-imu-data
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ive read your wonderful reply on kalman filter operation but one thing still bugs me though. from my understanding both the accel and gyro outputs should be converted to angles  in order for them to be able 'smooth' each other out? the gyroscope is able to measure rate of rotation with respect to the 3 axes so from that you can get 3 'angles' of tilt. but from what ive read accels can only measure tilt in 2 axes. how will i be able to smoothen out the single remaining gyro axis?
Logged

0
Offline Offline
Edison Member
*
Karma: 0
Posts: 1103
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It seems that interesting link is again  down... Does anyone have a copy?
http://dl.dropbox.com/u/697605/Kalman.zip
Logged

UK
Offline Offline
God Member
*****
Karma: 13
Posts: 903
Twitter: @simonmonk2
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yikes scary maths!

I have successfully used the following algorithm to smooth a pulse monitor signal from a phototransistor connected to an analog pin, prior to determining the local max and mins to get the pulse rate.

I took it from the Apple iPhone example code for using the accelerometer, so I guess it might do the trick for you.

I believe its called lossy integration.

Adjust alpha for the level of smoothing.

#define alpha 0.8

void loop()
{
  static double lastX = 0;
  double newX = readAccelerometerX();
  double smoothX = alpha * lastX + (1 - alpha) * newX;
  lastX = newX;
  // ditto for the other 2 axes
}

I found it to be very effective and within my limited mathematical grasp. I tried it all out in a spreadsheet first, then used captured data from the serial monitor to get the right value of alpha.
Logged

--
My New Arduino Book: http://www.arduinobook.com

0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Dude!

I tried the link but its broken...
M working on the 2 wheel balancing robot.. Please help in Kalman Filter Equations..
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I found a nice Kalman Filter training software named 'Visual Kalman Filter'. Maybe it's helpful for you.
http://www.luckhan.com/kalman-filter-design.htm
Good luck!
« Last Edit: December 17, 2010, 10:28:39 pm by oldjack » Logged

Pages: [1]   Go Up
Jump to: