MotionFX correct sequence
Hi everybody and thanks in advance for the support.
I have a ST SensorTile and I'm starting with the DataLog project to output data through USB port. I have correctly integrated MotionFX libraries and they seem to run, except there are just a bit of problems.
- What are the right units for time in MotionFX_propagate and MotionFX_update (param eml_deltatime). It seems it has to be expressed in seconds but in some samples you use a 20 constant defined. For instance: 20ms are 0.02f?
- What is the param eml_q_update in MotionFX_update? Should I put a float of something or it should remain NULL as stated in example/doc?
- What is the correct sequence for magnetometer calibration?
- MotionFX_MagCal_init at start (using sampleTime expressed in milliseconds?)
- MotionFX_MagCal_run in the loop, before the MotionFX_propagate/_update and until the MFX_MAGCALGOOD is reached?
- Can the MotionFX_MagCal_run be called every loop independently of the quality reached? What is the drawback?
- Is possible to know when to call again MagCal run, for possibly changed Mag biases?
- When is the right time to call MotionFX_MagCal_init to stop calibration? Is there a "right" spot to start again Mag Calibration?
- How the biases obtained from MotionFX_MagCal_getParams should be used? In what units are they? Should they be added or subtracted from current magnetometer output? Some examples show an additive bias, some other a subtractive bias.
- Why the MagCal needs a timestamp? Is good to give the HAL_GetTick in every loop it has to be called? (I'm using FreeRTOS in a 20ms timer triggered task).
- MotionFX_LoadMagCalFromNVM and MotionFX_SaveMagCalInNVM seems to be never called. They are needed at linking time but they seems to be ignored. I've put a simple "save to flash" function (that works correctly outside) but no data is stored in the flash memory. How should I trigger the load/save? If I save parameters, how should I behave using the MagCal routines? What is the advantage?
- What parameters should/could be manually saved in addition to improve startup time and avoid figure eight recalibration in a fixed setup? Moreover, how can I periodically refresh data? What is the right spot to trigger MagCal/GyroCal? How can the gyro bias calibration be retriggered?
- How do I know when the right gyro bias is reached? Is useful to start in LMode = 1 (static learning) and then switch to dynamic?
- Are there any "good to start" ATime, MTime, FRTime for the Sensortile?
Thanks in advance for having the time to read and willing to support me. I hope this answers could be included in the UM2220 User Manual as it seems an imprecise draft.
