Page 1 of 1

Decoding GPS frame

Posted: Thu Jul 09, 2015 7:52 am
by lcheminade
The SDK provides several way to encode GPS data into a Sigfox Frame.

A general purpose, not optimized format is GPS_DATA_XYZ_SV_HDOP. Here is how to decode the data contained into this frame:

frame example:
5d01010005bb688ddd602590

Red part tells you this is a GPS frame encoded according to GPS_DATA_XYZ_SV_HDOP. Green part contains the position and blue part contains additional information.

Green is latitude and longitude and shall be decoded as follow:

0x005bb688ddd6 = 393904446934 thus 00°39.390' 44°46.934' (longitude ; latitude)

Please note that these are degrees, decimal minutes.


Then in blue:

12 bits for the altitude en (2xmeters) (0x025 = 37*2= 74 meters )
1 bit for longitude sign ( 0 = positive, 1 = negative) => 1 => -00°39.390'
1 bit for latitude sign ( 0 = positive, 1 = negative) => 0 => +44°46.934'
1 bit for altitude sign ( 0 =positive, 1 = negative) => 0 => +74 meters
3 bits for satellites in view => 4
2 bits for overall horizontal dilution of precision going from 0 (very good) to 3 (bad).

Re: Decoding GPS frame

Posted: Wed Jul 15, 2015 6:59 am
by disk91
Hello Loic,

I would like to use this function to encode the GPS position :

TD_SENSOR_EncodePositionXY(fix,_state.encodedPosition,48,0);

I'm ready to write reverse decoding but I'm quite sure the code already exist in C or PHP ... would you be able to share it ?

Paul

Re: Decoding GPS frame

Posted: Mon Jul 20, 2015 1:14 pm
by lcheminade
Hi,

Data will be encoded as follow:

encodage.PNG
encodage.PNG (19.06 KiB) Viewed 10753 times



Decoding algorithm:

algo.png
algo.png (9.95 KiB) Viewed 10753 times



Values:

constants.PNG
constants.PNG (40.42 KiB) Viewed 10753 times


Example:

0x9fa2b5007759

examples.png
examples.png (48.36 KiB) Viewed 10753 times



Loïc

Re: Decoding GPS frame

Posted: Sun Aug 02, 2015 3:52 pm
by disk91
Thank you Loic, it is clear !
Paul

Re: Decoding GPS frame

Posted: Mon Sep 19, 2016 11:01 pm
by photogaff
Hi there,

Something is a little unclear about the above examples or at least I need a bit of a better understanding of the conversion of the decimal number to usable lat/long.

For example:
12 bits for the altitude en (2xmeters) (0x025 = 37*2= 74 meters )
1 bit for longitude sign ( 0 = positive, 1 = negative) => 1 => -00°39.390'
1 bit for latitude sign ( 0 = positive, 1 = negative) => 0 => +44°46.934'
1 bit for altitude sign ( 0 =positive, 1 = negative) => 0 => +74 meters
3 bits for satellites in view => 4
2 bits for overall horizontal dilution of precision going from 0 (very good) to 3 (bad).

In this case, we assume we have 7 digits for lat and 7 digits for long, but how do we know where to place the degrees and decimal points in the event of a lat or lng exceeding 3 digits of degrees (ie. 60.60045,-123.04687).

Is it possible to identify a reliable output format/structure for the data, and interpret that based on certain rules, or is there a way to determine where to place the formatting in the numbers in exceptional situations like above?

Thanks,

Peter

Re: Decoding GPS frame

Posted: Mon Nov 28, 2016 4:48 pm
by mstempin
Hi Peter,

Latitude is 0 on the Equator and 90 at the Poles, so range is |-90, +90] only. This is not the case for longitude, that spans from [-180, +180].

Thus, it is OK to take the decimal number corresponding to the green hex digits above and divide by 10000000 to get longitude, then multiply the longitude by 10000000 and subtract it from the decimal number to get the latitude.

Be careful, though, these values are in fraction of minutes, not in DMS.