Improving GPS accuracy by using a pair

 

I can't take credit for this idea; a neighbor did a project for a local utility involving RF meter reading and he used 2 GPS units in the vehicle.

Anyway, I put a couple of GPS units on a breadboard and wired them to an Arduino Fio (odd choice, but I got it not realizing how low power it was and so the xBee interface is worthless to me as it won't power a 900 Pro and a GPS at the same time). I used NewSoftSerial for both units, freeing up the hardware serial for programming/diagnostics while developing and reporting the consolidated result to main controller when complete.

The first thing I ran into is a problem with NSS - switching back and forth between GPSes caused lost bytes and no good sentences. So for an initial test, I made it time based and processed one and then the other for 1500 msecs at a time and fed each into its own TinyGPS object. This works. I am planning to change the logic to swap sooner that 1500 msec if I receive and process a full set of NMEA strings before the timeout expires.

OK, so now I have 2 TinyGPS objects with data. There are 2 issues to resolve - how to consolidate their information and how to report it. I will go into those in reverse order, mostly because the second one is easy.

This is a custom component for use in my projects. I can define the protocol to be whatever I want that meets my needs. I need location, speed and course. I would also like "confidence" - an indication of whether the value is exactly what both are reporting, a consolidation of 2 very close readings, a consolidation of 2 fairly close readings or digital Ouija (aka BS). I will make it a short packet, possibly only in response to being queried for it. Besides giving the main controller better data, this will offload a lot of processing so the main controller will have more time to dedicate to that global domination thing...

So, how do I consolidate them? Here is what I think...

If both units report a speed and course within 5% (just a guess; will do a lot of testing), I will use those values and report confidence in them. I will return -1 when I cannot resolve them, probably indicating no motion or spinning.

If I am in motion, I will make myself crazy trying to resolve the position readings. Those have been really good readings in testing and not the problem I am trying to resolve. I will just accept the last position read.

If I am not in motion, it gets tricky. I have some doubt about whether using both readings buys me a whole lot here, other than knowing with some reliability when I am moving again. The easy answer is to compute the midpoint and return that, but I am not sure that is a good answer. Thoughts are definitely welcome.

I have considered …

using a triplet of gps receivers to nail down a location as the precision can be as great as 3m.

** I haven’t yet managed to do anything at all with a uC.

X marks the spot:

X marks  the spot:

2gps.jpg

I let the two run for a while and plotted everything they reported. The midpoint of the skinniest part is exactly (or within 2' for sure) where I am sitting. This makes me rethink how to do calculations. Average would not have worked. Notice how all the locations that are a fair amount off line up with trees or roofs - edges? Anyone know why?

EDIT - BTW, that nice straight line on the left (there are a few protrusions through it near the actual location) is likely the 0-180 (directly N <-> S) line or very nearly so.

Why not?

Why not use an accelerometer to detect when the object is on the move and the gps to get a new lock on location?

Mech  

For the most part, I know

For the most part, I know when it is on the move because I am responsible for the movement. From a very simplistic point of view, what I am trying to do is determine whether or not I am getting really good data and making the best use of what I get. My earlier map flies in the face of my statements about getting  under 2m, but the good readings are open sky and locked in. The “ugly X” was indoors and taken right after they had just started reporting positions. This freaky looking thing was done the same way:

2gps1.jpg

This one is interesting because it isn't intuitively obvious what the right answer is.

** I am looking for relative**

 

I am looking for relative accuracy - 2 units finding the same spot - not absolute accuracy, though Google maps generally indicates I am getting both in my tests. While in motion, I am almost always within 2m with just 1 GPS per unit and I have a couple of units that do pretty well at rest also, but most tend to hop around a little when stationary. The main reason for pairing is to know when the course and speed are valid and a secondary reason is it may help me sift through the stationary chatter better.

EDIT - for the sake of completeness, here is a snip from a map of 3 different GPS units moving on the same route and then stopping together:

3gps.jpg

What I would want to know is that the course information was good while I was moving and that it wasn't when I stopped. As good as the "blue GPS" is, while hopping in that tiny rectangle it did claim to have a course. The red and green aren't bad, but I want to collapse their readings while stopped together and end up right on top of the blue.

From a Kalman Filter point

From a Kalman Filter point of veiw, if both the gps units are the same, then you have to trust both of them equally. In other words, the only way to combine the data, is to simply take the average of the two readings (the midpoint of the line that connects the two points). Thats the best you can do.

As for the jumping around while your sitting still, I can’t think of anything off the top of my head. I was thinking about maybe an averaging filter, but that would only work if you could turn it on when you knew you were sitting still, and would probably be whacky if it was on while you were moving.

And a word of caution, those images on google maps, or google earth are by now means exact. They can be off quite a bit.

Confidence in speed/course is all I am getting

 

From my limited testing of the tandem unit, the main thing it does is let me know that speed and course are accurate in nearly real time. I ran a little test to see if both speed and course are reported as the same or very nearly the same value from both units. When they are sitting still and getting “chatter”, they almost never match (by random chance, they do every now and then) but as soon as I move a few feet, they report the same values consistently.  Using midpoints on non matching positions does make for a smaller pattern when sitting still, but in motion it introduces a slight inaccuracy as it computes a point based on 2 positions that were accurate and are both behind me. I can extrapolate this from having good course and speed and…

Here is the crazy thing. Just ignoring course unless I am under power and it is only a tweak to the compass reading works as reliably as figuring out it is good from reading 2 GPSes. The point of doing this is so if I keep getting blown or washed off course I will end up canted at an angle to my desired heading by using GPS, while I would just keep aiming my nose at the target using the compass. If you use only the compass to point the nose, you may end up going directly against the wind and/or current at some point.

As far as the filtering, I have not come up with anything fool proof. I tried eliminating big jumps and I thought that was the answer until I ran for a little while. Every now and then I would get bogus positions in an acceptable pattern to seem like drift. Then I would ignore better values. I think I am tilting at windmills anyway. I only get those giant spikes with some obstructions. Open sky “chatter” is usually only a few feet.

So I think this was an interesting exercise, but doesn’t buy me much.

I don’t know if this is due to my area being well mapped or what, but I have found Google maps to be incredibly accurate in my area. I have done open sky testing nearby in parking lots and it generally is dead on, showing the space I parked in, landmarks I walk to, etc. I have one where I was riding my bike down my street and a squirrel ran out in front of me and you can see my path deviate from almost in the curb to the middle of the street. I was really surprised to see it that accurate.