Pytrack GPS API
-
From the GPS only longitude and latitude is available via the API. For production use many other data is required, like
- altitude
- date/time
- HDOP
- speed
- direction
- number of satellites visible /used for fix
- ...
Please add these to the API. Also, it would be good to make raw NMEA sentences available for user space with user filtering to select which sentences must be passed (callback?).
-
@bmarkus HDOP can be recalculated to meters. So, an accuracy is a function of HDOP.
-
@johncaipa said in Pytrack GPS API:
@bmarkus I am not an expert in this topic, I need to send the coordinate and accuracy as possible in my project, plus some way to detect when it is moving to send the message. If that parameter HDOP works for me, I'll keep it in mind.
There are no accuracy available in terms of meters. HDOP is a factor in determining the relative accuracy of a horizontal position. The smaller the DOP number, the better the geometry.
-
@bmarkus I am not an expert in this topic, I need to send the coordinate and accuracy as possible in my project, plus some way to detect when it is moving to send the message. If that parameter HDOP works for me, I'll keep it in mind.
-
@johncaipa said in Pytrack GPS API:
@andrethemac Hi, Is there any way to have the accuracy value of each GPS fix? when my pytrack is stationary the accuracy of each point is very different
Do you mean HDOP?
-
@andrethemac Hi, Is there any way to have the accuracy value of each GPS fix? when my pytrack is stationary the accuracy of each point is very different
-
This post is deleted!
-
@stefan85e I'm up to 5 minutes now (timeout=300)
when your outside you'll get a fix a lot faster
-
@andrethemac Okay thanks... what time are you using!?
-
@stefan85e yes.
maybe of interest. I have 2 pytrack board and testing them side by side I found out that 1 takes way longer to get a fix, almost double as long.
So you need to tweak the timeout parameter to get the best results for your module.
best regards
-
@andrethemac Like this?
-
some tweaks to my library https://github.com/andrethemac/L76GLNSV4
methods returning multiple values now return them as a dict;
-
@stefan85e Hi Stefan
sorry for the delay. you better put the the two firsts lines following the while(true): before. you don't need to init the library every run . I'll guess it's generating the error's.
the commands stop when the timeout runs out (default aflter 180 seconds). you can change that if needed.
The timeout occurs if the gps itself can't get a fix because it can't see (enough) sattelites.
best regards
-
(I dont get any nr due to I done get a signal from the GPS, I have to go outside to get it)
When I do this the program keeps running:
#print(L76.gps_message('GSV'))
print(L76.gps_message('GGA'))And when I doing this then this happens:
print(L76.gps_message('GSV'))
print(L76.gps_message('GGA'))
-
This post is deleted!
-
The program stop after 180 sec and if I do this:
#print(L76.coordinates(debug=True)) it will not do anything :)
-
@andrethemac published a new version of the Library to github
https://github.com/andrethemac/L76GLNSV4If you find some errors or have a request, please ask.
best regards
-
@stefan85e The timeout is to prevent the library to wait for ever. 180 seconds (3 minutes) is (for me) most of the time enough to get a fixed location. (that is after a cold start)
the GGA sentences contains the number of messages seen by the GPS, In the dict that GGA returns, this is the "NumberOfSV' fied.
with this you get this number -> L76.gps_message('GGA')['NumberOfSV']
In your screenshot the line that prints the number of satellites has scrolled out of view
but if you make this line the last you get the number:
print(L76.gps_message('GGA')['NumberOfSV'])
or remove the 'debug=True) from the coordinates line (the debug spews out a lot of information)
I'm still working on the library to make it faster
best regards
-
Got this
I see that you have a 180 timeout in the code:
-> L76GNSV4 - So how do I know how many sattelites i have then :) just so I look at right nr :)
´´´´
def init(self, pytrack=None, sda='P22', scl='P21', timeout=180,debug=False):
´´´´
-
@stefan85e An example on how to get the number of satelites with my library
from pytrack import Pytrack from L76GNSV4 import L76GNSS py = Pytrack() L76 = L76GNSS(pytrack=py) print("test L76") # returns the info about sattelites in view at this moment # even without the gps being fixed print(L76.gps_message('GSV')) # returns the number of sattelites in view at this moment # even without the gps being fixed print(L76.gps_message('GGA')['NumberOfSV']) # returns the coordinates # with debug true you see the messages parsed by the # library until you get a the gps is fixed print(L76.coordinates(debug=True)) #L76.getUTCDateTime(debug=True) #L76._read_message(debug=True)