LabVIEW Robotics Module

Table of Contents

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.

Details  Example

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.
oldest read timestamp is the time at which the instrument reads the earliest data point used in GPS data. Therefore, all data points in GPS data are at least as recent as oldest read timestamp.

Use the NMEA Advanced VIs if you require the exact time at which an instrument reads a value.
latitude (deg) contains the location on Earth north or south of the equator at which the reading occurs. Positive values represent locations north of the equator, and negative values represent locations south of the equator.
longitude (deg) contains the location on Earth east or west of the prime meridian at which the reading occurs. Positive values represent locations east of the prime meridian, and negative values represent locations west of the prime meridian.
ground speed (knots) is the speed of the device at the time the reading occurs.
true track angle (deg) contains the direction of travel at the time the reading occurs with respect to true north.
altitude above mean sea level (m) contains the distance above mean sea level at which the reading occurs.
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.

Log in to get a better experience