locked
GPS large HDOP values RRS feed

  • Question

  • Hi --

    I am writing a mobile application with GPS functionality.  Precision is extremely important for this application.  For this reason, I have tweaked my method that obtains position information.  Basically what I do is take five position measurements in a row and return the one that has the lowest HDOP value, with the hope that the HDOP is close to 1.  What I am finding is the first time this method is called I get a normal HDOP value, say 1.3.  However, on subsequent calls to this method it returns an HDOP value like 2683652!

    Does anyone see a flaw in my use of the GPS Intermediate Driver that would cause this?  Is this tweak not recommended?
     
    The code for the method that obtains position information is below.

    int NUM = 5;
    
    GpsPosition[] positions = new GpsPosition[NUM];
    GpsPosition gpsPosition = null;
    int indexToUse = 0;            
    
    if (!Gps.Opened)
    {
        Gps.Open();
    }
    
    for (int i = 0; i < NUM; i++)
    {
    
        gpsPosition = Gps.GetPosition();
    
        //add it to the archive array
        positions[i] = gpsPosition;
    
        //if the current position has a HDOP that is better than the one previosuly found to be the best
        //then set that as the index to use
        if (gpsPosition.HorizontalDilutionOfPrecisionValid &&
            gpsPosition.HorizontalDilutionOfPrecision < ((GpsPosition)positions[indexToUse]).HorizontalDilutionOfPrecision)
        {
            indexToUse = i;
        }
    
    }            
    
    if (Gps.Opened)
    {
        Gps.Close();
    }
    
    GpsPosition positionToReturn = (GpsPosition)positions[indexToUse];
    MessageBox.Show(string.Format("HDOP: {0}", positionToReturn.HorizontalDilutionOfPrecision));
    return positionToReturn;
    
    • Edited by grobinson Saturday, August 8, 2009 3:39 PM
    Saturday, August 8, 2009 3:32 PM

All replies

  • Ok, so it seems that if I move the opening and closing on the GPS Intermediate Driver to the load and close events of the form, respectively, I don't have the issue any more.  However, my thought was to conserve batttery life on the device by only opening the receiver when I need access to it. This doesn't make sense to me.
    Saturday, August 8, 2009 3:53 PM
  • Hi,

    Which device are you running this on?

    Thanks

    Paul Diston
    http://www.smartmobiledevice.co.uk/
    Saturday, August 8, 2009 9:02 PM
  • Right now I am just running this on the HTC Kaiser/TyTNII/AT&T Tilt.
    Sunday, August 9, 2009 2:25 PM
  • Hi,

    Have you experienced this on other devices?

    Thanks

    Paul Diston
    http://www.smartmobiledevice.co.uk/
    Sunday, August 9, 2009 4:37 PM
  • To be honest, I've only tested on this one device and this is the only one I have available to me at this time.  It strikes me as odd that I would have to keep the receiver handle open for the lifespan of the Form when I would think that using the GPS receiver is a very expensive operation and draining on the life of the battery.
    Sunday, August 9, 2009 4:41 PM