small angles 25deg alternative solution

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

small angles 25deg alternative solution

Post 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#

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: small angles 25deg alternative solution

Post by Alexinparis »

I take it :)

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: small angles 25deg alternative solution

Post 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)

scrat
Posts: 925
Joined: Mon Oct 15, 2012 9:47 am
Location: Slovenia

Re: small angles 25deg alternative solution

Post by scrat »

So this means that quad must be almost flat when powering or?

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: small angles 25deg alternative solution

Post by timecop »

This is optimization for old feature that's been present since long time ago. It doesn't change any functionality.

Mis
Posts: 203
Joined: Fri Apr 01, 2011 12:23 am

Re: small angles 25deg alternative solution

Post 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;

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: small angles 25deg alternative solution

Post by timecop »

I just noticed same problem yesterday as I was holding copter fully upside down.
Time to fix :)

Post Reply