Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get accurate time stamps from Android GPS location

I'm trying to get the GPS time for a location using location.getTime on a location listener using GPS_PROVIDER in my requestLocationUpdates. I was expecting the provided time to be the time from the GPS clock - accurate to billionths of a second, but rounded to the millisecond. What I am getting depends on the platform, but certainly doesn't seem to be what I'm expecting.
On SGS 11 - Android 2.3.3, the returned value is always an exact second, with the millisecond portion always .000. From my experience with GPSs, it seems to me unlikely that every polling of the GPS will occur exactly on the whole second interval.
On an HTC-A7275 Android 2.3.3 - I'm getting the phone's system time, certainly not the GPS time.
I confirmed these findingsby messing with the phone's time and examining the location time.
The time stamps in NMEA sentences on the SGS 11 are provided to 3 decimals of a second, but on the HTC, they're all xxx.0. The problem using NMEA is that it's really messy getting the date and time and full position from MNEA: It is only in the GPGGA sentence that has altitude, but it has no date stamp so it get's tricky around midnight UTC.
I am looking for precise times - preferably to the millisecond for my track logger, so that I can reliably compare tracks from different players. Has anyone done any more work on this?

like image 466
StarTraX Avatar asked Apr 22 '12 07:04

StarTraX


People also ask

How accurate is GPS clock?

GPS requires precise clocks to provide astounding positional accuracy. Atomic clocks in GPS satellites keep time to within three nanoseconds—three-billionths of a second. Position accuracy depends on the receiver. Most handheld GPS receivers are accurate to about 10 to 20 meters (33 to 66 feet).

Why is my phone GPS not accurate?

When your phone is in power-saving mode or if its screen is turned off, the GPS apps may not be provided with data in real-time. Go to Settings and make sure to change your power-saving mode to 'high performance' or 'optimized. '

How do you achieve indoor localization with a 1 meter accuracy?

By combining machine-learning techniques and sensor fusion, the technology accurately pinpoints a user's specific location on a map of the venue. Using low energy Bluetooth beacons or WiFi access points, Pointr's indoor positioning system can accurately pinpoint a user's location to within one meter.


1 Answers

Expensive GPS units use "pulse-per-second" protocols to achieve sub-millisecond accuracy, however I haven't heard of this protocol or interface available on cheap GPS receivers we have in our phones. So the best accuracy you can achieve with GPS messages is within a 1-2 seconds range.

Re:NTP on Android, it's much better solution, but unlikely to achieve clock accuracy beyond 50-100ms on contemporary wireless networks.

like image 66
lenik Avatar answered Oct 22 '22 13:10

lenik