2021-02-16 02:37 PM
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?
Solved! Go to Solution.
2021-03-19 04:27 AM
Hi @SLi.9bert ,
I understand your problem.
Unfortunately, these library are not open source... you can however try asking to our Sales and Representatives from the st.com Contact link. They will evaluate your request accordingly.
-Eleon
2021-02-17 08:26 AM
Hi @SLi.9bert ,
before running the MotionFX library, I suggest you to run a calibration step with the MotionAC accelerometer calibration library, in order to minimize the residual offset of the sensor, that could sum during the integration steps.
I'm wondering if the error is summing in one direction (the direction of the possible offset) and subtracting in the opposite one...
-Eleon
2021-02-18 11:06 AM
Thank you Eleon, for your reply and suggestion.
Can you please answer follow-up questions to ensure my clear understanding of accelerometer fusion?
2021-02-21 03:30 PM
Hi @Eleon BORLINI
MotionAC "dynamic" calibration is now added to our STM32F4 firmware, as you suggested. MotionAC reports the quality is "MAC_CALQSTATUSGOOD".
Our goal: achieve highest possible orientation accuracy using 6-axis MotionFX fusion.
However, after adding MotionAC calibration, we still see several degrees error after 90-degree rotations, especially in left-hand direction.
Question 1: Can you please suggest what other factor could be causing ~2.5 degrees of error on each left-hand 90 degree rotation?
We also see some error (~1 degree) with Right-hand rotation - and the error amount may vary based upon temperature. I believe MotionFX LMode=1 zero rate offset correction should help this - but maybe it is not? Additional note: We are now researching decreasing GBIAS_GYRO_TH_SC_6X - since that seems to improve the right-hand rotation accuracy - and maybe decrease the StDev, too...
Question 2: Can you please suggest what could be causing the Right-hand rotation error? Is some sort of additional temperature compensation required?
Below are results of controlled testing from several test runs:
6-axis heading statistics (7 trials in each run; estimated "truth" accuracy .25 degrees on each rotation):
Run 1 (Saturday, 9:30 am) - avg IMU temp: 30.1 - 7 trials
Rotate Right 90 degrees: avg 88.63 degrees (StDev .22; error% -1.53)
Then Rotate Left 90 degrees: avg 1.89 degrees (StDev .34; error% -2.10)
Run 2 - (Saturday, 2:00 pm) avg IMU temp: 29.3 - 7 trials
Rotate Right 90 degrees: avg 90.26 degrees (StDev .12; error% 0.29)
Then Rotate Left 90 degrees: avg 2.73 degrees (StDev .34; error% -3.03)
Run 3 - (Sunday, 9:30 am) avg temp: 29.45 - 7 trials
Rotate Right 90 degrees: avg 89.52 degrees (StDev -.48; error% -0.54)
Then Rotate Left 90 degrees: avg -2.29 degrees (StDev .57; error% -2.55)
Summary:
*** CONFIGURATION ***
IMU: ISM330DHCX
Gyro ODR: 416
Accel ODR: 416
Gyro FSR: 2000 dps
Accel FSR: 2 G
MotionFX Settings:
Thresholds:
#define GBIAS_ACC_TH_SC_6X (2.0f*0.000765f)
#define GBIAS_GYRO_TH_SC_6X (2.0f*0.002f)
#define GBIAS_MAG_TH_SC_6X (2.0f*0.001500f)
ATime = 0.5;
LMode = 1;
output_type = MFX_ENGINE_OUTPUT_ENU
modx = 1;
start_automatic_gbias_calculation = 1;
MotionFX propagate/update deltat_s = 0.0024
Delta T is calculated by using 25-us resolution timestamp acquired via FIFO from ISM330DHCX with each gyro/accel sample. We have verified that the delta_t never changes during acquisition of data from the IMU.
2021-03-02 07:35 AM
2021-03-02 07:13 PM
Hi @Eleon BORLINI , Yes, if you want to follow up on the MotionAC question in the other post, please do so.
For the MotionFX error when rotating left, please answer these questions in this post.
Thanks,
2021-03-05 05:43 AM
Hi Scott,
I believe it's not an issue related to the algorithm, since it should be symmetric with respect to the left and to the right.
It could be related to the specific device, especially if the offset is not exactly zero: it is calibrated in production but there could be a residual coming from the soldering process. You can place the device in you default "zero" position, read the dataout and write the (averaged) residual in the X_OFS_USR (73h), Y_OFS_USR (74h) and Z_OFS_USR (75h) registers (datasheet, p.84).
If this doesn't work, do you have the possibility to test another ISM330DHCX to check if it is a "device-related" issue?
-Eleon
2021-03-08 11:45 AM
Hi @Eleon BORLINI ,
The attached graphic summarizes the types and differing amounts of error in each board. All error values are averages of 7 separate runs. Each graph has one point for each of these 5 steps in the test:
1) Reset board, Rotate 90 degrees (Right), acquire MotionFX yaw angle measurement
2) then, Change Direction ("cd"), rotate -90 degrees (Left), acquire MotionFX yaw angle measurement
3) Reset board, Rotate -90 degrees (Left), acquire MotionFX yaw angle measurement
4) then, Change Direction ("cd"), rotate 90 degrees (Right), acquire MotionFX yaw angle measurement
5) Reset board, Rotate 90 degrees (Right), acquire MotionFX yaw angle measurement. This verifies repeatability of step 1).
Ideally, all lines in these graphs should be flat (0 degrees error no matter which rotation is made or if directions are reversed).
Detailed test data and summary are in this Excel Spreadsheet, this includes for each board details about data/fusion rates, output data rate, full-scale range, etc.
Please let me know what are some additional factors that can be causing this.
(a) Is it possible that the zero-rate offset calibration performed by MotionFX is not working correctly?
(b) Why should we see different error amounts for rotations occurring initially after reset, vs, rotations occurring after changing direction?
Thank you for any expertise you can provide to help us solve these issues.
P.S. Test Conditions are documented in the Excel spreadsheet.
2021-03-09 12:02 AM
Hi Scott,
not many further suggestions, indeed...
Can you try with changing the ODR (lowering it from the 416Hz current value?) it might be that a too fast ODR is worsening integration errors in time.
In ST algorithm lower ODRs are sometimes used...
-Eleon
2021-03-13 05:56 PM
Hi @Eleon BORLINI ,
1) The ODR has been modified to 104Hz, as you suggested; this appears to slightly improve the ISM330DHCX yaw angle accuracy - sometimes.
2) Also, we found that the LSM6DSM data previously reported was not correct, because while the ISM330DHCX subtracts the contents of the X_OFS_USR, Y_OFS_USR, Z_OFS_USR registers, the LSM6DSM Adds them. Now that this is corrected, we are receiving improved values on LSM6DSM, similar to that of ISM330DHCX.
However, we still see many times when the yaw angle is off by up to 4 degrees after a single 90-degree rotation - and especially after changing directions (90 degrees one direction and than 90 degrees the opposite direction).
We have been reviewing the gyro biases, this seems like it could be a problem area. Our accel/gyro orientation is 'e' 'n' 'u', and the MotionFX Output orientation is MFX_ENGINE_OUTPUT_ENU. We have a real-time display that outputs the raw gyro x/y/z values from the sensor, as well as the MotionFX gyro bias retrieved via MotionFX_getGbias(). Here is an example:
Raw Gyro X,Y,Z values (DPS): .21, -.49, -.28 (X+, Y-, Z-)
MotionFX GBias values (DPS): .46, -.20, -.31 (Y inverted, X inverted, Z)
This seems odd, doesn't it?
The MotionFX GBIas value orientations don't match the Raw Gyro value orientations; I believe the MotionFX GBias values appear to be SWU orientation - not ENU orientation like the raw gyro values.
Question 1): Is it expected that MotionFX GBias values are in a different orientation than Raw Gyro values from ISM330DHCX? If so, why?
Question 2): Since we are suspicious that MotionFX GBias values are incorrect and introducing yaw angle error, we are considering using the MotionGC library to calculate gyro biases - and using MotionFX LMode=0. If we do use MotionGC instead and set LMode=0, how should we apply the gyro biases - by regularly invoking MotionFX_setGBias()? Or instead by removing the biases before passing the gyro values to MotionFX_propagate()/update()?
Thanks again for your help,