Skip to main content
Visitor II
December 16, 2020
Solved

I'm using LSM9DS1 and MotionFX to get heading of device, but I get some trouble.

  • December 16, 2020
  • 3 replies
  • 2395 views

I'm using LSM9DS1 and MotionFX to get the heading of my device,(also I am using MotionAC, MotionGC, MotionMC to perfome a calibration ), I can get a good result sometimes (usually after a QUICK movement or rotation). But, when it is static or moving slowly , the value of heading_9X hardly changes. What the problem is? How to fix it?

    This topic has been closed for replies.
    Best answer by RZHU.1

    This problem has been solved. The cause is not the libraries but the sensor itself. My program is based on the example “lsm9ds1_data_read_ polling�?, and in this example, the HPF of lsm9ds1 is turned on. This operation makes the sensor filter out low frequency rotation signal so when it spins in a certain angular velocity, the output will only generate an impulse then soon decay to zero. After disabling the HPF, the sensor and libraries finally work correctly.

    Thank you all the same.

    Best regard.

    3 replies

    ST Employee
    December 18, 2020

    Hi @RZHU.1​ ,

    Do you periodically use the calibration libraries or you just run them once at the beginning?

    The higher deviation experienced during slow movements or static positioning could depend from the integration performed during the calculation of the displacement from the acceleration / gyro / magnetometer: during a quick movement, an eventual noise is averaged up in sign during the calculation, while.

    My suggestion is to try to decrease the update frequency of the libraries, for example setting it at its minimum value, 20Hz. The other suggestion is to periodically run the device calibration libraries, if not already done. Are you using a custom platform?

    -Eleon

    RZHU.1Author
    Visitor II
    December 18, 2020

    Thanks so much!

    I am using the board which is designed by myself. It is designed for an in-door ground moving robot.

    I do run the device calibration libraries periodically, the frequency of calling MotionAC ,MotionGC and MotionFX is 100Hz, and that of MotionMC is 40Hz. 

    I changed the frequency of the updation of MotionFX to 20Hz just now, and the result did not changes. I wonder if it is because that the robot always move on the same plane, and the library need some data changing of the third axis to update the result?

    ST Employee
    December 21, 2020

    Hi @RZHU.1​ ,

    it could be the case... the suggested movement for the magnetometer calibration is on the 3 axis, for example as depicted below.

    However, this complete calibration can be run at the beginning of the test, and the periodical calibration during the test can be avoided.

    0693W000006GVkBQAW.png 

    -Eleon

    RZHU.1Author
    Visitor II
    December 22, 2020

    :loudly_crying_face:

    ST Employee
    December 23, 2020

    Hi @RZHU.1​ ,

    In the static condition (uniform velocity included) the accelerometer and the gyroscope are more trusted, since their value has to be near 0. The magnetometer gives low info in static condition, maybe only the absolute orientation if well calibrated.

    You might try to act on the Float MTime control knob, which value can vary from 0.5 to 10, and see what happens. As stated in DT0075 p.1, if it is low, magnetometer is trusted more in the update phase (see below) in dynamic condition; it is convenient to set it to a high value if magnetometer is unreliable because of magnetic anomalies or imperfect hard/soft iron compensation.

    -Eleon

    RZHU.1Author
    Visitor II
    December 24, 2020

    Thank you for your suggestion. I did an experiment that made the robot spin around in its maximum angular velocity. In this situation, the output heading value changes occasionally, looks like it’s not so “static�? as before, while it’s still far from reliable. Besides, I noticed that when the robot come across uneven ground, the output will change immediately.

    Then I tried a series of value of MTime, such as 0.5, 1, 2 and 5. After comparing several sets of output data acquired in different parameter conditions, I found that MTime does insignificant influence to the result.

    After that I read relevant manuals several times again, seems I’ve tried nearly all methods I can come up with, do you have any further suggestions? Could MotionAC, MotionGC and MotionMC library make difference?

    Looking forward to your reply.

    Best regard