I was going through the fusion code and notice this in the magnetic.h file, line32-33
// magnetic calibration constants
#define MAGBUFFSIZEX 14 // x dimension in magnetometer buffer (12x24 equals 288 elements)
#define MAGBUFFSIZEY (2 * MAGBUFFSIZEX) // y dimension in magnetometer buffer (12x24 equals 288 elements)
The MAGBUFFSIZEX is set to 14 instead of 12 as described in the annotation. This affects the tanarray calculation in magnetic.c, line 61-68,
// initialize the array of (MAGBUFFSIZEX - 1) elements of 100 * tangents used for buffer indexing
// entries cover the range 100 * tan(-PI/2 + PI/MAGBUFFSIZEX), 100 * tan(-PI/2 + 2*PI/MAGBUFFSIZEX) to
// 100 * tan(-PI/2 + (MAGBUFFSIZEX - 1) * PI/MAGBUFFSIZEX).
// for MAGBUFFSIZEX=12, the entries range in value from -373 to +373
for (j = 0; j < (MAGBUFFSIZEX - 1); j++)
{
pthisMagBuffer->tanarray[j] = (int16) (100.0F * tanf(PI * (-0.5F + (float) (j + 1) / MAGBUFFSIZEX)));
}
the tanarray will go from -438 to 438 instead of -373 to 373.
已解决! 转到解答。