Skip navigation

Node Ar-Drone Corrected Magnometer Heading

compass

We were a bit puzzled about magneto readings returning from our AR-DRONE’s raw nav data. Our custom navpoint system requires the true nav heading, but we noticed that the raw data had values that jumped into negative range.

After a bit of googling we found that sometimes this is the case to make the calculations easier. The data returned is sometimes -180 to 180 instead of 0-360, as seems the case with the AR-DRONE. On quick normalization routine and we were all set. Snippet of code is listed below.

//.....
  curHeading=data.magneto.heading.fusionUnwrapped;
//8/31/2014 corrected current heading
  	if(curHeading<0)
  		correctedHeading=Math.round(360-Math.abs(curHeading)); 
  	else
  		correctedHeading=Math.round(curHeading);
//.........