Page 2 of 2
Re: IMU - a pointer in the right direction?
Posted:
Thu Mar 03, 2011 1:47 pm
by javalin
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
Re: IMU - a pointer in the right direction?
Posted:
Thu Mar 03, 2011 1:54 pm
by Tom
If it drifts you need to tweak the constants a bit
Re: IMU - a pointer in the right direction?
Posted:
Thu Mar 03, 2011 2:27 pm
by javalin
interesting - which constants? Also I haven't implemented the PID from your code - just the quanternions.
James
Re: IMU - a pointer in the right direction?
Posted:
Thu Mar 03, 2011 2:30 pm
by Tom
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!
Re: IMU - a pointer in the right direction?
Posted:
Thu Mar 03, 2011 2:45 pm
by javalin
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
Re: IMU - a pointer in the right direction?
Posted:
Thu Mar 03, 2011 4:05 pm
by Tom
Yes,
Keep in mind that this is simplified and will only work for small pitch and roll angles (which is true in your case).
Re: IMU - a pointer in the right direction?
Posted:
Thu Mar 03, 2011 4:31 pm
by javalin
HIya
Yes - apart from yaw I suppose, but the size of the changes between readings will be small if thats what you mean.
James
Re: IMU - a pointer in the right direction?
Posted:
Thu Mar 03, 2011 5:11 pm
by Tom
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°