2025-02-27 12:11 AM
Hi,
I am using the ism330dhcx and lis2mdl and run the MotionFX algo.
the ism330dhcx data rate is 104Hz and the lis2mdl is set to 100Hz (sensor hub ODR set to 104Hz)
should i run MotionFX algo at 100Hz or 104Hz ?
on ST examples, when the ODR is set to 104, the ALGO_FREQ is set to 100 !
is this difference can generate wrong values on fusion algo ?
i notice that if i run the magneto calibration at 104Hz, the calibration is never reach
if i use 100Hz for magneto calibration and 104Hz (or 100) for MotionFX algo it is work
Thank you,
Sincerely.
2025-03-06 6:44 AM
Hi @malarab ,
It is important to ensure that the data rates of the sensors and the algorithm are properly synchronized to achieve accurate results. As you can check in the UM of the library, 100 Hz is recommended.
In general, the output data rate for the gyroscope and the accelerometer should be equal to or greater than 100 Hz; while the magnetometer can be lower.
In your case 100Hz would work!
2025-03-06 7:39 AM
Hi Federica,
when i trace may application with SystemView i saw the interruptions from IMU (ism330dhcx) occurs every 9ms when i set :
//Prepare sensor hub to read data from external Slave0 continuously
ism330dhcx_sh_data_rate_set(&ag_ctx, ISM330DHCX_SH_ODR_104Hz);
.
.
.
.
//Turn on Sensors & Set Output Data Rate
ism330dhcx_xl_data_rate_set(&ag_ctx, ISM330DHCX_XL_ODR_104Hz);
ism330dhcx_gy_data_rate_set(&ag_ctx, ISM330DHCX_GY_ODR_104Hz);
i tried to set ALGO_FREQ to 100 and 104
but in both case i still have drift on fusion algo output : when my device make a 360° rotation, the rotation vector has a drift between 10 and 50°
also when i have two devices moving together (fixed on the same support and making the same rotation), the incrementation of rotation vector of each device is different : for example if both of them start at 0, when the first on reach 90° the other one show 100°
if this drift is not related to the algo frequency, what other parameter i can adjust to fix it ?
i tried many configuration and i still don't have the solution !
Thank you,
sincerely.
2025-03-06 10:56 AM
The actual ODR may be different with respect to the programmed nominal ODR.
Even if you select 104Hz, the actual frequency can go from 94 to 114Hz.
For maximum accuracy, one should measure the actual ODR by using an accurate timer on the microcontroller or at least at startup counting the number of samples generated in a given interval (how many times data ready flag is asserted in 10 seconds for example) and then using this value.
The ODR is important because the time interval between samples is utilized for gyroscope integration by MotionFX.
Also, for the mag it is important to verify if calibration has been completed successfully (cal quality output). If not, the yaw/heading output will not be absolute values, but relative values meaning that only the change is tracked using gyro integration.
Assuming your 360 degree rotation is around the vertical axis, and therefore related to yaw/heading output there is one more consideration to be done.
Finally, MotionFX is optimized for gaming controllers: when device is static, it is guaranteed that the output is constant and does not drift, even if there is a discrepancy between what the mag says and what the integrated gyro says. If this is the case, one can tune the knobs to give more trust the acc and mag, and less trust to gyro - the output will be less accurate during high dynamic motion, but the discrepancy will be smaller at the end of the motion.
In order to get accurate yaw/heading angles, one should use MotionEC (eCompass) instead.