Problem with porting NXP Sensor Fusion Library

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem with porting NXP Sensor Fusion Library

890 Views
davide_giova
Contributor I

Hello,

I'm porting the NXP Sensor Fusion Library to a third party MCU, I have some problems and I don't know how to debug them.

To give you an overview, the actual need is to apply dead reckoning (double integrate the linear acceleraton in order to get the displacement from the resting position). The integration period should be pretty short, in the order of few seconds, and the accuracy is not that critical. To make the long story short, imagine that I have to measure the swing aplitude (in cm) of a pendulum with the IMU (the pendulum's pivot is stady).

To me this looks to be feasible even though the dead reckoning with these mems sensors is known to have drift problems, do you agree?

 

So far I build a system that acquire acceleromenter and gyroscope data and to ease the development I wraped the NXP Sensor Fusion Library into Octave/Matlab. Once the library will work there, the same code will be used on the MCU.

Now I'm doing basic testing to understand if the fusion works as expected but I'm encountering problems (see images), maybe some one with more experience in the field looking at the results can suggest me where to look to fix it.

In the following test the IMU is rotated around the Y axis (90° in one direction, 180° in the other, and back to the starting position). These are some of the images I can extract:

 

Raw Data (Acc sensitivity=0.488mg/LSB, gyro sensitivity=17.5mdps/LSB)

Raw accelerometerRaw accelerometerRaw gyroscopeRaw gyroscope

The raw accelerometer data is easily validated, the gravity is visible on the Z with 2070 counts. 2070*0.488=1010mg.

To validate the gyroscope data I integrated it (outside the fusion library) obtaining this:

Integrated raw gyroscopeIntegrated raw gyroscope

Apart from the drift due to the gyro offset (which was expected given that no correction is applied on the raw data), the 90° clockwise - 180° anticlockwise - 90° clockwise rotation pattern on Y axis is clearly visible, therefore the sensor iteself looks ok.

 

However, when the raw data is fed into SV_6DOF_GY_KALMAN algorithm, the resulting linear acceleration and orientation angles are:

Linear accelerationLinear accelerationOrientation (roll/pitch/yaw)Orientation (roll/pitch/yaw)

Here I see something different than what I expected. First of all the Y axis of the acceleration, after the stimulus, takes a while to return to 0. The orientation instad have strong and unexpected discontinuities that I cannot explain.

 

So, is there someone that can suggest what I might be doing wrong or where to start the debug?

I recognize that since I'm not using an NXP platform the answer might be "we do not support on this", however I give it a try.

Thank you very much,

Davide.

 

Labels (3)
Tags (1)
0 Kudos
0 Replies