Reputation: 47
I have two positions in terms of latitude and longitude (in degrees) , I need to calculate the Heading from these two points. I am comparing my heading with a High precision GPS Receiver which gives me heading values .
The algorithm I got from Internet after implementation gives me a variation of 4 degrees. The algorithm can be found at
http://www.movable-type.co.uk/scripts/latlong.html
I am getting a difference of 4 degrees only when the vehicle goes in a straight path..
As you can see in picture , the Blue is from High precision GPS Recevier (cm level RTK), and Orange is Haversine heading caluculations. While vehicle turns , heading is completely deviated ,,, But at least when vehicle is along the straight path , I am getting on off by 4 degrees approx..
Please let me know if you have any questions. Any help or direction would be appreciated.
Upvotes: 0
Views: 1103
Reputation: 28737
It's a secret how exactly the heading is calculated by the GPS receiver. Its not simple the direction from current to previous fix.
You can observe this when driving through a tunnel, the first vald fix after the tunnel, has already the correct heading. The GPS receiver has internaly more information, so its is not the same when you try to calculate the heading just by current and last position of fix.
However the mathematical calculation fo the heading between two fixes, can easily be found. You probabyl have this correctly implemented, but you cannot compare that to the heading value of the receiver.
The heading (a.k.a Course over Ground) value from the receiver is more suitable than the self calculated.
Upvotes: 1