Page 1 of 1

small angles 25deg alternative solution

Posted: Sun Sep 29, 2013 11:48 pm
by timecop
How about replacing current version that uses unfiltered acc data with something like this?
https://code.google.com/p/afrodevices/s ... ail?r=415#

Re: small angles 25deg alternative solution

Posted: Mon Sep 30, 2013 11:28 pm
by Alexinparis
I take it :)

Re: small angles 25deg alternative solution

Posted: Mon Sep 30, 2013 11:54 pm
by timecop
> #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)

Re: small angles 25deg alternative solution

Posted: Tue Oct 01, 2013 12:06 pm
by scrat
So this means that quad must be almost flat when powering or?

Re: small angles 25deg alternative solution

Posted: Tue Oct 01, 2013 12:54 pm
by timecop
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

Posted: Mon Oct 07, 2013 5:50 pm
by Mis
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):

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

Posted: Tue Oct 08, 2013 2:18 am
by timecop
I just noticed same problem yesterday as I was holding copter fully upside down.
Time to fix :)