Calculating distance using GPS

Sep 09, 2008 8 Replies

Using standard RMC NMEA strings from a GPS unit, I'm trying to figure out the best way to calculate distance traveled over time. The two methods I have are:


- Use lat/long. coordinates and calculate distance using Haversine method (or similar) each sample, and keep a running total of distance traveled



- Use velocity each sample, and multiply by sample interval to get distance traveled during that interval



I have done some basic tests, and these two methods work out to be "almost" the same, but not quite... I don't know enough about the underlying GPS design to determine how lat/long vs. how speed are determined. Any comments on which method may be more accurate? (or are they both equally inaccurate).



What is interesting however, is when going under a bridge structure, the velocity readings become distorted (there is a jump and then a dip). The lat/long readings don't seem to suffer from this same issue however. Does anyone know why this is??


First, you lose info from the leading satellite, then, you lose info from the trailing satellite?

Cheers! Rich

The reported GPS velocity is likely to be the instantaneous velocity estimate at the "data valid" time rather than the effective mean velocity over the sample interval.

Rich Webb Norfolk, VA

What am I missing. Take the starting point, and the ending point and compute distance? Or do you want road distance?

Right, I have read this before as well. I'm assuming that the instantaneous velocity will hold true until the next sample. Obviously not 100% accurate, but it's all I can do given the limitations of the system.

Ya, basically road distance. If I go around a circle of 1km circumference, I want to read 1km, not 0.

Not quite true. The discrete estimates hold true only for that instant. You have no information about what happens between estimates, although the physical constraints of the system may allow you to make some inferences.

Not quite true, either. In addition to a simple linear approximation based on two preceding samples, you can do an n-th order approximation based on n+1 predecessors. Or, you can use an alpha-beta filter or go full bang and do a Kalman.

Rich Webb Norfolk, VA

Un bel giorno jdhar digitò:

Velocity is more accurate, because it is calculated measuring the doppler shift which is less affected by the ionospheric error. Here's an informative document:

formatting link

I've noticed this too. Probably it's because the doppler calculation is "differential" (which is also the reason of its better accuracy): when the module loses the satellite signal, at the next good fix the difference in doppler phase will be bigger. For your purpose this is actually good, because the integral of the speed should remain almost correct (for small outages).

emboliaschizoide.splinder.com

Changes in the local magnetic potion of the magnetic field we are naturally exposed to. By addding Iron structure the local magnetic field is disturbed by the ferrite material. This leaks into the velocity meters sensing.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required