kriswiner / EM7180_SENtral_sensor_hub

(Affordable) Ultimate Sensor Fusion Solution
https://www.tindie.com/products/onehorse/ultimate-sensor-fusion-solution/
96 stars 37 forks source link

How to increase the Sensor Fusion rate as well as the low pass filter bandwiths? #10

Open GM223 opened 7 years ago

GM223 commented 7 years ago

Hi, I recently bought the board and the results are pretty amazing. I am able to get an output data rate of 100hz by using your provided sketch but for my application i require as high a data rate possible. 400hz (which is max hardware fusion rate) of filtered quaternion output should be good enough but here lies the problem. I have changed various parameters such as : writeByte(EM7180_ADDRESS, EM7180_QRateDivisor, 0x01); // same data rate as gyro rate writeByte(EM7180_ADDRESS, EM7180_AccelRate, 0x28); // 400/10 Hz writeByte(EM7180_ADDRESS, EM7180_GyroRate, 0x28); // 400/10 Hz

But the quaternion output rate has not increased over 130 Hz max. Any help would be appreciated.

Thank you image

kriswiner commented 7 years ago

Well first thing is I would change this line:

writeByte(EM7180_ADDRESS, EM7180_QRateDivisor, 0x01); // same data rate as gyro rate

to this:

writeByte(EM7180_ADDRESS, EM7180_QRateDivisor, 0x00); // same data rate as gyro rate

since the divisor is applied as 1/(1 + qratedivisor) you should have gotten something like 200 Hz of quaternion output. Not sure if you will get the full 400 Hz this way, if you need even faster rates you could try to increase the gyro rate to 1 kHz.

On Sun, Apr 16, 2017 at 3:13 AM, GM223 notifications@github.com wrote:

Hi, I recently bought the board and the results are pretty amazing. I am able to get an output data rate of 100hz by using your provided sketch but for my application i require as high a data rate possible. 400hz (which is max hardware fusion rate) of filtered quaternion output should be good enough but here lies the problem. I have changed various parameters such as : writeByte(EM7180_ADDRESS, EM7180_QRateDivisor, 0x01); // same data rate as gyro rate writeByte(EM7180_ADDRESS, EM7180_AccelRate, 0x28); // 400/10 Hz writeByte(EM7180_ADDRESS, EM7180_GyroRate, 0x28); // 400/10 Hz

But the quaternion output rate has not increased over 130 Hz max. Any help would be appreciated.

Thank you [image: image] https://cloud.githubusercontent.com/assets/6009227/25070423/3adfe556-22b7-11e7-8484-25c13e9b7d32.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kriswiner/EM7180_SENtral_sensor_hub/issues/10, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qmr5qJldCYPoPrY4VFjNGZwVWpegks5rwenNgaJpZM4M-l4h .

bmegli commented 6 years ago

@GM223

ODR and Kalman update rate are two different things.

According to the EM7180 register map:

So it seems that:

Also:

bmegli commented 6 years ago

@kriswiner

since the divisor is applied as 1/(1 + qratedivisor)

Interestingly you are correct despite that this contradicts documentation in several places:

I have measured the rate at which I get quaternion interrupts and:

bmegli commented 6 years ago

Not sure if you will get the full 400 Hz this way, if you need even faster rates you could try to increase the gyro rate to 1 kHz.

With USFS I got:

Neither of those resulted in setting AlghoritmSlow flag.

ODR was measured as frequency of quaternion interrupts (interrupts that result in quaternion data ready flag)

According to the EM7180 documentation:

It remains unclear whether:

kriswiner commented 6 years ago

The quaternion rate is the same as the gyro rate guaranteed up to 400 Hz and maybe higher. The maybe depends on the sensor, the efficiency of the sensor driver, and your mCU among other things. The fact that you are seeing a rate as high as 833 Hz is an indication of the kind of limit I expect. And at that rate you might miss the occasional quat update. I would run it at 500 Hz in this case if you need the fastest quaternion update.

Not everything your read will be correct.

On Wed, Jul 4, 2018 at 5:59 AM, Bartosz Meglicki notifications@github.com wrote:

Not sure if you will get the full 400 Hz this way, if you need even faster rates you could try to increase the gyro rate to 1 kHz.

With USFS I got:

  • 333 Hz ODR at 330 Hz Gyro & Accel
  • 500 Hz ODR at 500 Hz Gyro & Aceel
  • 833 Hz ODR at 1000 Hz Gyro & Accel

Neither of those resulted in setting AlghoritmSlow flag.

ODR was measured as frequency of quaternion interrupts (interrupts that result in quaternion data ready flag)

According to the EM7180 documentation:

  • the outputs are updated at a rate limited to the gyro output data rate (ODR), to a maximum of 400 Hz

It remains unclear whether:

  • interrupt is generated more often but quaternions updated at 400 Hz
  • quaternions are updated at higher rate contradicting documentation

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kriswiner/EM7180_SENtral_sensor_hub/issues/10#issuecomment-402471890, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qiRHHXbUlsJ94_e1W2fJJeoLweVIks5uDLwcgaJpZM4M-l4h .

EinSoldiatGott commented 5 years ago

Hi. I have a difference between the rate printed by the sketch and the rate measured with an oscilloscope on the INT pin.

The maximum output I get is approx 60Hz while the sketch says 1khz. I'm using an Arduino UNO with your sketch.

https://photos.app.goo.gl/hST84zsg75DaEPqZ6

Is there any factor in your sketch rate print?

Thanks

kriswiner commented 5 years ago

The rate is the rate of the Madgwick fusion filter which is done on the host using the sensor data read from the EM7180. This is just for comparison and I would not use this for anything. Use the EM7180 quaternions to convert to yaw, pitch and roll on the host or just read yaw, pitch and roll directly from the EM7180 instead of quaternions. The rate of the EM7180 interrupt depends on which interrupts are allowed. I generlly limit the interrupt to new quaternion ready and this rate is determined by the rate of the gyro and a qratedivisor such that the quaternion rate is gyro rate/(1 + qratedivisor). So if you use a gyro rate of 200 Hz and a qrate divisor of 2 you sill see ~66 Hz at the interrupt. Please take a look at the data sheet or this https://github.com/kriswiner/EM7180_SENtral_sensor_hub/wiki wiki.

On Fri, Aug 31, 2018 at 9:26 PM EinSoldiatGott notifications@github.com wrote:

Hi. I have a difference between the rate printed by the sketch and the rate measured with an oscilloscope on the INT pin.

The maximum output I get is approx 60Hz while the sketch says 1khz. I'm using an Arduino UNO with your sketch.

https://photos.app.goo.gl/hST84zsg75DaEPqZ6

Is there any factor in your sketch rate print?

Thanks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kriswiner/EM7180_SENtral_sensor_hub/issues/10#issuecomment-417831847, or mute the thread https://github.com/notifications/unsubscribe-auth/AGY1qpo6IKJbOFz_utJgXt_iTgT0ZcOmks5uWgyJgaJpZM4M-l4h .