Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMU - Migrate to a better attitude calculation algorythm #30

Closed
digitalentity opened this issue Aug 3, 2015 · 5 comments
Closed

IMU - Migrate to a better attitude calculation algorythm #30

digitalentity opened this issue Aug 3, 2015 · 5 comments

Comments

@digitalentity
Copy link
Member

NAV code is now very sensitive to direction of gravity and magnetic field vector in aircraft frame - for controlling accelerations and heading. Estimating attitude as fast and precise as possible is a must. Current complementary filter is doing well, but there are better algorythms available, i.e. Robert Mayhony's DCM filter or Sebastian Madgwick's IMU fusion.

@digitalentity
Copy link
Member Author

current:
text data bss dec hex filename
118204 224 14156 132584 205e8 ./obj/main/cleanflight_NAZE.elf

with Madgwick AHRS
arm-none-eabi-size ./obj/main/cleanflight_NAZE.elf
text data bss dec hex filename
122212 220 14160 136592 21590 ./obj/main/cleanflight_NAZE.elf

Madgwick's AHRS took almost 4kb flash! I'll try see if it works better than complementary filter.

@digitalentity
Copy link
Member Author

Bench tests show that with Madgwick's AHRS heading is much more locked in (when using a compass). I've noticed that after a series of fast pitch-roll rotations complementary filter showed arbitrary heading and took half a second to correct using a compass. Using very same settings and same test Madgwicks AHRS was totally locked in.
But nothing comes without a price - for this I'm paying with extra 4k flash and lots of CPU cycles. When using complementary I was able to get looptime=1000, using AHRS I got only as low as looptime=1400. CPU is spending alot of time calculating AHRS.
Need to try it in-flight and see if it's worth it.

@digitalentity
Copy link
Member Author

Just tried to fly it - much worse than plain old complementary filter. HORIZON mode is very slow to react, copter feels mushy. That's probably due to incorrect beta used. Postponing this for now.

@bk79
Copy link

bk79 commented Aug 4, 2015

Have you tried slowing loop time? Probably it could help

Il giorno 00:18 mar 04/ago/2015 Konstantin Sharlaimov <
notifications@github.com> ha scritto:

Just tried to fly it - much worse than plain old complementary filter.
HORIZON mode is very slow to react, copter feels mushy. That's probably due
to incorrect beta used. Postponing this for now.


Reply to this email directly or view it on GitHub
https://github.com/digitalentity/cleanflight/issues/30#issuecomment-127420372
.

@digitalentity
Copy link
Member Author

I'm closing this as new NAV PID controllers seem to be doing their job pretty good with current IMU. Will re-open if still necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants