GPSDriver giving wrong lat/lon data?

mr.kabelbinder

New Member
Licensed User
Hello forum,

I do have a strange effect using GPSDriver on a WM5 device with built-in GPS.

The device in question is a Mio A701. Basic4PPC is version 6.05, GPSDriver v1.11. A little test-app (just showing lat/lon and some other values) does work correctly in that it give back values, correct satellite counts etc.

BUT: The lat/lon reported look very strange - I get values like 4776.6586 for latitude and 1085.0136 for longitude. Given the docs those values should be degrees, so I obviously do have a problem here ;-).

Other GPS apps on the same device work OK and give correct position data (like iGo navigation system, odgps etc.).

Has anyone else observed such a strange behaviour? Might it be the slightly older Basic4PPC version?
Or do I simply mis-interpret the data?

Any help or hint is greatly appreciated!

Chris
 

mr.kabelbinder

New Member
Licensed User
I reverted back to a fairly standard GPS test app, still the same effect.
Here's the relevant part of the source code:

B4X:
Sub App_Start
   FormLib.New1("form239",B4PObject(1))
   FormLib.FullScreen2(True,True)
   Form239.Show
   gps.New1
   
   Label1.Text = "Trying to connect..."
   Label1.Visible = True
   Label1.Refresh

   gps.Open
   
   If gps.Opened = True Then
      Label1.Text = "gps is open."
      Timer1.Interval = 1000
      Timer1.Enabled = True   
   Else
      Label1.Text = "gps failed to open."
   End If
End Sub

Sub Timer1_Tick
   gps.GetDeviceData
   If gps.GetGpsData(6000) = True Then Displaygps
End Sub

Sub DisplayGps
   lstData.Clear
   lstData.Add("Service status: " & gps.ServiceState)
   lstData.Add("Device status: " & gps.DeviceState)
   lstData.Add("Fix: " &  gps.FixType)
   lstData.Add("Driver prefix: " &  gps.DriverPrefix)
   If gps.MagneticVariation <> gps.InvalidData Then lstData.Add("Magnetic variation: " &  gps.MagneticVariation)
   If gps.PositionDilutionOfPrecision <> gps.InvalidData Then lstData.Add("PDOP: " & gps.PositionDilutionOfPrecision)
   If gps.SatelliteUsedCount <> gps.InvalidData Then lstData.Add("Satellites in use: " & gps.SatelliteUsedCount)
   If gps.Time <> 0 Then lstData.Add("Time: " & Date(gps.Time) & " " & Time(gps.Time))
   If gps.Latitude <> gps.InvalidData AND gps.Longitude <> gps.InvalidData Then
      lstdata.Add("Lat: " & Round(gps.Latitude))
      lstdata.Add("Lon: " & Round(gps.Longitude))
   End If
   If gps.SeaLevelAltitude <> gps.InvalidData Then lstdata.Add("SeaLevelAltidute: " & gps.SeaLevelAltitude)   
   If gps.EllipsoidAltitude <> gps.InvalidData Then lstdata.Add("EllipsoidAltitude: " & gps.EllipsoidAltitude)   
   If gps.Speed <> gps.InvalidData Then lstdata.Add("Speed: " & gps.Speed * 1.852)
   If gps.Heading <> gps.InvalidData Then lstdata.Add("Course: " & gps.Heading)
End Sub

A current example for coordinates from my test app would be:
I get
latitude "4748.6319"
longitude "1032.8675"

I just stumbled upon how to interpret this, but that's not the way it SHOULD be in my understanding. This actual position is
lat 47° 48.6319'
lon 10° 32.8675'

but expressing this correct position as decimal degrees should read
lat 47.81053167
lon 10.54779167
or am I wrong?

And what would the output look like if I have a position with a one-digit or three-digit degree for the lat/lon?

I'm confused :)

Chris
 

mr.kabelbinder

New Member
Licensed User
Sorry, misunderstanding ;-)

I attach the source code and the compiled EXE for the device.

Thanks for taking a look into this!

Chris
 

Attachments

  • test2.zip
    14.9 KB · Views: 171

agraham

Expert
Licensed User
Longtime User
Your source code, unchanged, returns the correct latitude and longitude for my location when run on my HTC Touch Diamond with internal GPS - this is not surprising as this is the device I used to develop the original version of GPSDriver for Erel. I have also tried it on my iPAQ214 with an external Fuzion Bluetooth GPS and that worked correctly too.

From the information you gave in a previous post it looks to me as though there is a bug in your device. GPSDriver calls the Windows GPS Intermediate Driver directly, not a COM port, to access GPS data and the data is provided ready parsed, not as NMEA sentences. The data it is providing you with appears to be in the format of the original NMEA string which is "ddmm.mmm". It should be converting this to "dd.dddd" but it looks like it is not and it seemsto be passing it through unchanged.

Your other GPS apps probably work because they are using the GPS either directly through a COM port or indirectly through a virtual COM port set up by the GPS Intermediate Driver. Which of these it is depends upon how you have set up the device and the apps. In either case they will be receiving data as NMEA sentences whixh is what they expect from a COM port, and not the ready parsed GPSDriver data. Presumably the original NMEA data is being passed through correctly.
 

mr.kabelbinder

New Member
Licensed User
Yep, makes sense. Seems like the intermediate driver is just passing the NMEA formatted data through. And I confirmed the other two apps work directly on the COM ports.

So I'll have to deal with this bug on this development device and make sure there's no such bug on the production devices (which are completely different).

Thanks for opening my eyes ;-)

Chris
 
Top