Get GPS Data VI
- Updated2023-02-21
- 4 minute(s) read
Get GPS Data VI
Owning Palette: NMEA Protocol VI
Requires: Robotics Module
Parses sensor data in the NMEA format from GPS receivers and returns common GPS data, such as the latitude and longitude of a reading.
![]() |
previous partial sentence contains characters to prepend to sensor data. | ||||||||||||
![]() |
sensor data contains the data to parse for GPS data. This VI appends sensor data to previous partial sentence and then parses the data.
Use a method of instrument control to acquire sensor data from a GPS receiver. For example, you can use VISA in LabVIEW to read NMEA sentences from a GPS receiver through a serial port and then parse the data with this VI. |
||||||||||||
![]() |
error in describes error conditions that occur before this node runs. This input provides standard error in functionality. | ||||||||||||
![]() |
remaining partial sentence contains all characters after the last complete sentence in sensor data. To avoid losing this data, use this VI in a loop with shift registers to transfer remaining partial sentence to the previous partial sentence input on the next iteration of the loop. | ||||||||||||
![]() |
GPS data is a cluster that contains the following elements.
| ||||||||||||
![]() |
error out contains error information. This output provides standard error out functionality. |
Get GPS Data Details
The Get GPS Data VI parses the input strings for sentences of the GGA, GLL, and RMC NMEA sentence types and returns GPS data from these sentences. This VI ignores other types of sentences and sentences that are formatted incorrectly. Also, this VI processes sentences in the order in which they appear in sensor data and assumes the sentences are in order from oldest to most recently read. Then, if the string contains more than one value for a data point in GPS data, this VI returns the value read last.
If the input strings do not contain any values for a particular data point in GPS data, LabVIEW returns NaN for that data point. LabVIEW returns an error if the input strings contain no values for all of the data points in GPS data.
This VI uses NMEA Advanced VIs to parse NMEA sentences for data. Use the NMEA Advanced VIs instead of this VI if an application requires that you read data faster than this VI can execute.
Example
Refer to the NMEA Get GPS Data From Record VI in the labview\examples\robotics\NMEA directory for an example of using the Get GPS Data VI.