|
Caleb - yes, the yaw sensor output is linear.
127 is zero degrees per second turn rate
128 is 0.586 degrees per second turn rate
191 is 37.5 degrees per second turn rate
254 is 75 degrees per second turn rate
and the reason its SO EASY to use the signal for a compass heading, is the SW samples the signal at a fixed rate (about 26mS)
so when you add every sample (subtracting 127 first) then you are integrating the signal, turning degrees/second into degrees!
the only difference is its not normalized into units of degrees - it comes out something like 65 counts = 1 degree.
Its a big number, thats why you need a VAR WORD to hold it - and dont forget that PBASIC always does math with 16bit registers anyway so you dont have to do anything special to look for things like
if angle >20000
|