Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show PDOP, HDOP, and VDOP #71

Closed
barbeau opened this issue Nov 16, 2016 · 2 comments
Closed

Show PDOP, HDOP, and VDOP #71

barbeau opened this issue Nov 16, 2016 · 2 comments

Comments

@barbeau
Copy link
Owner

barbeau commented Nov 16, 2016

Summary:

PDOP, HDOP, and VDOP are available via NMEA strings.

From http://aprs.gids.nl/nmea/:

$GPGSA

GPS DOP and active satellites

eg1. $GPGSA,A,3,,,,,,16,18,,22,24,,,3.6,2.1,2.23C
eg2. $GPGSA,A,3,19,28,14,18,27,22,31,39,,,,,1.7,1.0,1.3
35

1 = Mode:
M=Manual, forced to operate in 2D or 3D
A=Automatic, 3D/2D
2 = Mode:
1=Fix not available
2=2D
3=3D
3-14 = IDs of SVs used in position fix (null for unused fields)
15 = PDOP
16 = HDOP
17 = VDOP

Example string from LG G5 w/ Android 6.0.1:

$GNGSA,A,2,67,68,69,79,84,,,,,,,,1.3,1.0,0.8,2*3A

So PDOP is 1.3, HDOP is 1.0, and VDOP is 0.8.

@barbeau
Copy link
Owner Author

barbeau commented Nov 28, 2016

Note that the above example from the LG G5 that I used when writing the code and for a unit test was actually a $GNGSA (with a "N") sentence, not a $GPGSA (with a "P"). So currently $GNGSA sentences are supported and parsed, but not $GPGSA (N is presumably for a generic GNSS solution, while P is for a GPS solution).

Apparently these two sentence types are slightly different. Here's data from a LG G5 w/ Android 7.0:

$GPGSA,A,3,03,14,16,22,23,26,,,,,,,3.6,1.8,3.1*38
$GNGSA,A,3,03,14,16,22,23,26,,,,,,,3.6,1.8,3.1,1*3B

The "N" sentence appears to have an extra field prior to the * with the value of 1 - the field to the right of the * is the checksum. So, the PDOP, HDOP, and VDOP respectively is 3.6, 1.8, and 3.1, but in the N sentence a comma appears before the *, whereas in the P sentence the checksum appears right after the VDOP without a separating comma.

It seems some devices are using the P sentence format for sentences that start with $GNGSA - or, there is some other reason why the $GNGSA format occasionally looks like the above $GPGSA format (I can't find any documentation on the $GNGSA online - if anyone knows why there is a difference between these two formats, please let me know).

I believe the $GPGSA format is the cause behind crashes I'm seeing with the current release - we're trying to parse the VDOP from the field containing both the VDOP and the * with the checksum:

java.lang.NumberFormatException: Invalid double: "99.0*2B"
	at java.lang.StringToReal.invalidReal(StringToReal.java:63)
	at java.lang.StringToReal.initialParse(StringToReal.java:164)
	at java.lang.StringToReal.parseDouble(StringToReal.java:282)
	at java.lang.Double.parseDouble(Double.java:301)
	at java.lang.Double.valueOf(Double.java:338)
	at com.android.gpstest.util.GpsTestUtil.getDop(GpsTestUtil.java:250)
	at com.android.gpstest.GpsStatusFragment.onNmeaMessage(GpsStatusFragment.java:294)
	at com.android.gpstest.GpsTestActivity$5.onNmeaReceived(GpsTestActivity.java:508)
	at android.location.LocationManager$GpsStatusListenerTransport$1.handleMessage(LocationManager.java:1537)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loop(Looper.java:148)
	at android.app.ActivityThread.main(ActivityThread.java:7325)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

and:

java.lang.NumberFormatException: For input string: "99.0*2B"
	at java.lang.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1306)
	at java.lang.Double.valueOf(Double.java:511)
	at com.android.gpstest.util.GpsTestUtil.getDop(GpsTestUtil.java:250)
	at com.android.gpstest.GpsStatusFragment.onNmeaMessage(GpsStatusFragment.java:294)
	at com.android.gpstest.GpsTestActivity$4.onNmeaMessage(GpsTestActivity.java:490)
	at android.location.LocationManager$GnssStatusListenerTransport$GnssHandler.handleMessage(LocationManager.java:1419)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loop(Looper.java:154)
	at android.app.ActivityThread.main(ActivityThread.java:6640)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)

Other values we're trying to parse from other stack traces include 2.9*22, 0.9*23, and 0.9*2A among others.

The following devices have the above stack traces (vast majority is java.lang.NumberFormatException: ... at java.lang.StringToReal.invalidReal(StringToReal.java:63):

  • Android 6.0 25 61.0%

  • Android 4.4 10 24.4%

  • Android 5.0 4 9.8%

  • Android 5.1 2 4.9%

  • Galaxy S5 (klte) 3 7.3%

  • MeMO Pad 7 (ME176C) (K013) 5 12.2%

  • Galaxy Note3 (hlte) 2 4.9%

  • Galaxy Tab Pro 8.4 (mondrianwifi) 1 2.4%

  • Galaxy S6 (zeroflte) 1 2.4%

  • Galaxy A8 (a8hplte) 1 2.4%

  • Galaxy S6 Edge+ (zenlte) 1 2.4%

  • Galaxy S7 Edge (hero2lte) 12 29.3%

  • L-01F (g2) 1 2.4%

  • Galaxy A3(2016) (a3xelte) 1 2.4%

  • Galaxy Grand Prime (grandprimeve3g) 2 4.9%

  • Galaxy TabS 10.5 (chagallwifi) 2 4.9%

  • SHIELD Tablet (shieldtablet) 1 2.4%

  • Lenovo YOGA Tablet Pro-1050L/Yoga Tablet 2 (YT2) 1 2.4%

  • Zenfone 3 (ASUS_Z012D) 1 2.4%

  • Galaxy Note2 (t0lte) 1 2.4%

  • Galaxy Note4 (trelte) 1 2.4%

  • Galaxy S7 (herolte) 3 7.3%

  • Galaxy Note Edge (tblte) 1 2.4%

@barbeau barbeau reopened this Nov 28, 2016
barbeau added a commit that referenced this issue Nov 28, 2016
* See #71 (comment) for details
* Add support for $GPGSA NMEA sentences
* Support parsing VDOP when the checksum appears next to that value without a comma separator
* Catch NumberFormatException and output error message to console in case there are other issues parsing DOP from NMEA
* Add more tests parsing DOP from GSA sentences
@barbeau
Copy link
Owner Author

barbeau commented Nov 28, 2016

Closed via 2528122.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant