IMU - a pointer in the right direction?

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

Moderator: lukasz

Re: IMU - a pointer in the right direction?

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

yeah a good link.

I've got your Quanternion's implemenation working in vb.net with graph's and your Artifical horizon control (tweaked) - and thats nice, but it drifts like a bugger.

Onto Mr Kalman.

James
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:54 pm

If it drifts you need to tweak the constants a bit :-)
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 » Thu Mar 03, 2011 2:27 pm

interesting - which constants? Also I haven't implemented the PID from your code - just the quanternions.

James
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 2:30 pm

Oh ok,
So you took the code from ahrs_quaternion... You need to implemented the PID-part as well to compensate for drift. This is a simple complementary filter.

For your application, euler angles will work just fine!
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 » Thu Mar 03, 2011 2:45 pm

yes - so a Euler angle would be just X, Y and Z as degree's -90 -> +90 wouldn't it? Just simple addition and subtraction to modify, and trig to generate?

This would work for what you posted (brackets added for me):
Position = Last_Position + (Speed * dt)
Speed = Last_Speed + (Acceleration * dt)
Roll_Angle = Last_Roll_Angle + (Roll_Angle_Rate * dt)

and I can do pitch the same?
Pitch_angle = Last_Pitch_Angle + (Roll_Pitch_Rate * dt)

And the roll_angle_rate is the deg/s from the gyro I assume.

I assume this then forms the mathmatical model which I can then work on drift,etc, correction?

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 » Thu Mar 03, 2011 4:05 pm

Yes,

Keep in mind that this is simplified and will only work for small pitch and roll angles (which is true in your case).
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 » Thu Mar 03, 2011 4:31 pm

HIya

Yes - apart from yaw I suppose, but the size of the changes between readings will be small if thats what you mean.

James
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 5:11 pm

Nop,

(Do this with your hands)

The roll angle is 60 degrees. Pitch 40° up (as your pitch gyro would understand). You'll see that your true pitch angle is not 40° but ~ 40° * cos(60°)= 20°
User avatar
Tom
Site Admin
 
Posts: 1016
Joined: Fri Nov 13, 2009 6:27 pm
Location: Belgium

Previous

Return to Firmware

Who is online

Users browsing this forum: No registered users and 2 guests

cron