pytrack sample code
-
@abhishek2101 for the time, you either have to set it yourself, or sync it with a NTP server (via WiFi or cellular). Are you inside a building? It might take a while (or even fail) to get a location, so I'd recommend trying it outside or near windows
-
@dan
i am outside on a terrace. -
@abhishek2101 it might take some time to find a GPS satellite? If the issue persists, let me know and we'll look into it in detail.
-
hi @abhishek2101, it seems you have a GPS problem. I would recommend:
- leave the pytrack for 30 mins outside, to pick-up the satellites data, as this is a cold-start, could take a while
- check, with a mobile app, how many satellites are visible on your exact position, it could be a glitch
-
@dan
can you let me know what are below lines doing in the codel76 = L76GNSS(py, timeout=180) chrono = Timer.Chrono() chrono.start() while (True): coord = l76.coordinates() print(coord) -
- Set up GPS module
- Start measuring timespan (docs) (but I'm not sure why it's there... It was probably left there by mistake, I'll look into that)
- Always get coordinates
-
@dan
timeout=180
does this mean that chip will spend 180 sec before locking onto satellites ? -
Set the
timeoutto a time period (in seconds) for the GPS to search for a lock. If a lock is not found by the time thetimeouthas expired, thecoordinatesmethod will return(None, None). -
@dan
mine is set for 180 seconds, that should be enough time to lock onto satellites, right ?if this time is less, what do you think is the ideal time ?
does this mean that every update happens after 180 seconds, or it the first one only ?
-
@abhishek2101 It's just the timeout for locking onto a satellite, so if after 180 seconds it doesn't find one, it returns
None. In the example, we have30.It's just for the initialisation. After that, if you have it in a
while(True)loop for example, it'll update around every second. -
@dan
Mine always return none even after initialising for 300 seconds.Can you help please ?
-
@abhishek2101 have you tried what @catalin recommended?
@catalin said in pytrack sample code:
hi @abhishek2101, it seems you have a GPS problem. I would recommend:
- leave the pytrack for 30 mins outside, to pick-up the satellites data, as this is a cold-start, could take a while
- check, with a mobile app, how many satellites are visible on your exact position, it could be a glitch
-
@dan
I will try and report back.But taking 30 min to lock onto satellites is simply not acceptable. It makes pytrack unusable.
-
@abhishek2101 could you check the GPS coverage at your location? I have tested it here at the office and got the coordinates within a few seconds. I don't think it's a software or hardware issue.
-
@dan
Google maps on my iPhone shows my location at the same place within few seconds. -
@dan
can you share the code you used. -
@abhishek2101 I'm using our Pytrack example: https://github.com/pycom/pycom-libraries/blob/master/pytrack/main.py
-
@dan
I am outside with pytrack having access to open sky.following is the code
from L76GNSS import L76GNSS from pytrack import Pytrack py = Pytrack() l76 = L76GNSS(py, timeout=30) while (True): coord = l76.coordinates() print(coord)still after 20 minutes I only see (none, none).
One only I saw coordinate values but that came in after approx 40 minutes.
How are we suppose to use pytrack if it takes so long to lock onto satellites (that too, not always) or am I missing anything. Please help.
-
@abhishek2101 said in pytrack sample code:
@dan
I am outside with pytrack having access to open sky.following is the code
from L76GNSS import L76GNSS from pytrack import Pytrack py = Pytrack() l76 = L76GNSS(py, timeout=30) while (True): coord = l76.coordinates() print(coord)still after 20 minutes I only see (none, none).
One only I saw coordinate values but that came in after approx 40 minutes.
How are we suppose to use pytrack if it takes so long to lock onto satellites (that too, not always) or am I missing anything. Please help.
need to fix this asap, can somebody help.
-
@abhishek2101 said in pytrack sample code:
I am outside with pytrack having access to open sky.
You have to learn more about the GPS stuff. The pycom library is very basic, you have to know more anyway or have to use a third party library.
You need wide area of clear sky, nice weather and no noise on the frequencies. It needs some time for the GPS chip to see enough satellites for a triangulation. If you just outside a building or next to a steep mountain, you may be in the shadow of this obstacle.
Your phone will do some tricks. First it guesses your position from the last call. It uses a frequently loaded file of statellite positions to reduce search time. Additional it may guess your postion by lookng for a set of known WiFis and their signal strength.
The pycom module does none of this tricks. So locking needs longer. In some cases a better antenna or a better position will solve the connection problem, but there is no connector for an external antenna :(
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login