Lopy with pytrack, how connect/use GPS?
-
@livius said in Lopy with pytrack, how connect/use GPS?:
why do you modified those lines?
better change this:Just remove them for testing because with the original I get this another error:
The suggested change is to add the 'if' no?
It would be like this the file I suppose:
-
@zceld said in Lopy with pytrack, how connect/use GPS?:
but modifying the lines 8,10,11;
why do you modified those lines?
better change this:
https://github.com/pycom/pycom-libraries/pull/43/files
-
I'm sorry, but it does not work:
-
@zceld said in Lopy with pytrack, how connect/use GPS?:
https://github.com/pycom/pycom-libraries/blob/master/pytrack/main.py
Here is a simplified version of that main.py file, does this work for you:
import time from L76GNSS import L76GNSS from pytrack import Pytrack py = Pytrack() l76 = L76GNSS(py, timeout=30) while (True): coord = l76.coordinates() print(coord) time.sleep(1)
-
Good afternoon, I followed your steps to the detail.
I have updated the pytrack.
I updated the pycom Lopy.
I have added the libraries within the directory '/ lib' as they are in this post:https://github.com/pycom/pycom-libraries/tree/master/pytrack
Then the main file has not been modified because I run it from Atom connected by usb and execute it like this:
this main.py : 0_1516121243856_main1.py
The original is extracted from here:
https://github.com/pycom/pycom-libraries/blob/master/pytrack/main.pybut modifying the lines 8,10,11;
He always tells me the same thing:
I run out of ideas to make it work. :-(
-
@seb I have already added the file to the directori '/ lib' now I would need to know how to get the gps position using the libraries.
-
@crumble Hi, thanks for your recommendations. I really do not know how micropyGPS is for my chip which is a pycom Lopey 1.0 with the pytrack board. I am new in this world of plates. Then use both libraries I do not think it happens, because at the moment my procedure to prove it is having the board connected by USB to ATOM executing code like the one that I attached "micropyGPS" with the hope of obtaining coordinates. I have added in the directory '/ lib' the files L76GNSS.py, pycoproc.py and Pytrack.py. I understand that I complete the necessary libraries to get coordinates with the GPS chip, right? So now I would have to do a small program that connects with the GPS chip and get the coordinates of the location.
-
You also now have to include the pycoproc.py file from here: https://github.com/pycom/pycom-libraries/tree/master/lib/pycoproc
This contains common code between the pysense and pytrack and was refactored into its own library to reduce duplication of code.
-
@zceld is the micropythnGPS library written for the pytrack? First lines of your screenshot let me assume that it was written for another board. So if you cannot simply configure it to use the pytrack, you have to rewrite some parts.
You should not use L76Gnss.py and this MicropythonGPS library at the same time. They may not interfere each other, but compiling them will need some RAM, which you need for other stuff.
-
That has already cost me a lot since I did not let myself use the shutil library
I do not use it self then can not talking if it is easy ;-)
but - try to use modified file
L76GNSS.py
https://github.com/pycom/pycom-libraries/pull/43/filesI also tried to execute this code and it gives me an error.
but I do not know what it means?change
from L76GNSS import L76GNSS
toimport L76GNSS
and also
l76 = L76GNSS(py, timeout=30)
tol76 = L76GNSS.L76GNSS(py, timeout=30)
-
I also tried to execute this code and it gives me an error.
but I do not know what it means?code: prueba1.py
-
@livius
First thank you again, but I put your patience to the test again.I have managed to upload the libraries that L76GNSS.py and pytrack.py in their respective directory. That has already cost me a lot since I did not let myself use the shutil library.
Anyway, having done this, I tried some example codes to connect with the GPS and now it gives me a memory error.
This is the executed file: https://github.com/inmcm/micropyGPS/blob/master/micropyGPS.py(/assets/uploads/files/1516035348953-3.png)
-
@zceld said in Lopy with pytrack, how connect/use GPS?:
the problem is that I do not know how it is done or something fails me. Because for example when I run this:
Have a look in the example:
you have to get an instance of the libraries object and initilaize it.
The timer is mportant, so if you ask for a coordinate and you are at a place where you cannot receive signals, your program continous.py = Pytrack() l76 = L76GNSS(py, timeout=30) chrono = Timer.Chrono() chrono.start()
Than you simply call this function
coord = l76.coordinates()
which returns a tupel with the coordinate. If you get not enough signals inbetween 30 seconds it will return (null, null). So at best you go outside on a sunny day on an iopen field or you place the pytrack at a window and hope for the best.
Sometimes it fails on a LoPy. The example (the library is an example as well) do a lot of string manipulation which uses a lot of RAM. The LoPy has not much of it. So you will run every now and than in an out of memory problem. So either you look into the library how you communicate with the GNSS chip and write your own library, or you reduce the string size used in the library. I think @livius dicovered the string length which will work. LoPys will have around 30-64kB free RAM after booting with the pytrack library. Newer versions with 3MB shall not run into this problem during boot.
But all this is wild guessing. Please provide us more details about the failures ;)
-
@zceld
Did you copy all files also from lib folder into lib folder on your lopy flash?
https://github.com/pycom/pycom-libraries/tree/master/pytrack/lib
structure on flash should be:/flash main.py /lib L76GNSS.py LIS2HH12.py pytrack.py
-
Thank you very much for your quick response. The links that you have passed me, I had seen and tested them. I already updated the firmware, the problem is that I do not know how it is done or something fails me. Because for example when I run this:
https://github.com/pycom/pycom-libraries/blob/master/pytrack/main.py
Line 10 already gives me failure to import that library
-
@zceld
here you have examples
https://github.com/pycom/pycom-libraries
especially:
https://github.com/pycom/pycom-libraries/tree/master/pytrackbut first you must update firmware of pytrak board:
https://forum.pycom.io/topic/2286/new-firmware-release-for-pytrack-and-pysense-version-0-0-8/12and also update firmware of Lopy:
https://pycom.io/downloads/#firmware-upgrades