GPS receivers calculate the course over ground heading from individual position measurements. The receiver has no way of knowing which direction the craft is pointed.
I suppose that if you had a very large craft, and one GPS receiver at the front and another at the back, you could make some guesses. But most people use a magnetic compass for heading.
I have tried putting two GPS receivers approximately 7 meters horizontally away from each other on a moving ship. The values of COG that I received from both of the GPS receivers were very close to the COG on the ship (which was using DGPS).
I've also seen another topic where someone could calculate the True Heading with two GPS receivers, but it has no code attached to it: Heading with two GPS and Arduino Due
So I'm thinking there should be a way, without having to buy a magnetic compass...
You can estimate heading (the direction the craft is pointed) from positional fixes at any two different points on the craft. Takes a bit of algebra.
The individual fixes will be subject to typical uncertainty of +/- 3 m, so two GPS units 7 m apart will rarely produce accurate heading values.
However, a good compass module, if properly calibrated, can produce heading values accurate to 1-2 degrees, and costs less than $10. A magnetic needle compass will perform even better, so it is not worth the trouble to use two GPS units.
Thanks for the relevant tip about buying a compass module or magnetic compass. What kind of algebra is there to estimate the heading? Even though the accuracy will be inaccurate, this will help me out a lot. That's actually why I made this topic
For example, I could use a filtering technique (maybe a Kalman filter) to make measurements more accurate and then estimate the heading.
No. The GPS can only measure position and change in position. It cannot measure the direction you are facing. Having two GPS's will let you calculate course from one to the other.
for example.
Both are nearly the same in latitude (distance from equator) and only a little different in longitude (distance 0 degrees at Greenwich, England I believe).
Using simple geometry, you can find two legs of a right triangle, calculate the hypotenuse, and then calculate an angle from there. Just the two legs are sufficient tho.
SOH CAH TOA
Angle Tangent = O/A
Or maybe it's inverse tangent, been too long since 10th grade geometry.
Yes, but treat the house coordinate as the two ends of the boat.
If the math can be figured out for that, the same can be done for the boat.
I suspect the numbers will be much closer to each other,
and if GPS readings are within 3 meters, and the coordinates are only 7 meters apart, the results may not be that satisfactory.
Depending on the size of the boat, is it possible for the reported positions +/- 3m to result in a calculation like this? Or not too likely if the GPSs are both seeing the same satellites?