IMU - a pointer in the right direction?

Here is the place for all your dsPic or autopilot questions.

Moderator: lukasz

IMU - a pointer in the right direction?

Postby javalin » Mon Feb 28, 2011 10:03 am

Hello all,

Excuse the pun...

I have a spark fun 6 DOF IMU board - http://www.sparkfun.com/products/10010 that I want to use for a racelogging application. I ideally I want to get X, Y, Z angles from it and accel updates to complement the GPS on the board.

I have the correct gyro and accell data comming back from the board via Parallax Propeller, and have a VB.net app to debug the data.

I've been reading a lot about filtering the outputs either via complimentary filters or the kalman filter based on Tom's example code.

Is there anything I should be reading to try and understand this a bit more? I get the concepts, but not the specifics.

Stage 1- get the hardware working and the correct values comming off the uP.
Stage 2- work out angles & forces
Stage 3 - kalman / complimentary filter?

I guess I am at stage 2 currently.

Cheers,
James
javalin
 
Posts: 10
Joined: Wed Feb 23, 2011 11:19 am
Location: UK

Re: IMU - a pointer in the right direction?

Postby Tom » Tue Mar 01, 2011 7:56 am

Hi James,

If you want a full-kalman filter, you can see how to make the model in this nice thesis:
http://epubl.ltu.se/1402-1617/2000/081/ ... 081-SE.pdf

How to make the mathematical model (e.g. roll(t+dt) = roll(t) + roll_rate*dt) is the most important.

Once you have this you can make it really simple using a complementary filter, or you can use Matlab to do the Kalman filter.
User avatar
Tom
Site Admin
 
Posts: 1016
Joined: Fri Nov 13, 2009 6:27 pm
Location: Belgium

Re: IMU - a pointer in the right direction?

Postby javalin » Tue Mar 01, 2011 8:33 am

Hiya Tom,

Thanks for the reply.

I see that the thesis has the mathmatical model in it as well. I kinda understand matrix but how do I translate this into straight forward math / code - i.e. page 22 / 23. Is there a standard explaination for the elements in this type of matrix?

Cheers,

James
javalin
 
Posts: 10
Joined: Wed Feb 23, 2011 11:19 am
Location: UK

Re: IMU - a pointer in the right direction?

Postby Tom » Tue Mar 01, 2011 8:48 am

I was refering to to the model on page 60 :-)
The detailed are explained on the previous page.

For a car this can be greatly simplified: speeds v and w will be zero. I suppose pitch and roll will be zero too or do you want to measure those small angles?
User avatar
Tom
Site Admin
 
Posts: 1016
Joined: Fri Nov 13, 2009 6:27 pm
Location: Belgium

Re: IMU - a pointer in the right direction?

Postby javalin » Tue Mar 01, 2011 9:01 am

>For a car this can be greatly simplified: speeds v and w will be zero. I suppose pitch and roll will be zero too or do you want to measure those small angles?
surely for a car its much the same as a aircraft, except that you won't change in angles (gimbal lock) very much. Yes I'd like to read the pitch and roll of the car. When you say speed will be zero - what do you mean? Obviously the car will be in motion.

>I was refering to to the model on page 60
yowza thats a big matrix. The ones on 22,23 and 24 look more friendly! ;)

Thanks,
James
javalin
 
Posts: 10
Joined: Wed Feb 23, 2011 11:19 am
Location: UK

Re: IMU - a pointer in the right direction?

Postby Tom » Tue Mar 01, 2011 9:07 am

u = forward motion
v = sideways motion
w = downwards motion

Even most UAV (simplified) kalman filters assume v = 0. Of course if you want to monitor a drifting rally car, you may need to use v as well ;-)

Why exactly do you want to complement the GPS with the accelerometer's values? Isn't the update rate of the GPS good enough?
User avatar
Tom
Site Admin
 
Posts: 1016
Joined: Fri Nov 13, 2009 6:27 pm
Location: Belgium

Re: IMU - a pointer in the right direction?

Postby javalin » Tue Mar 01, 2011 9:39 am

Hiya

Its a 5hz GPS but ideally it'd be nice to work out code to integrate the IMU data to increase the datalogging rate to 10hz or 20hz. I would like to get the cars attitude from the IMU so I can see the pitch & roll as its cornering,braking etc.

w will certainly be zero, v should be close to zero unless car is sliding - which is another useful thing to know for suspension setup, cornering speeds etc, etc.

Thanks,

James
javalin
 
Posts: 10
Joined: Wed Feb 23, 2011 11:19 am
Location: UK

Re: IMU - a pointer in the right direction?

Postby javalin » Tue Mar 01, 2011 10:04 am

Thinking more - I guess the problem I am having is that so much of what you read about IMUs etc assumes a lot of prior knowledge - i.e. rotation is expressed in matrix's i.e.

Image

Which I need to understand what it means when represented like this so I can turn it into code - i.e. X := sin(p) * rad2deg or whatever

Help?

James
javalin
 
Posts: 10
Joined: Wed Feb 23, 2011 11:19 am
Location: UK

Re: IMU - a pointer in the right direction?

Postby javalin » Thu Mar 03, 2011 1:11 pm

Its amazing what you can find - can you guess what my search term was...?

http://bilgin.esme.org/BitsBytes/KalmanFilterforDummies.aspx
javalin
 
Posts: 10
Joined: Wed Feb 23, 2011 11:19 am
Location: UK

Re: IMU - a pointer in the right direction?

Postby Tom » Thu Mar 03, 2011 1:18 pm

Indeed! Great find!

But as you can see, it explains the Kalman algorithm. The key to your success lies in the model you put into the Kalman filter.
It is mosly based on high-school physics, but matrix representations make it hard to understand.
In your situation, you'll need to do something like

Position = Last_Position + Speed * dt
Speed = Last_Speed + Acceleration * dt
Roll_Angle = Last_Roll_Angle + Roll_Angle_Rate * dt

And this for both longitude and latitude3
User avatar
Tom
Site Admin
 
Posts: 1016
Joined: Fri Nov 13, 2009 6:27 pm
Location: Belgium

Next

Return to Firmware

Who is online

Users browsing this forum: No registered users and 3 guests

cron