I checked the script and ran it. I got the same errors as you. According to the errors, the upmUblox6 object doesn't have the attribute "charArray", and the variable "int_B9600" is not specified anywhere. I checked the source code (upm/src/ublox6 at master · intel-iot-devkit/upm · GitHub) and I confirmed it. That is why there are errors when you attempt to run the code.
I would suggest you to try running the C++ example instead, but if you prefer to keep using the Python example, you could try to do some fixes in the example code. I haven't tested it with the GPS module because I don't have it, but I was able to run the Python code with the following modifications:
- The first error is because the variable "int_B9600" is not defined. The method that required this variable is myGPSSensor.setupTty(upmUblox6.cvar.int_B9600). This method is used to set the baudrate of the serial port. According to the source code, the default value is 9600 so you can call the method with no arguments and by default the serial port should be initialized with a baudrate of 9600.
- The second error is because the attribute "charArray" is not defined. If you look what that line does, you will notice that it is used to set a buffer of size 256 to store the data read. I replaced that line by this one: nmeaBuffer = . It doesn't throw any error but I'm not sure if it is going to work with that.
If you do those modifications and try to run the code again, there are not going to be errors, but I don't know if it will work. You can try it and test it with your GPS module. If it doesn't work, my suggestion would be to try with the C++ example version.
Python script: Tried to implement the suggested changes.
#1 change of empty function worked fine.
#2 of charArray works fine, but throws error at line 42: rv = myGPSSensor.readData(nmeaBuffer, bufferLength)
So, Python script does not execute.
C++ Example code: It also does not compile. Throws error messages as follows:
line 95: undefined reference to `upm::Ublox6::~Ublox6()'
line 73: undefined reference to `upm::Ublox6::dataAvailable()'
line 75: undefined reference to `upm::Ublox6::readData(char*, unsigned int)'
line 51: undefined reference to `upm::Ublox6::setupTty(unsigned int)'
line 48: undefined reference to `upm::Ublox6::Ublox6(int)'
Any suggestions ?
Thanks and Regards,
I've answered you through the ticket you sent. Please check my suggestions there, and in case you still have errors post them back here.
Thank you Diego for all your work on this issue. And thank you Vrukesh for bringing this issue up to us!
This module was definitely tested with python.
Unfortunately it appears that one of the files used to build the python module (upm/pyupm_ublox6.i at master · intel-iot-devkit/upm · GitHub) is old.
Updating it will probably fix this issue in future versions of upm. We're working on this.
My apologies, and thank you again!
I am having the same issue. Is there any fix for getting gps data off of this sensor using the edison?
This is a temporary solution:
import mraa u = mraa.Uart(0) u.setBaudRate(9600) print u.getDevicePath() while (True): if(u.dataAvailable()): buff = u.readStr(256) if buff.find("GPGGA") != -1: #this is the easiest to parse smallerbuff = buff[buff.find("GPGGA"): buff.find("\n")] splitbuff = smallerbuff.strip().split(",") #print(splitbuff) latnmea = splitbuff latdir = splitbuff lonnmea = splitbuff londir = splitbuff lat = float(latnmea[0:2]) + float(latnmea[2:])/60 lon = float(lonnmea[0:3]) + float(lonnmea[3:])/60 if londir == "W": lon = lon * -1 alt = float(splitbuff) #does lat need similar work done to it #how do i switch of unused sentences? print("%f,%f") % (lat,lon) print("%f M") % alt@@
I like this workaround!
The new pyupm_ublox6.i file was merged on August 20.
If you have updated mraa/upm source after August 20, you should be able to use the python example with a ublox6 GPS module.
I have the same problem in C++ using VisualGDB. Any fix on this?