View Single Post
Old Apr 28, 2013, 04:48 PM
SVentas is offline
Find More Posts by SVentas
Registered User
Lithuania, Vilnius Region, Vilnius
Joined Apr 2012
81 Posts
Hi evvaldis,
Congratulations on your OpenSource/Hardware project.
I'm just curious, why you use rectangle method as gyroscope integration method on such a powerful machine?
Code:
roll_angle =(roll_angle + ROLL*dt) + 0.0002*(acc_roll_angle-roll_angle);
I think that trapezoidal rule would be slightly better approach.
Code:
roll_angle =(roll_angle + (ROLL+ROLL_PREV)/2*dt) + 0.0002*(acc_roll_angle-roll_angle);
ROLL_PREV = ROLL;
Or you can double gyro sampling speed and use Simpson's rule. Something like that:
Code:
ROLL_TEMP = GetRoll(blabla); // Get the first sample;
ROLL = GetRoll(blabla);      // Get the second sample;
roll_angle =(roll_angle + (ROLL+ROLL_PREV+4*ROLL_TEMP)/6*dt) + 0.0002*(acc_roll_angle-roll_angle);
ROLL_PREV = ROLL;
SVentas is offline Find More Posts by SVentas