Locations

Globo-Daq

 
GNSS Module | Parser NMEA to GPX - Implementation
Update #10134  |  24 Nov 2014
 

PARSER NMEA - GPX

In order to obtain, the data that we are looking for from the NMEA data sets, we have implemented a PARSER, which allow us to customize the output data to display and process.

 

Parsing

Definition: “Parsing is the process of structuring a linear representation in accordance with a given grammar. This definition has been kept abstract on purpose, to allow as wide an interpretation as possible. The “linear representation” may be a sentence, a computer program, a knitting pattern, a sequence of geological strata, a piece of music, actions in ritual behavior, in short any linear sequence in which the preceding elements in some way restrict the next element.” [1]

In our case, we will parse from NMEA format to a GPX format (linear representation). For more information about these format please review the last update.

 

NMEA data set selection

As we explain in the last update there are several data sets transmitted in one block of NMEA sentences, which contain different GNSS information. In order to define the point and tracks of the hot air balloon for the GPX format, it is necessary to extract form the NMEA sentences different items of information such as:

  • Longitude
  • Latitude
  • Elevation
  • Time
  • # of satellites
  • Horizontal Dilution of precision (HDOP)

Between the data set provide by the GNSS module, there are two data set that could provide the information mention above, GGA and RMC. But RMC does not include information about the height, which GGA does.

So the data set selected is GGA, nevertheless this is the minimum information that we need to generate our track in a GPX format, meaning that if we need in the future other items of information, we could proceed to take more data set into account.

 

GGA Description

 

Implementation

 The parsing process basically is composed by:

  1. NMEA data set recognition.
  2. Extraction of the NMEA data set.
  3. Check sum of the data set extracted.
  4. Extraction, cleansing and conversion of the items of information that we are interested.
  5. Writing of the data in the GPX file.

 

1.      NMEA data set recognition

This stage start with the ‘$’ symbol recognition, notifying the start of a data set, as can be seen in the table below.  Next, the data set identifier recognition, for the moment we are just focus on the GGA, as it is described before.

Functions

 

2.      NMEA data set extraction

Once the data set is recognized, we copy until the <LF> new line - character is found.

Functions

 

3.      Check sum

Extract from U-blox GPS COMPENDIUM - The Checksum is used for verifying the entire data set, it is determined by an exclusive-or operation involving all 8 data bits (excluding start and stop bits) from all transmitted characters, including separators. The exclusive-or operation commences after the start of the data set ($ sign) and ends before the checksum separator (asterisk: *). The 8-bit result is divided into 2 sets of 4 bits (nibbles) and each nibble is converted into the appropriate hexadecimal value (0 ... 9, A ... F). The checksum consists of the two hexadecimal values converted into ASCII characters. [2]

For example, the following NMEA data set has been received and the checksum (CS) must be verified for its correctness.

$GPRTE,1,1,c,0*07 (07 is the checksum)

 

 To perform this operations is used a matrix and operations between its columns and rows.

Functions

 

4.      Extraction, cleansing and conversion

The data set extracted is split by the comma separator “,”. A special care is needed for latitude and longitude format.

Latitude and Longitude Format

Latitude and longitude have to be converted into decimal format (WGS-84) [2].

 Example for the first data record [2]:

  • The Latitude value 4650.9180 N is expressed in the GGA format for describing 46° 50.9180’. This must be converted into decimal format. 46° 50.9180’ = (46 +50.9180/60)° = 46.848633°.
  • The longitude value 00931.8641 E stands for 9° 31.8641’ and also must be converted to decimal format. 009° 31.8641’ = (9° + 31.8641/60)° = 9.5310683°

Longitude values from 0° to 180° E and latitudes from 0° to 90° N are positive.

Longitudes from 0° to 180° W and latitudes from 0° to 90° S receive a negative value.

Functions

 

5.      Writing of the data in the GPX file

The last step, is write into the GPX file all the data in the correct format. It is important to take into account the header and bottom, for more details please visit our update “GNSS, satellite navigation and data format (NMEA) | Relevant information

Functions

 

Verification

There are different online tools that can be used verify the correctness of our output – GPX FILE.

One of the most popular is GPS VISUALIZER http://www.gpsvisualizer.com/. Here, is possible to upload the GPX file and plot its content in google maps.

 

Key Issues

During the development of this stage we have faced some challenges:

  • Multi data representation: ASCII, decimal and hexadecimal.
  • Buffer overflow, data movement among buffers.
  • Character recognition.

 

Video

 

 

References

[1] D. Grune and C. Jacobs. Parsing techniques, a practical guide. 1990.

[2] U-blox  GPS Essentials of Satellite Navigation, Compendium. 2009



More info www.globodaq.co

 

gmail       pinterest   twitter   wordpress     


 

Comments