Reply To: Yaw measurement with gyro and magnetometer

Home Forums Forums General discussion Yaw measurement with gyro and magnetometer Reply To: Yaw measurement with gyro and magnetometer

#18279
richardp
Participant

What you could do is just apply hard iron offset , this should be good enough.

You would only need to use the code below;

//Apply hard iron calibration
magRaw[0] -= (magXmin + magXmax) /2 ;
magRaw[1] -= (magYmin + magYmax) /2 ;
magRaw[2] -= (magZmin + magZmax) /2 ;
//Compute heading
float heading = 180 * atan2(magRaw[1],magRaw[0])/M_PI;

Richard --OzzMaker.com --

Blip, blop, bloop…