GPS fails in height

AlpVir

Well-Known Member
Licensed User
Longtime User
My code is wrong a few tens of meters to measure the height, probably because they consider the geoid or ellipsoid (not sure which one).
I use a external GPS (connected via Bluetooth).
Here is some code snippet :

GPS1.Initialize("GPS")
StartActivity(GPS1.LocationSettingsIntent)
Sub GPS_LocationChanged (Location1 As Location)
H=Location1.Altitude
lblQuotaX.Text = H
End Sub

Thanks in advance
 

AlpVir

Well-Known Member
Licensed User
Longtime User
Why then the system hardware/software
external antenna -> "Bluetooth GPS Provider" -> "TwoNav"
mistake only 5-10 meters at most and sometimes even less ?
I suppose the software make corrections. What ? With such algorithms ?
 
Upvote 0

AlpVir

Well-Known Member
Licensed User
Longtime User
Following are part of the intervention that I made in another thread because it relates closely to the subject matter in this.
I hope I have broken no rules of the forum.

Basically I live to 545 m above sea level. My system hardware/software "external antenna --> Motorola Defy ---> TwoNav" correctly indicates 550 m or so.
Also use that, the internal antenna result (almost perfect) does not change.
The app. GPSExample indicates 595 m, very very different.
The difference (about 50 m) corresponds precisely to the result of the calculation done with the software "ClenGui.exe" (NIMA WGS 84 Calculator) or that derived from the computer on-line
http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm96/intpt.html

It might be useful "EGM96Geoid.c" (easily available online) that should correct this error, but is written in C.
It is worth rewriting it in B4a or are there better solutions?
Or take a solemn corner?
 
Upvote 0

latcc

Banned
I use various gps apps for flying and air navigation and I can tell you that gps IS fairly accurate in altitude at least to 4 meters. (Given a reasonable constellation of sats.)

The b4a app I wrote for flying works well with my zte blade but massively over-reads altitude (approx 50meters) for at least one other user. This user's other (non-B4A apps) give correct altitude reporting.

So I would agree this is a serious B4A gps issue that needs fixing.
 
Upvote 0

AlpVir

Well-Known Member
Licensed User
Longtime User
n the meantime I have studied the problem and realized that I need to set the option "use ellipsoidal heights" in you software.
The 50 meters is the difference between the geoid and the ellipsoid and are equal to my latitude and longitude, to 50 meters.
If you use a bluetooth external antenna must "enable mock data".
I know that it was not clear, but confirm that with a well-set, you get 4-5 meter error.
If you want to create apps with B4A must study the problem mentioned above concerning the "mock" data.
 
Upvote 0

Roger Garstang

Well-Known Member
Licensed User
Longtime User
How many Sats are you connected to when you get the wrong readings? There are about 32 total of which usually only half or less are over your hemisphere. Most devices will connect to up to 12-15 at a time. Usually at least 2-3 are needed to even get your location and altitude needs more. The more you have the more accurate the reading.
 
Upvote 0

bvdijk

Member
Licensed User
Longtime User
I know it's an older thread, but I've just made a small app using the GPS lib and installed it on my Google Nexus S (4.1.1), showing me the speed/alt/lat/long/sats (with the smallest interval possible '0')

I'm living at sea level and almost have the sea in my backyard ;-), altitude is showing >50m, sometimes jumping up to 120m in complete open field/beach (showing at least 12 satellites), while my (French) car is showing 0m.

So, this is telling me nothing what is causing this. It could be very well my Nexus S... Just my 2 cents...
 
Upvote 0

AlpVir

Well-Known Member
Licensed User
Longtime User
I suggest you read all this thread, especially #5.
In addition, you should set on your smartphone:
- "Settings"
- "Applications"
- "Development"
- Check box "fictitious positions" or "fake positions" (test checked and unchecked)
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I had noticed the same problem months ago.
I didn't investigate futher that time after having read post #5.

Tested right now once again with my B4A GPSExample progam on my Nexus One and on my Asus TF700 tablet.
6 active satellites
altitude 523m on both devices
but the real altitude is 462m.
"Allow mock location" checked or unchecked no difference.

I remember in WindoesMobile with Basic4PPC there are two altitude values available EllipsoidAltitude and SeaLevelAltitude. SeaLevelAltitude was correct.

I downloaded GPS Staus from Play Store and ran it on both devices
Altitude 460m on the tablett and 517 on the nexus One !?

Best regards.
 
Upvote 0

AlpVir

Well-Known Member
Licensed User
Longtime User
Are reasonably confident that the problem stems from the difference between the "geoide" and ellissoide" (in italian language), in relation to the different gravitational force at each point of the globe (for example due to the presence of heavier masses below the earth's surface).
Which provides results, in their respective cases, the computer on-line
NGA: (U) NGA EGM96 Geoid Calculator (UNCLASSIFIED)
?
 
Upvote 0

enemotrop

Member
Licensed User
Longtime User
I know this is an old thread, but in case it could be useful for anyone, I've solved this problem using a NMEA event to receive the full NMEA sentence, which contains both the ellipsoid and the geoid heightfor your position. The NMEA sentence is a string with several fields separated by commas, there are two of them followed by an "M"; the first one is the ellipsoid height and the second one the geoid thickness.

So, you only need this formula

Eh - Gt = Gh (Ellipsoid height - Geoid thickness = Geoid height)

This could be the source of an event that works, indeed. But surely it can be made in less code:

B4X:
Sub GPS_NMEA (TimeStamp As Long, Sentence As String)
    If Sentence.Contains("$GPGGA") = True AND Sentence.Contains(",M,") = True Then
        geoide_pos1 = Sentence.IndexOf(",M,")
        geoide_pos2 = Sentence.IndexOf2(",M,",geoide_pos1+1)
        geoide = Sentence.SubString2(geoide_pos1+3,geoide_pos2)
    End If
End Sub
 
Upvote 0

AlpVir

Well-Known Member
Licensed User
Longtime User
Interesting solution, but I am not aware that the library exposes the GPS NMEA sentences.
What to do?
Thanks in advance.
 
Upvote 0

AlpVir

Well-Known Member
Licensed User
Longtime User
Thanks Erel.
Obviously I have not updated because you wrote yourself (23/12/2010) "The raw sentences are not exposed for now."
I will look into the matter.
 
Upvote 0

AlpVir

Well-Known Member
Licensed User
Longtime User
Forgive me but I do not understand.

NMEA (TimeStamp As Long Sentence As String)
is an event, just as
LocationChanged (Location1 As Location)
and
GpsStatus (Satellites As List)

In this case, I can write :

B4X:
Sub GPS_LocationChanged (Location1 As Location)
  Log (Location1.longitude)
end Sub

This works and gives the values of longitude.

Similarly I should be able to write :

B4X:
Sub GPS_NMEA (TimeStamp As Long Sentence As String)
  Log (Sentence)
end Sub


But it comes out of nowhere !
Even writing GPS1_NMEA.
I specify that I'm using a real device with internal GPS.
 
Upvote 0
Top