AnsweredAssumed Answered

Magnetometer calibration and gyroscope offset estimation issues

Question asked by Wouter Vos on Jul 31, 2017
Latest reply on Oct 31, 2017 by Wouter Vos

Dear reader,

I have created a custom designed board with magnetometer, accelerometer and gyroscope and an Cortex M4 MCU, but without UART. On the MCU I am running the NXP Fusion Engine 7.10 using the 9DOF Kalman filter and a NED reference system. The code is running. The gyroscope offset seems to be calculated. Magnetometer values are stored in the magnetic calibration buffer (when moved around) and the magnetic calibration runs when requested. However:

A) For the Y-axis of the board the gyroscope offset seems to be underestimated and cause a drift. The estimation for the other axes seems just fine;

B) The performance of the system after magnetometer calibration is worse than before. The estimation of the offset and scaling does not seem to be correct. I have attached two measurements doing a rotation (NWSEW) in the XZ plane, when the Y-axis of the board is pointing up. Before the calibration the bias is minor the rotation is circular. However, after calibration the bias is way off and the measurements show an ellipse.

Could you please point me in the direction of the cause?

 

I checked the following:

1) Sensor signal conditioning concerning the units: accelerometer values in G; gyroscope values in dps; and magnetometer values in uT;

2) Sensor signal conditioning concerning conversion of chip reference system to board reference system (NED): when a board axis is pointing down, then the accelerometer value is positive; when a board axis is pointing north or down, then the magnetometer value is positive; when a right handed rule positive rotation is made around a board axis, then the gyroscope value is positive;

3) sensor values are stored in a FIFO buffer of size 1 in the .i<sensorType>sFIFO[][3] variable. The average over the buffer seems to be calculated correctly and the result gets stored in the .i<sensorType>s, and .f<sensorType>s variables. The calibrated version are stored in the  .i<sensorType>c, and .f<sensorType>c variables (except for the gyroscope sensor of course); 

4) The counter of the magnetometer calibration data buffer (iMagBufferCount) equals 360 measurements and data seems to be present before starting the calibration (setting MagCal.iInitiateMagCal=true). It seems to perform 7-point calibration.

4) calibration is performed by making figure 8 movements in an environment with low magnetic interference.

5) I have defined SIMULATION, so no calibration data is stored in or retrieved from flash and at start up the magnetometer buffer and the calibration algorithm seem to be correctly initialised. The loopcounter is set to zero. <-- it seems to me that there may be a potential problem if (int16_t) loopcounter runs over at the end of positive values; newer magnetometer measurement will have lower loopcounter values as indices. Possibly lower than the initial value of -1.

 

Regards,

Wouter

Outcomes