Good Kalman filter example or explanation?

Post your NXJ projects, project ideas, etc here!

Moderators: 99jonathan, roger, imaqine

Good Kalman filter example or explanation?

Postby kvols » Sun May 22, 2011 12:12 pm

Hi there

I've been tinkering with the HiTechnic Gyro sensor to make a compass. Unfortunately, the analog gyro sensor does give quite a bit of noisy readings.

As several have pointed out, (some of) that could be corrected by using a 'Kalman filter'. LeJOS does include such a filter, but I cannot find a clue to how to use it!

Could someone please point me in a direction where I can get some "hands on" with this filter, without having to understand all the mathematical details of the filter?

Thanks!

;-) Povl
kvols
New User
 
Posts: 6
Joined: Sat May 21, 2011 10:13 pm

Re: Good Kalman filter example or explanation?

Postby Walt White » Sun May 22, 2011 5:21 pm

The Samples section of release 0.9.0 has a complete program using the filter under KalmanTest. It uses a different sensor, but at least you can play with a complete program. The whole subject is way over my head..........

Walt
Walt White
Novice
 
Posts: 44
Joined: Sun Aug 06, 2006 11:57 pm
Location: California Central Valley

Re: Good Kalman filter example or explanation?

Postby kirkpthompson » Sun May 22, 2011 6:38 pm

Greetings Povl.

Also take a look at the lejos.nxt.addon.GyroDirectionFinder class.
http://lejos.sourceforge.net/nxt/nxj/api/lejos/nxt/addon/GyroDirectionFinder.html

Best,
-K
Leg Godt!
User avatar
kirkpthompson
leJOS Team Member
 
Posts: 304
Joined: Wed Dec 05, 2007 1:27 am
Location: New Mexico, USA

Re: Good Kalman filter example or explanation?

Postby kvols » Tue May 24, 2011 9:28 pm

Thank you very much for your replies! :)

Povl
kvols
New User
 
Posts: 6
Joined: Sat May 21, 2011 10:13 pm

Re: Good Kalman filter example or explanation?

Postby Aswin » Wed Jun 01, 2011 7:38 am

Povl,

The idea of a Kalman filter is to fuse several sources of information. If there is only one source, as in your case, then the filter won't be of any help. You might be able to use the tacho's of the motors as an extra source, or a compass. But even then you would need to know the variance (statistical description) of the noise of all sources of information. I think you probably don't know and have to assume it is constant and guess a value. Under these circumstances the filter can be greatly simplified. You'll then end up with a filter that goes like this:
- calculate new heading from old heading and gyro reading.
- calculate new heading from old heading and tacho reading, or get new heading from a compass.
- make a weighted average of the two. The weight should reflect how much you trust the two sources of information.

The difference between the above filter and a real Kalman filter is that in a Kalman filter the weight is based on solid statistics and can vary over time. I hope this demystifies the filter a bit.

On my blog you can read of the proces I went through to understand the filter.

There are other ways to improve gyro output. Some of them also described on my blog as well. The gyrosensor class implements some of these ways.

Oh, my blog is here.
My NXT blog: http://nxttime.wordpress.com/
Aswin
leJOS Team Member
 
Posts: 207
Joined: Tue Apr 26, 2011 9:18 pm
Location: Netherlands

Re: Good Kalman filter example or explanation?

Postby kvols » Mon Jun 06, 2011 8:34 pm

Thank you very much, Aswin - that does take some of the mystery out of the filter, though I'm still a bit puzzled. ;-)

Kind regards, Povl
kvols
New User
 
Posts: 6
Joined: Sat May 21, 2011 10:13 pm


Return to NXJ Projects

Who is online

Users browsing this forum: No registered users and 1 guest

more stuff