kriswiner / MPU9250

Arduino sketches for MPU9250 9DoF with AHRS sensor fusion
1.04k stars 471 forks source link

How to choose bandwidth and sample rates for Madgwick and accurate acceleration #152

Open LuKo91 opened 7 years ago

LuKo91 commented 7 years ago

Hello,

first of all, thank you very much for your great codebase! It helped me a lot so far on my own project. I am new to working with IMU's and Pose Estimation filters, so I do need some help and I hope that I am right here ;) To ask my questions, I think it is necessary for me to describe my system setup and my project first.

My system consists of 2 subsystems:

Subsystem 1: A mobile platform with an cortex m3 connected to the MPU9250. This is the subsystem that I want to track in orientation and position. Subsystem 2: Exact hardware is unimportant. Just need to know, that it is a fast and static backbone system.

What happens in Subsystem 1:

What happens in subsystem 2:

I do have 2 different tracking scenarios:

Questions: 1) How should I choose the bandwidth of the gyroscope and accelerometer ? In my understanding, it is best to minimize noise as much as possible through choosing the smallest bandwidth which still can measure the movement accurately. Is that right ? Given the two decribed scenarios, which bandwidth (bSensor) should I take ? 2) fSensorRate will probably be 1kHz. How should I choose the fOutputRate/Sample Rate Divider then? Due to the fact, that the data will be used by the Madgwick update step more often than it will be transmitted to subsystem 2 (only 10Hz), I should choose fOutputRate/Sample Rate Divider close to fCallMadgwickUpdate, right ? 3) If I have a Sample Divider of 1 for example, what does it mean? Does it mean that the readable registers of the IMU are just updated every second time there is a measurement with the latest measurement? So that half of the measurements are not taken into account? Or is there some kind of averaging (in this case, the average of the latest two measurements) ? 4) Well what is the best for fCallMadgwickUpdate then? Can I choose fCallMadgwickUpdate = fLoop and use the varying fLoop as SampleFreq inside the Madgwick algorithm for each step? Or should I better use a timer for the call of Madgwick update to have a static, but smaller SampleFreq in the Madgwick algorithm ?

I hope it is ok to write so many questions, but I am left alone to myself here and I really need help.

Thank you very much!!

Greetings, Lucas

kriswiner commented 7 years ago

I would run the gyro and accel at 1 kHz smale rates. The bandwidth for this application can be large, i.e., the same as the sample rate. Then you want to run the Madgiwck filter at 5 - 10 x the sample rates if you can.