femtoduino / ArduinoCore-atsamd21e18a

Arduino Core and Bootloader for the ATMEL SAM D21/R21 (E Variant) chips.
https://femto.io
29 stars 15 forks source link

IMU reading drift and calibration #12

Closed allenyin closed 6 years ago

allenyin commented 7 years ago

Hi Alex,

I've gone through all the steps calibrating the sensors with the FreeIMU-gui utility, saving it into the directory, etc.

I have also tried all sensor fusion algorithms (MARG option 0 to 4) and tweaked the settings in FreeIMU.h, under MPU9250_6511's parameters (see my thread with FreeIMU-Updates).

I am wondering if you also see measurement drifts after calibration? If so, any tips on combating that?

Thanks, Allen

zrecore commented 7 years ago

What version of the "Atmel SAM D21/R21 E" board package are you using?

allenyin commented 7 years ago

1.6.11

Are there anything in the core package that might affect the sensor fusion?

zrecore commented 7 years ago

Yes. See https://femtoduino.com/examples/setup

The latest MESH IMU Coin example uses getYawPitchRoll180() instead of getYawPitchRoll(), and resets stuff on startup. I have #define MARG 4 in FreeIMU.h, my local magnetic declination (MAG_DEC) and board defined as #define MPU9250_5611

allenyin commented 7 years ago

Right I followed the documentation there for the setup.

I have changed the declination to my location.

I am reading getEulers() since those are the actual orientation I want. According to the freeimu.cpp comments, the getyawpitchroll() method gives yaw as angle between earth north and IMU x-axis, rather than deviation from x-axis, if I'm understanding it correctly.

I will check again to see if using getyawpitchroll have any drift..

zrecore commented 7 years ago

...getYawPitchRoll180() is the one to try