kriswiner / MPU9250

Arduino sketches for MPU9250 9DoF with AHRS sensor fusion
1.03k stars 472 forks source link

Fusion Rate #420

Open luizamanfrini opened 4 years ago

luizamanfrini commented 4 years ago

Hi Kris! I am new to Madgwick and I am a bit confused with que fusion rate. How can I define it and change it?

Thank you for your attention. Your code is great!

kriswiner commented 4 years ago

The Madgwick filter is iterative, so generally 10 - 20 iterations pre new data set is enough to get good stable yaw estimation. So the rate will depend on how fast your MCu is. It is not something you can adjust except by changing your processor.

See this example:

https://github.com/kriswiner/MPU9250/tree/master/AK8963_as_slave

On Wed, Jun 10, 2020 at 2:58 PM luizamanfrini notifications@github.com wrote:

Hi Kris! I am new to Madgwick and I am a bit confused with que fusion rate. How can I define it and change it?

Thank you for your attention. Your code is great!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/420, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKQBTIPKKSQNEXU67NLRV76XHANCNFSM4N2ZZGQA .

basil96 commented 4 years ago

Hi Kris,

I'm getting ~6170 Hz fusion rate on the Dragonfly, is that even real? Seems unbelievably high!

BTW, I had to make the same change to the Wire.begin() call in MPU9250BasicAHRS_Dragonfly as discussed in #421. Can I submit that as a PR?

kriswiner commented 4 years ago

Yes, this is correct. The L4 is a Cortex M4F, meaning it has a FPU. You really only need to iterate 10 or 20 times for best results with the Madgwick or Mahoney filters, so if you are at 6 kHz fusion rate you could enforce the iteration rate to 10 or 20 times or increase the data sample rate to 500 or 1000 Hz.

On Thu, Jun 18, 2020 at 11:30 AM Basil notifications@github.com wrote:

Hi Kris,

I'm getting ~6170 Hz fusion rate on the Dragonfly, is that even real? Seems unbelievably high!

BTW, I had to make the same change to the Wire.begin() call in MPU9250BasicAHRS_Dragonfly as discussed in #421 https://github.com/kriswiner/MPU9250/issues/421. Can I submit that as a PR?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kriswiner/MPU9250/issues/420#issuecomment-646234321, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTDLKWWFSTG6JMEFNQKZ4TRXJMLHANCNFSM4N2ZZGQA .

basil96 commented 4 years ago

Awesome. I can do that. I just noticed that you committed the I2C change yesterday, nvm :)