What is the best beta value in Madgwick filter?

6.3k Views Asked by At

When I use default value which 0.0041 or 0.033, rotations are weird when I send quaternion data to Unity 3D. When I changed beta value to 0.001, rotations are good but there is slight drift over time. I am using LSMD9S0 IMU sensor. Here is the my code Madgwick_Arduino

1

There are 1 best solutions below

0
On

Looking at the original article written by Sebastian Madgwick, we can find the following paragraph about beta value:

β is the divergence rate of {^S_E}q_ω expressed as the magnitude of a quaternion derivative corresponding to the gyroscope measurement error.

Later, it says:

The filter computes {^S_E}q_est as the rate of change of orientation measured by the gyroscopes, {^S_E}q_ω, with the magnitude of the gyroscope measurement error, β, removed in the direction of the estimated error, {^S_E}q_e, computed from accelerometer and magnetometer measurements.

So, beta magnitude is directly related with the error of gyroscope (I understand bias as the most important source of error here), but expressed directly over the components of a quaternion gradient. This means that it does not have an understandable unit, nor an intuitive optimal magnitude.

On the other hand, Madgwick filter assumes that the accelerometer measures gravity. This means that it is affected by horizontal accelerations. Filter parameters (the two it has) need to be adjusted for your specific case, achieving a tradeoff between gyro bias correction and sensitivity to horizontal accelerations.

As a rule of thumb: increasing beta leads to (a) faster bias corrections, (b) higher sensitiveness to lateral accelerations.

My previous experience with this filter required a few hours of experiments + manual tuning until we reached a satisfactory result. We didn't need to touch those values ever again.