Hi! I am using I2Cdevlib to interface with both an MPU6050 and HMC5883L (autopilot sometime in the future). The library is really great, but there is a problem. Whenever I want to calculate my heading from the magnetometer I don't know how unless the sensor is close to flat. Is there a way I can calculate the heading when the sensor is not flat on the ground? Since I want to make an autopilot for an airplane I can count on it being level all the time. Tilting the magnetometer with the regular algorithm running gives huuuge errors.
Any help is greatly appriciated!