Questions and discussion about the geolocalization features of the TD RF modules.
User avatar
lcheminade
 
Posts: 146
Joined: Mon May 11, 2015 7:47 am

Decoding GPS frame

by lcheminade Thu Jul 09, 2015 7:52 am

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).
disk91
 
Posts: 58
Joined: Thu May 07, 2015 4:30 pm

Re: Decoding GPS frame

by disk91 Wed Jul 15, 2015 6:59 am

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
User avatar
lcheminade
 
Posts: 146
Joined: Mon May 11, 2015 7:47 am

Re: Decoding GPS frame

by lcheminade Mon Jul 20, 2015 1:14 pm

Hi,

Data will be encoded as follow:

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



Decoding algorithm:

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



Values:

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


Example:

0x9fa2b5007759

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



Loïc
disk91
 
Posts: 58
Joined: Thu May 07, 2015 4:30 pm

Re: Decoding GPS frame

by disk91 Sun Aug 02, 2015 3:52 pm

Thank you Loic, it is clear !
Paul
photogaff
 
Posts: 1
Joined: Sat Sep 03, 2016 3:57 pm

Re: Decoding GPS frame

by photogaff Mon Sep 19, 2016 11:01 pm

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
User avatar
mstempin
 
Posts: 168
Joined: Thu May 07, 2015 9:24 am

Re: Decoding GPS frame

by mstempin Mon Nov 28, 2016 4:48 pm

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.
Return to Geolocalization

Who is online

Users browsing this forum: No registered users and 12 guests