2018-02-23 07:00 AM
Hi,
I'm trying to use the MotionFX library with the LSM9DS1. I can initialise the library and I start to send updates using the MotionFX_MagCal_run method then I get the params with MotionFX_MagCal_getParams but the cal_quality is always 0, I tried multiple times. Also, I double checked that I set the sample time and timestamp correctly.
Not sure what I'm missing, is there any way to debug the behaviour of the library?
Regards,
Gabriel
2018-02-23 07:16 AM
Please check this thread firts
If you are able to plot X, Y, Z during sensor rotation it would be helpful.2018-02-26 06:57 AM
Thanks again for the quick response!
Here's the magnetometer data that I send using the MotionMC_Update function:
https://gist.github.com/gpgabriel/c0f55be9f32c0d548629d0525e79450e
The data above is calculated as follows:
calcMag(mx) * 1000 * FROM_MGAUSS_TO_UT50
where calcMag returns Gs.
I'm still blocked in the MFX_MAGCALUNKNOWN state. I'll try to add a video with an actual plot asap.
2018-02-26 07:28 AM
Here's a scatterplot with the data:
https://www.youtube.com/watch?v=sUYUVuT1m_0
blue: xy; pink: xz; yellow: yz
PS. It's not exactly the same data as the one from the gist but it was produced in the same conditions. The values from the video are multiplied with 1000.
2018-02-26 09:11 AM
Your data seems OK to me.
Can you check that you use ms in the time stamp?
Maybe you can share you project or part of it, so I can check it.
2018-02-26 10:53 AM
Hi,
The calibration runs in a FreeRTOS task. I created my own time stamp which initially is 0 and then is being increased with 8 at every iteration. Each iteration reads the sensor, runs MotionMC_Update, runs MotionMC_GetCalParams and adds a vTaskDelay of a few ticks. In total each iteration takes 8ms and runs in a while(true) loop. I call MotionMC_Initialize(8, 1); before the task starts.
I'll be back with the code. Thanks
2018-02-26 01:10 PM
The timing could be the problem.
Firts the maximum ODR of the magnetometer in LSM9DS1 is 80Hz, so it doesn't make sense to read and call the update function in higher rate.
Second, I think the maximum update rate for magnetometer calibration library is 100Hz, so 8ms wont be valid parameter.
Can you please try to reduce the speed and align all the parameters (timestamp, sample rate in init function and your OS task frequency)?
2018-02-27 04:07 AM
My bad, I wrote it wrong. I was running at 80Hz, not sure why I said 8ms there.
I reduced the speed to 20Hz.
Here's part of the code which handles the calibration.
https://gist.github.com/gpgabriel/1f6ea9f7364dfb925fa48b98d8401a25
Thanks for all the replies.
EDIT: Quick question, the MotionFX library says that I should send the gyroscope values as dps but I noticed that I get better results if I send them as radians. What should I send?
2018-02-27 08:25 AM
The MotionFX needs angular rate in dps.
2018-11-23 04:08 AM
Hi to all
I exactly have the same problem.
I use MPU9250 and I update the library in the main function, (I do not use any RTOS), and also my code is blocked in MMC_CALQSTATUSUNKNOWN state. I do not use MotionFX, I only use MotionMC, my compass data is correct. what happens is that the library always report MMC_CALQSTATUSUNKNOWN and after moving my compass in a 3D 8 shape path, the library hangs and I have to reset my micro controller.
I also appreciate it if we could solve this problem.