[teqc] Converting Android GPS data to Rinex file format

Matthew Beldyk beldyk at unavco.org
Wed Oct 13 13:32:07 MDT 2010


  Hi all,

I just did a bit of poking into the deep internals of the Android 
platform because I was curious if it would be possible to extend the 
Android SDK to include the information needed for RINEX, but the short 
answer is "No, the needed data for RINEX is not available at any level 
above the hardware itself."

The longer answer (if anyone is curious about Android's kernel) follows:

As Jim states below, the needed information is not available in the 
Java/Dalvik API.  But I wondered if the pseudorange and phase were 
available at any other layer of the Android stack (unfortunately, no, it 
isn't.)  As far as I can tell, the level directly below the Java API is 
this library: 
http://android.git.kernel.org/?p=platform/hardware/qcom/gps.git;a=tree;f=loc_api/libloc_api; 
which operates only on information available from some serial attached 
NMEA based layer, so I need to dig deeper.  (there were some references 
in loc_eng_xtra.cpp to gps orbit parameters, but again only the 
information passed up to the Java API.)

At the next level down, we are at libhardware_legacy/gps 
http://android.git.kernel.org/?p=platform/hardware/libhardware_legacy.git;a=tree;f=gps;hb=HEAD 
and are directly parsing a NMEA string into usable data structures (what 
the libloc library uses.)  At this point, I thought it was unlikely that 
the information would be available, but I kept going down the tree.

Eventually, I made it down to the GPS driver level: 
http://android.git.kernel.org/?p=kernel/common.git;a=blob_plain;f=drivers/usb/serial/garmin_gps.c  
(I only found a single end point to get GPS information from hardware.)  
Basically, the GPS devices on Android phones are a serial over USB NMEA 
devices.  I found callbacks in garmin_gps.c turning the GPS chip on and 
off, and collecting data from the chip, but only the NMEA information.  
There is an chance that some of the chips used by Android phones have 
debug interfaces to find out phase or pseudorange, but it is not 
documented in any way that a developer could easily access.  To find 
this info, you would need to communicate directly with the manufacturer 
of the GPS chip in the phone (it's possible, if not likely, that the 
phone manufacturer does not have this information available to outside 
developers, since their use cases for the phones are very different from 
what RINEX is used for.)

At this point, it becomes a question of exactly what chipset specific 
models of Android phones are using, as well as if there are any special 
instruction that can be sent to the chip to force it to output extra 
information (if that documentation even exists.) (As well as finding a 
kernel hacker/firmware engineer and Dalvik expert to implement the extra 
functionality all the way up.)

Best regards,
Matt Beldyk





On 10/13/10 11:44 AM, James Johnson wrote:
> Hi Lalitha,
>
> It is not possible to generate RINEX from an android phone.  This is because the raw data required for RINEX is not exposed by the Android API.  You can get some information about the SVs tracked and a position, but you can not get the raw Pseudo range data.  The NMEA strings are not useful for generating RINEX as well, simply because the data is not there.
>
> Sorry for the sad news.
>
> Best Regards,
> Jim Johnson
> On Oct 13, 2010, at 11:40 AM, Lalitha wrote:
>
>> Hi Homan,
>>
>> Tons of thanks for the detailed reply. I've been searching the net and posting in all the android, gps forums for the past 10 days and didn't get any response till now. Thanks to teqc mailing list.
>>
>> Q1. I checked the android api for the gps data. It provides GPS Satellite info from which we can get elevation, PRN (pseudo-random number), snr, Almanac, ephemeris data etc.
>>       Ref : http://developer.android.com/reference/android/location/GpsStatus.html
>> With these data, will it be possible to generate Rinex file directly from android app?.
>>
>> Q2. Also, there is a nmealistener provided in the android api using which we can capture gps nmea strings. Will this data be useful by anyway to translate to rinex format? (Though, I coudnt succeed capturing nmea string using my htc magic phone, I can try with some other phones if this data will be  useful for post processing).
>>
>> Thanks,
>> Lalitha.
>>
>> On Wed, Oct 13, 2010 at 9:58 AM, Homan, Thomas<thoman at co.gila.az.us>  wrote:
>> Lalitha,
>>
>>
>> .gpx files cannot be converted to Rinex as they don’t contain the necessary data elements. If I remember correctly, the api only outputs the final latitude and longitude values. I don’t believe the underlying raw gps data is accessible but I’m just getting started on Exclipse.
>>
>>
>> To generate a Rinex file you need to have access to underlying information such as pseudorange, carrier phase and other data from each satellite in the GPS constellation. As an example, below are a .gpx file compared to a Rinex file that I collected in 2005. Each of the 7 satellites visible has a set of 7 data elements logged out of my $$$ survey grade receiver and this happens each logging period.
>>
>>
>> Peruse the api docs and see if there is access to the underlying data and not the final coordinates. If not, then you might be out of luck. One thing you might explore is if the android OS supports inserting DGPS correctors so you could get real time sub-meter accuracies.
>>
>>
>> Hope this helps some.
>>
>>
>> Tom
>>
>>
>> GPX
>>
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>
>> <gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1" creator="Doug Forster's map viewer" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
>>
>> <wpt lat="-42.48781" lon="172.29404">
>>
>> <ele>1273</ele>
>>
>> <name>NwDvls</name>
>>
>> <cmt>  30/01/10 19:14</cmt>
>>
>> <desc>New Devils Den Biv</desc>
>>
>> <sym>Anchor</sym>
>>
>> <extensions>
>>
>> <type xmlns="Freshmap">Place</type>
>>
>> <TrackColor xmlns="Freshmap">0</TrackColor>
>>
>> <FontSize xmlns="Freshmap">90</FontSize>
>>
>> <GPSColor xmlns="Freshmap">14</GPSColor>
>>
>> <Layout xmlns="Freshmap">5</Layout>
>>
>> </extensions>
>>
>> </wpt>
>>
>> </gpx>
>>
>>
>> Rinex
>>
>> 05 10 12 14 44 45.0000000  0  7G 1G24G23G20G16G25G11
>>
>>    18540407.76711  14441990.35651  22140106.912    22140108.9425   22140103.6715
>>
>>       -1502.342       -1170.656
>>
>>    18405511.80411  14342294.04151  23619878.513    23619880.7005   23619875.3565
>>
>>         382.895         298.360
>>
>>    18279304.44211  14260112.94351  22317896.240    22317897.3485   22317888.9405
>>
>>        2122.449        1653.856
>>
>>    18331079.75811  14289623.90551  20672596.529    20672597.6675   20672590.3895
>>
>>        1386.704        1080.549
>>
>>    18282886.39611  14256935.72751  21779940.978    21779941.1535   21779934.4995
>>
>>        2177.108        1696.448
>>
>>    18595837.79911  14470056.42251  21824971.770    21824972.4395   21824966.6485
>>
>>       -2263.324       -1763.629
>>
>>    18612482.40511  14492926.57751  23828871.571    23828874.4325   23828869.0685
>>
>>       -2470.753       -1925.262
>>
>>
>> From: teqc-bounces at ls.unavco.org [mailto:teqc-bounces at ls.unavco.org] On Behalf Of Lalitha
>> Sent: Wednesday, October 13, 2010 9:03 AM
>> To: teqc at ls.unavco.org; gpstech at ls.unavco.org
>> Subject: [teqc] Converting Android GPS data to Rinex file format
>>
>>
>> Hi,
>>
>> How do i convert the gps data I get from Android GPS Receiver into Rinex file format in order to do Post processing corrections.
>> I can write the gps data into .gpx format using the android api provided. I use HTC Magic phone with 2.2 api version.
>> I cudnt find option for android in the teqc toolkit. Can anyone help how do I convert to Rinex?
>> Also I'm looking for the post processing softwares or service available for evaluation. I could find only one free evaluation software 'PPro2' from Kinematic GPS.
>> Is there any other free post processing software present?
>>
>> Thanks,
>> Lalitha.
>>
>>
>> _______________________________________________
>> teqc mailing list
>> teqc at ls.unavco.org
>> http://ls.unavco.org/mailman/listinfo/teqc
>>
>>
>> _______________________________________________
>> teqc mailing list
>> teqc at ls.unavco.org
>> http://ls.unavco.org/mailman/listinfo/teqc
> _______________________________________________
> teqc mailing list
> teqc at ls.unavco.org
> http://ls.unavco.org/mailman/listinfo/teqc
>


More information about the teqc mailing list