Hello there i'm working on a project, that i use 10 DOF mpu6050 /HMC5883L/BMP180. i used this code mpu_6050/hmc5883l

i'm searching on the internet to find the formula about the tilt composation so i find this formula

Code: [Select] // tilt compensated magnetic sensor measurements float magxcomp = Magx*cos(Pitch)+Magz*sin(Pitch); float magycomp = Magx*sin(Roll)*sin(Pitch)+Magy*cos(Roll)-Magz*sin(Roll)*cos(Pitch);

problem is that the heading is not comosated. when i did a roll or a pitch the value of the heading change, so i want to fix this prblem, i want the value of heading stay correct event i did a pitch or a roll. thanks

is there something wrong with the formula ?? i'mo working on autonomous flight so i need the correct value of heading, please helpe