Monday 29 January 2018

python - How to filter wrong GPS readings?


I have absolutely no experience with GIS, it just so happens that one of the hobby projects I am doing at the local hackerspace includes tracking a model boat with a GPS... I hope this is the right place to ask! [If not, I would appreciate suggestions on where to turn for help].



Here's my problem: today we went testing the new model boat, but when I processed the log, I noticed that for some strange reason, some of the GPS readings are totally off (see picture below: we never actually sailed on the left of the trees).


Google Earth screenshot




  1. I was wandering if there is a standard way to filter a GPS log to spot and eliminate such noisy signals. The only obvious way I could think of was to tell the filter the a maximum speed for the boat that was tracked, and simply exclude any signal that would imply the boat to have travelled fastest than that maximum speed. Is there a better way?




  2. Since our boat is a model one and most of the times it travels at speeds below the knot, I was wondering if there is a clever way to "rectify" points that are probably wrong. An example: suppose the boat is travelling east to west and the track looks something like:


    ...⋅...


    it is quite possible that the central dot is a glitch in the GPS, but rather than dropping the log signal altogether, I would like to "correct" it [each log record contains information about the electronics too, and this data is always correct]. Again: is there a standard way to "smooth" a GPS track? I thought some sort of solution could pass through the standard deviation, but I am clueless on how to proceed.





Additional information: we are using python for processing the log, but while code snippets are always appreciated, I'd be more than pleased with a general explanation of the algorithm that I would implement myself.


Many thanks in advance for your time and expertise.



Answer



Are you trying to do this in near real time with telemetry feedback to an R/C controller, or against a datalog after recovery?


Either way have a look at your datastream or datalog file. Depending on the brand of GPS and type of data logging you might have full NMEA sentences, or just abreviated fixes to work with. If NMEA 183 sentences look for--GGA-GSA-GSV-RMC--which will provide HDOP, PDOP values and "speed over ground" values. Simply drop the positions with excessive HDOP, PDOP or speed values.


These erratic "autonomous" readings occur as the GPS receiver looses signal on one of the SVs being tracked and the standard algorithm recalculates using a different mix of SVs. In addition to the position shift including a velocity value, the algorithm can calculate and report other "quality" measurements--SVNs used for the fix, signal strength of each, DOP-Dilution Of Precision (Horizontal, Vertical, Time, Geometric or Positional). So if you filter against poor levels of these "quality" values, your positioning results will normalize.


These current links give you a pretty complete working set of NMEA 183 structure to work against. http://www.gpsinformation.org/dale/nmea.htm or http://en.wikipedia.org/wiki/NMEA_0183


To improve consistency of "autonomous" GPS mode positioning, you could fit a better GPS unit but you'd probably also need to use a higher gain external GPS antenna to hold a consistent set of SVs.



Also, the WAAS/EGNOS/MSAS services available on more capable GPS receiver provides an augmentation correction stream that the standard algorithm uses to adjust SV selection and TDOA in solving for a position.


To gain even better accuracy, you'd need to shift to a differentially corrected receiver taking a correction stream in real time from a reference network or nearby beacon. Gets expensive quickly.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...