cancel
Showing results for 
Search instead for 
Did you mean: 

MotionFX library: The Yaw angle computed in my application seems wrong. Which could be the reason?

VNava.1
Associate III

Hello, community,

I would like to use the 6-axis fusion algorithm available in the MotionFX library. I implemented it following a sample application and library MotionFX User manual. The flow chart should be the same as the manual. I don't understand why the output of the fusion algorithm provides coherent information only about the roll and pitch angle, the yaw angle is not consistent with the physical reality. What could be the cause?

In the manual, it is said that:

- the roll angle range is from -90 to +90

- the range of the pitch angle + -180 +180

- the range of the yaw angle is 0-360.

If I visualize or plot the first two angles, what I see is consistent with physical reality.

Instead, the yaw angle does not respond as I expect. In particular, I see, that when I rotate my IMU about 40° around the z-axis, the algorithm say me that a 360 ° rotation occurs, then if I rotate physically the IMU about 360°, the algorithm says that at least 8-9 complete rotations occur. It seems a very strange phenomenon (if we consider that roll and pitch are goods) and I don't know what to turn to, you could suggest me a way to follow. Waiting for the answer I am reviewing the datasheets of the two ICs that make up my IMU: LIS3MDL (to get the information from the magnetometer)

ISM330DHCX (to obtain data from accelerator and gyroscope and have them processed by the 6-axis fusion algorithm)

A bad picture (sorry) to explain my problem:

0693W00000KbB3aQAF.png 

Thank you in advance!

3 REPLIES 3
Petr S
ST Employee

Hello @Community member​,

This doesn't happen to me. Could you please send me your datalog that would include timestamp, acc & gyr & mag data and your calculated results? Attached is the example of the datalog format that would help a lot. Anyway the magnetometer data are just for comparison since they are not used if you use 6x fusion.

Thanks,

Petr

Thank you, Petr! That was my fault. I check my code and I saw that I gave, as input of the Fusion Algorithm functions, a wrong MotionFX delta time value. I want to obtain a new update each 10ms, thus with a frequency of 100Hz, as delta time I gave 0.1 s instead of 0.01s.

Moreover, to improve the quality of the measurements, I tried to compute the delta time based on the real timer period that I'm using to invokes the Fusion Algorithm, so instead to give a fixed value of 0.01s I'm giving the computed value of the cycle duration (Anyway is 0.01s +/- 0.001s).

Thank again,

Vincenzo

Petr S
ST Employee

Good news, thanks Vincenzo.