cancel
Showing results for 
Search instead for 
Did you mean: 

FusionFX and quaternions - stationary drift

PLuze.1
Associate II

Hello,

I'm using the FusionFX library(V2.5) to calculate quaternions and therefore estimate an object position. I'm using an X-NUCLEO-IKS01A3 that has the  LSM6DSO (ACC + Gyro) and LIS2MDL ( Mag). I'm using an 16G scale in acc and 2000dps in the gro, at an ODR of 6667Hz and 100Hz for the Mag and I'm calling the propagate and update function at a rate of 100Hz. Everything works pretty well on fast or slow movements, but when i put my dev board on the table after movement, it starts to drift very slowly no stop.

I've been messing around the knobs and this is what i've already tried:

  • start_automatic_gbias_calculation 1, set knobs, wait 10 or more seconds, read the gbias_***_th_sc values, but they don't change
  • LMode 0, 1 or 2, it doesn't seem to change the behavior.
  • modx is set at 1
  • messing around the Atime, Mtime and FrTime values
  • Mag calibration

When i read the knobs, i get the default Mtime of 1.5. The documentation on the UM2220 says that this last values range from 0 to 1. There must be a mistake.

From what I've been reading, this must be when the sensor is stationary, there is still deviation on the values of the sensors, and that error is being integrated by the algorithm over the time, causing this stationary drift. Is this correct? How can i minimize this sensor deviation? applying filters (LPF and HPF) on the acc+gyro? is there a parameter in the library that allows to recognize or set a threshold for when its stationary?

best regards,

Pedro

3 REPLIES 3
niccolò
ST Employee

Hi Pedro @PLuze.1​ ,

It seems to me that you did every step right, firt thing I thought reading the your question was that the magnetometer wasn't calibrated =P

anyway, maybe you can try to run the gyro calibration using the MotionGC library

https://www.st.com/resource/en/user_manual/dm00372763-getting-started-with-motiongc-gyroscope-calibration-library-in-xcubemems1-expansion-for-stm32cube-stmicroelectronics.pdf

Let me know it this helps

Niccolò

PLuze.1
Associate II

Hey, we are not using a st-microcontroller, and we are using a pre compiled version of motionfx to run in our micro, so we have to talk with support in order to get that motionGC(and motionAC to calibrate acc, am I right? ) and proceed from that point.

Regarding the other question: "When i read the knobs, i get the default Mtime of 1.5. The documentation on the UM2220 says that this last values range from 0 to 1. There must be a mistake."

I have another question: what is the format of the MFX_output_t.quaternion ? is it quaternion[0] = X,quaternion[1] = Y,quaternion[2] = Z, quaternion[3] = W?

Hi Pedro @PLuze.1​ ,

yes, the MotionAC is for the accelerometer, I would have done the gyro calibration before, because it does not seem an acceleration problem, but every calibration is a good practice =)

regarding your other question, I don't recall by memory the right values, and I can't find where it says the possible values for that parameter on the UM.

maybe you can try to change it to a lower or middle value, like 0.5 using the MotionFX_setKnobs() function and see if it gets better.

lastly, about the .quaternion format: yes, there are four values of the quaternion, arranged as an array, but they do not represent X,Y and Z axis.

I'm not the person best suited to explain the concepts of quaternions, but if you want I can point you to some online resources.

Niccolò