cancel
Showing results for 
Search instead for 
Did you mean: 

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

RZHU.1
Associate III

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?

1 ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

8 REPLIES 8
Eleon BORLINI
ST Employee

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

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?

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.1
Associate III

:loudly_crying_face:

Thanks for your suggestion, I have changed my code and now it will only calibrate the magnetometer during the initialization stage, and the result of calibration is MMC_CALQSTATUSGOOD.

After that I perform an experiment that let the robot moving along a circle trajectory in uniform velocity, the output heading angle didn’t change during the motion. Then I read DT0075 and noticed that in the introduction of Mtime it says, “In the static condition, the magnetometer is not trusted.�? So maybe the algorithm mistakes the status of robot, the robot is moving while the algorithm thinks it’s static.

I wonder which parameter determines the status of robot is static or not, is it gbias? If so, I’ve performed automatic gbias calculation at the initialization stage, however it still not help. Should I adjust it by myself, or should I change other parameter?

Looking forward to your early reply.

Eleon BORLINI
ST Employee

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

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

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.