Using STM32F446, ISM330DHCX and MotionFX, computed yaw angle is correct after a controlled 90-degree right rotation, but the yaw angle is off by ~3 degrees after each 90-degree left rotation. What could be causing this issue?
The MotionFX Library is initialized as follows:
MotionFX_getKnobs(&iKnobs);
/* Modify knobs settings */
// Configure knobs with non-default values
iKnobs.output_type = MFX_ENGINE_OUTPUT_ENU;
iKnobs.modx = 1; // No decimation
iKnobs.ATime = 10; // kalman_settings.static_accel_time_coeff;
iKnobs.FrTime = 10; // kalman_settings.dynamic_accel_time_coeff;
iKnobs.LMode = 1; // Enable gyro bias calculation during static motion
iKnobs.gbias_gyro_th_sc_6X = 0.0036; // Per datasheet, this is empirically determined
MotionFX_setKnobs(&iKnobs);
When new data arrives, it's processed like this:
MotionFX_propagate(&data_out, &imu, &delta_s);
MotionFX_update(&data_out, &imu, &delta_s, NULL);
Interstingly, if instead I first make the left-hand rotation, it has no significant error, but after making the right-hand rotation, a similar ~3 degree error is detected.
Each time motion occurs in the direction in which the error is present, the error increases, so the error is compounding over time.
It seems that whichever direction the first turn is in, error is not seen when turning in the direction, but turning in the opposite direction has continually-compounding error.
What could account for, immediately after intialization completes, a second rotation in the opposite direction having several degrees of error, but the first rotation in the opposite direction does not exhibit error?
