From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to filter only one string from GPS

Solved!
Go to solution

I have a GPS, I connected it with MyRIO using the UART port. 

The GPS tell me many datas (File attached), but I want only the $GPGLL string (With the correspondent values). How I can extract only that string from all the strings?

Also I have another problem, the GPS before finding satellites sand me this string: $GPGLL,,,,,,,,,102059.00,V,N*2C

While when it finds satellites it tell me this $GPGLL,3714.60345,N,01513.47139,E,102059.00,A,A*6D

So I want filter a string only when it is complete.

0 Kudos
Message 1 of 16
(3,767 Views)

There are various functions available in the String palette, such as Match Pattern to search for '$GPGLL' and String Subset to extract a substring with a specified length of characters. What are the conditions for a string to be complete?

0 Kudos
Message 2 of 16
(3,764 Views)

Have you seen any of the tutorials for the myRIO? 

There is one for GPS: 

https://learn.ni.com/teach/resources/96/gps-receiver

 

One thing you need to do, is to only read one line at a time, then look at that line's first characters until a , 

0 Kudos
Message 3 of 16
(3,755 Views)

Seems pretty trivial to use LabVIEW's string functions to:

  1. Check the incoming NMEA sentence to see if it is $GPGLL and ignore it if it is not.
  2. Parse the $GPGLL sentence to see if it holds valid data and ignore it if it is empty.
========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 16
(3,725 Views)
Solution
Accepted by GabrieleBaudo

Thanks, i solved it in this way.

I read the NMEA senteces, extract only the $GPGLL string, create case structure for complete or incomplete string, and if it is complete i divide the string in latitude, N/S, longitude, E/W and i also add the time, with a control for fix the time zone.

Thanks everyone for your replies.

Message 5 of 16
(3,717 Views)

When you said you "add the time"  are you using the local time from the computer or the time coming from the GPS? Parse the ZDA string and you have a very accurate time. 

 

It has been a while since I worked with NMEA sentences but it would appear to me that you first should parse $GPGGA for "fix quality" to see if you have a valid fix, then you would not have to check $GPGLL for validity.

 

As once you have a valid fix in $GPGGA the data in all the other sentences should be valid.

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 16
(3,708 Views)

Hello,

 

I have been using the GPS module to get long and lat data for my autonomous sailing boat. 

 

Unfortunately, the data has become corrupt.

 

Does anyone have any idea as to what the problem may be?

0 Kudos
Message 7 of 16
(3,653 Views)

It seems that everything is fine, the strings datas are valid. What's the problem? The longitude and latitude are incorrect?

0 Kudos
Message 8 of 16
(3,649 Views)

Hello,

 

Thanks for the quick response.

 

The longitudes and latitudes are being read multiplied by 100.

 

I divided them back to normal digits and the location was 20 kilometers off. 

 

I've tested this in multiple locations. it was working previously. 

0 Kudos
Message 9 of 16
(3,644 Views)

I don'know how it's possible. I thought the problem was the unit of measurement, but if it works previously i don't know.

What is the GPS model? 

0 Kudos
Message 10 of 16
(3,634 Views)