I have a SparkFun 9DoF Razor M0 IMU (accelerometer, gyroscope, magnetometer) and I use their SparkFun MPU-9250 Digital Motion Processor (DMP) Arduino Library (with some minor adjustment, see here) for a basic calculation of pitch/roll/yaw.
Recording these values over the course of a day, while having the sensor sit flat and immobile on a table, looks like this:
As you can see YAW is drifting, in an interesting curve.
- Is this curve a standard behavior? Does it look familiar?
- Or does it look like it could be some rounding error somewhere inside the library?
- Is it even possible to get YAW data without some calibration ritual?
I read up a bit, and saw people suggest that maybe the code doesn't initialize the magnetometer and therefore sets YAW differently after every power-up. I tested by powering-cycling the sensor, but the YAW value didn't change. So the magnetometer seems to do it's job there.