I'm making a prototype for android that pulls compass data from the phone. I want to stabilize it so it is less jerky, by taking the average of the last couple of readings.
I have done this for accelerometer readings with great success, but adding every measurement to a queue and then collapsing it and dividing it by the queue size (= calculating the average) but for angles this is different.
If my measurements are for example:
350, 359, 360
I could calculate the average as 356.3
But if my measurements are
350 359, 1
Then my average is 236 which is a radically different angle.
Is there any way you guys can think of I could deal with this?