How about replacing current version that uses unfiltered acc data with something like this?
https://code.google.com/p/afrodevices/s ... ail?r=415#
small angles 25deg alternative solution

 Posts: 1630
 Joined: Wed Jan 19, 2011 9:07 pm
Re: small angles 25deg alternative solution
> #define ACCZ_25deg (uint16_t)(ACC_1G * cos(3.1415927/180*25))
On tarduino, you probably just wanna precalculate the cos(25) part as 0.90631 or something, leaving a clear comment where it came from (cos(theta) of accZ)
On tarduino, you probably just wanna precalculate the cos(25) part as 0.90631 or something, leaving a clear comment where it came from (cos(theta) of accZ)
Re: small angles 25deg alternative solution
So this means that quad must be almost flat when powering or?
Re: small angles 25deg alternative solution
This is optimization for old feature that's been present since long time ago. It doesn't change any functionality.
Re: small angles 25deg alternative solution
But this optimisation is buggy.
If the copter is upside down, the f.SMALL_ANGLES_25 is 1, but should be 0.
Propper code (remove abs):
If the copter is upside down, the f.SMALL_ANGLES_25 is 1, but should be 0.
Propper code (remove abs):
Code: Select all
if ((int16_t)EstG32.A[2] > ACCZ_25deg)
f.SMALL_ANGLES_25 = 1;
else
f.SMALL_ANGLES_25 = 0;
Re: small angles 25deg alternative solution
I just noticed same problem yesterday as I was holding copter fully upside down.
Time to fix
Time to fix