Writing Your Own GPS Applications: Part 2

High Precision in Action

High Precision in Action

Enforcing maximum DOP values is the easiest part of the whole programming process because enforcing precision is a matter of ignoring positional measurements above your maximum allowable DOP amount. This can be done in one “ if ” statement. To best demonstrate this, I've written a small application (the "Demo" linked at the start of this article) which uses the NMEA interpreter to enforce a maximum DOP of 6.

C#

public class HighPrecisionTest
{
  private NmeaInterpreter MyInterpreter = new NmeaInterpreter();
  private int MaximumDOPAllowed = 6;
  private double CurrentHDOP;
  public HighPrecisionTest()
  {
    // Bind events for dilution of position
    MyInterpreter.HDOPReceived += new System.EventHandler(OnHDOPReceived);
    MyInterpreter.PositionReceived += new System.EventHandler(OnPositionReceived);
  }
  public void Test()
  {
    // Parse satellite information (HDOP is 50.0)
    MyInterpreter.Parse(
    "$GPGSA,A,1,,,,,,,,,,,,,50.0,50.0,50.0*05");
    // Parse the current position
    MyInterpreter.Parse(
    "$GPRMC,225233.990,V,3939.4000,N,10506.4000,W,0.00,51.40,280804,,*35");
    // Parse satellite information (HDOP is 1.2)
    MyInterpreter.Parse(
    "$GPGSA,A,3,11,29,07,08,19,28,26,,,,,,2.3,1.2,2.0*30");
    // Parse the current position again
    MyInterpreter.Parse(
    "$GPRMC,012558.584,A,3939.7000,N,10506.7000,W,0.00,198.07,290804,,*11");
  }
  private void OnHDOPReceived(double value)
  {
    // Remember the current HDOP value
    CurrentHDOP = value;
  }
  private void OnPositionReceived(string latitude, string longitude)
  {
    // Is the HDOP at least six?
    if (CurrentHDOP <= MaximumDOPAllowed)
    {
      // Yes.  Display the current position
      Debug.WriteLine("You are here: " + latitude + ", " + longitude);
    }
    else
    {
      // No.  Discard this positional measurement
      Debug.WriteLine("The received location is not precise enough to use.");
    }
  }
}

VB.NET

Public Class HighPrecisionTest
  Private WithEvents MyInterpreter As New NmeaInterpreter
  Private MaximumDOPAllowed As Integer = 6
  Private CurrentHDOP As Double
  Public Sub Test()
    ' Parse satellite information (HDOP is 50.0)
    MyInterpreter.Parse("$GPGSA,A,1,,,,,,,,,,,,,50.0,50.0,50.0*05")
    ' Parse the current position
    MyInterpreter.Parse("$GPRMC,225233.990,V,3939.4000,N," & _
                        "10506.4000,W,0.00,51.40,280804,,*35")
    ' Parse satellite information (HDOP is 1.2)
    MyInterpreter.Parse("$GPGSA,A,3,11,29,07,08,19,28,26,,,,,,2.3,1.2,2.0*30")
    ' Parse the current position again
    MyInterpreter.Parse("$GPRMC,012558.584,A,3939.7000,N," & _
                        "10506.7000,W,0.00,198.07,290804,,*11")
  End Sub
  Private Sub OnHDOPReceived(ByVal value As Double) _
          Handles MyInterpreter.HDOPReceived
    ' Remember the current HDOP value
    CurrentHDOP = value
  End Sub
  Private Sub OnPositionReceived(ByVal latitude As String, _
    ByVal longitude As String) Handles MyInterpreter.PositionReceived
    ' Is the HDOP at least six?
    If CurrentHDOP <= MaximumDOPAllowed Then
      ' Yes.  Display the current position
      Debug.WriteLine("You are here: " & latitude & ", " & longitude)
    Else
      ' No.  Discard this positional measurement
      Debug.WriteLine("The received location is not precise enough to use.")
    End If
  End Sub
End Class

And that's it! Armed with a deep understanding of GPS precision and how to keep it tightly controlled, you can now develop location-based services suitable for the real world.

Conclusion

There are several ways to distort a GPS satellite signal. Some are corrected by the Department of Defense and others can be corrected in your GPS receiver using real-time ground station correction signals. The only precision problem which is left to you to control is Geometric Dilution of Precision. Controlling GDOP is the key to writing commercial-grade GPS applications. A small mathematical formula can be applied to determine the maximum allowable DOP for a particular application. The maximum allowable error should be the greatest possible value which minimizes accuracy problems while maximizing operational conditions.

Another factor which helps developers is time itself. Advances in GPS receiver technology are pushing precision to new levels. While precision can be questionable with any consumer GPS device, there will soon be a time when precision to a centimeter is possible. I believe that this level of precision will cause a revolution in industry and pave the way for some truly amazing things: automated construction machines, tracking for every shipping container in the world, traffic control systems that actively prevent traffic jams... and self-guiding golf balls.

(To be continued...)

[ Note : Please indicate your interest in part three by rating this article.]

You might also like...

Comments

About the author

Jon Person

Jon Person United States

Jon Person is the author of the award-winning “GPS.NET” software now in use in over two thousand GPS applications in all industries, from geocaching to disease outbreak prevention. Jon runs his...

Interested in writing for us? Find out more.

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Java is to JavaScript what Car is to Carpet.” - Chris Heilmann