Closed Nocentinia closed 1 year ago
Hello @Nocentinia ,
By default, myGNSS.getLatitude();
will poll (request) the Position Velocity Time data from the SAM-M8 GNSS. For your application, you need to tell the GNSS to output the data periodically every 200ms.
Please have a look at this example:
The critical pieces of code are:
Change the 2 to 5 for your application.
Then structure your loop, so that you call myGNSS.getPVT()
first. If it returns true
then read the latitude, longitude etc..:
In bocca al lupo! ;-) Paul
I was initially using the function
if (myGNSS.getPVT()) {
but I encountered the exact same problem.
I sense that this function returns true even when it doesn't actually have any new data and just hangs around like it's frozen in:
latitudine = myGNSS.getLatitude();
waiting for new data to arrive (then wait 200mS(5Hz)).
instead using setting:
myGNSS.setAutoPVT(true);
goes to manage the parameter:
myGNSS.getInvalidLlh()
which becomes false whenever there is actually new data, is this correct?
thanks for your immediate reply :)
Normally, getPVT
requests (polls) the Position Velocity Time data. It waits for the data to arrive - or for a timeout to happen. In your case, it could take up to 200ms for the data to arrive. The code will stall for up to 200ms.
myGNSS.setAutoPVT(true);
changes the way getPVT
works. It also tells the GNSS to output PVT periodically.
Afterwards, getPVT
will check if any data has arrived from the GNSS. It will return true
if new PVT data has arrived. If no data has arrived, it returns false
- ~immediately. It does not wait for the data to arrive.
You can ignore myGNSS.getInvalidLlh()
. That returns true
if the Latitude Longitude Height is invalid. false
indicates the GNSS has a good fix and that latitude, longitude and height are valid. It comes from the invalidLlh flag inside the PVT message.
thank you very much for your support, I have performed various tests with your advice obtaining excellent results. I still have some doubts about how some things work, can I ask here?
Hi,
We use GitHub Issues to report and correct actual issues (bugs and other problems) with the library. For general advice, the best place to ask is the SparkFun GPS Forum. I watch that forum and will help if I can.
https://forum.sparkfun.com/viewforum.php?f=116
Best wishes, Paul
Hello everyone. I'm trying to create a data logger that saves me GPS and IMU data. I'm using Arduino MKR1010 and Arduino MKRGPS Shield as hardware (I know it's not your product, but I hope you can help me). I'm having some problems with the processing speed of the new gps data, basically I need the gps data to be saved on an SD card every 200mS(5Hz) and between one gps fix and another I would like them to be entered IMU data. the only problem is in the timing, I am attaching a part of the code
at the beginning of the code in the imposed variables
interval =200;
but it happens that initially the IMU data is written correctly, after 200mS it enters
and being that Arduino takes about 200mS to execute the instructions:
it happens that the only data saved in the end are those of the gps, because when the cycle restarts 200mS have passed and therefore it returns to the gps data reading block. I hope you can help me, I still have very little experience with this library and I still haven't managed to find all its features (a file with the description of the functions would be very useful). sorry for my english, i'm italian!