USGlobalSat GPS Forums

Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: PyDG200 - Linux utility  (Read 2456 times)

Aurel07

  • Guest
PyDG200 - Linux utility
« on: November 24, 2011, 09:48:22 am »

Thanks to the communication specifications, I managed to write a little utility to use the DG-200 on linux. It simply allows to read and change the configuration of the device, list tracks and download them as gpx files (whose names are the date and time of the first point).

It's here: http://www.coillet.eu/PyDG200/PyDG200-1.0.tar.bz2

It requires python 2 (I'm working on a python 3 version), python-gobject and its dependencies (whole gtk stuff) and python-pyserial. Each one of them is generally available on recent GNU/Linux distributions. PyDG200 was tested on ubuntu 11.4, ubuntu 11.9 and Archlinux. For the latter, and for distributions that link python to python3, you will have to edit the first line of the python file to:
Code: [Select]
#! /usr/bin/env python2



To run it, give PyDG200.py execution rights and launch it.

It has NOT been extensively tested, and I suppose there is a lot of bugs. Please report them to me for correction. I'm especially unsure of how to handle "negative" longitude and latitude (ie South and East).

And finally, a big thanks to the USGlobalSat team for their openness, and for allowing me to use my DG-200 on linux.

Edit: the Python 3 version is here: http://www.coillet.eu/PyDG200/Py3DG200-1.0.tar.bz2
« Last Edit: November 25, 2011, 03:48:11 am by Aurel07 »
Logged

GS_TECH01

  • Administrator
  • Hero Member
  • *****
  • Karma: 5
  • Offline Offline
  • Posts: 1755
Re: PyDG200 - Linux utility
« Reply #1 on: November 28, 2011, 05:27:25 pm »

Thanks for sharing the application! Let me go ahead and test this. Will keep you posted for any updates.
Logged

GS_TECH01

  • Administrator
  • Hero Member
  • *****
  • Karma: 5
  • Offline Offline
  • Posts: 1755
Re: PyDG200 - Linux utility
« Reply #2 on: December 09, 2011, 08:02:52 pm »

Hello Aurel07,

Do you have any procedures on how to install Python to Linux Ubuntu? As of now, we are still in the process of updating our Linux system. If you could include a set of instructions or a step-by-step procedures, we would greatly appreciate it. Thanks.
Logged

Aurel07

  • Guest
Re: PyDG200 - Linux utility
« Reply #3 on: December 12, 2011, 09:25:41 am »

Hello,

For global help on Ubuntu, I would recommend the ubuntu help site, and especially for this case, this page:
https://help.ubuntu.com/community/InstallingSoftware

For installing python and all the stuff necessary for PyDG200, a
Code: [Select]
sudo apt-get install python python-gobject python-serial should be enough (if you're friendly with the console). If you prefer a graphical interface, search for synaptics or ubuntu software center in the Unity panel, and then, look for the adequate packages (python, python-gobject and python-serial) and install them.

After that, I would recommend to use the console to launch my software, since it's probably not bug-free. After uncompressing the archive in a given folder, open a terminal and go there (cd /appropriate/path, for example cd /home/user/Downloads/PyDG200), then run
Code: [Select]
./PyDG200.py. You might have to give it execution permissions with
Code: [Select]
chmod +x PyDG200.py and try again. A window should now appear, and if it's not the case, the terminal should print a bunch of interesting things about why nothing worked. That would help me a lot to understand the bugs :)

Hope it helps...
« Last Edit: December 12, 2011, 09:28:51 am by Aurel07 »
Logged

GS_TECH01

  • Administrator
  • Hero Member
  • *****
  • Karma: 5
  • Offline Offline
  • Posts: 1755
Re: PyDG200 - Linux utility
« Reply #4 on: December 12, 2011, 07:21:35 pm »

Thank you for the detailed instructions and references. I was able to successfully run the first version of the Python program. The basic functions seems to work fine, but will test it further to check for any bugs.

Regarding the negative values for the latitude and longtitude, are you seeing it in the .gpx format? Or, in another file format? Can you please provide the file so I could take a look at it?

On the other hand, I'm getting an error when I try to run the Python 3 version. Please see the error message below:


Am I missing some step? Or, is there an error in the command? Please advise.

Let me know if you need more info. Thanks.
Logged

Aurel07

  • Guest
Re: PyDG200 - Linux utility
« Reply #5 on: December 13, 2011, 04:51:36 am »

Thanks for your testing! I'm glad the first version works correctly.

Regarding the python 3 version, I forgot to mention that you will also need python3-serial (it's written in the accompnying files, however). It's the equivalent of python-serial for python3. This shows that I should learn how to make a real package, at least for Ubuntu.

For the negative values, my problem is to convert the 4 bytes value returned by the device into a signed integer (it's not a file problem actually). In my program, I check if it's superior to 0x80000000 and then it's positive, and else it's negative, but I'm not sure it's the good way. I can't quite test this since I'm on the north hemispher and eastern to Greenwich meridian (hence I only got positive values).
 
Since we are looking at the problems, whenever I download a track from the device the led switches off and I have to reboot it blindly to get it to switch on again. However, it still is responsive (I can download another track, get the configuration, or set the configuration). So it's not that important, just cosmetics.
Logged

GS_TECH01

  • Administrator
  • Hero Member
  • *****
  • Karma: 5
  • Offline Offline
  • Posts: 1755
Re: PyDG200 - Linux utility
« Reply #6 on: December 14, 2011, 06:11:11 pm »

Can you please provide the site where I can get the python3-serial? I tried to find it online, but to no avail.

Regarding the negative values, per our engineers, it is normal to utilize the negative symbol (-) to represent the West and South. Is it alright if you can provide the code for converting these values? You can send it via email if you prefer that way.

When you try to acquire the logs from the device, it will go to the DataLogging/SetUp mode. As you have explained, you can only download tracks, get the configuration settings, set the config settings and even delete the tracks. Also, the LEDs would turn off in this mode. Hope that helps.
Logged

Aurel07

  • Guest
Re: PyDG200 - Linux utility
« Reply #7 on: December 16, 2011, 08:57:19 am »

python3-serial is available in the universe repository. To enable it, go in the Ubuntu software center, and clic on "Software sources" in the edit menu. Here, just check the "universe" (community-maintained open source software) button, close this dialog, wait a bit and it should now be available in the software center. If it does not work, please refer to this page https://help.ubuntu.com/community/Repositories/Ubuntu. In a more general sense, on linux you (almost) never download unknown things from web servers, everything should be available through the software manager, using the adequate repositories.

For the negative coordinates, here is the code I use:

Code: [Select]
#raw latitude data is raw_point[0:4]
if bytes2int(raw_point[0]) > 8: # then it's negative <-- (that's the part I'm unsure)
    mega_latitude = bytes2int(raw_point[:4]) - 2**32 # gives the latitude in dddmmmmmm
    latitude = float(str(mega_latitude)[:-6]) - float(str(mega_latitude)[-6:])/600000
else:
    mega_latitude = bytes2int(raw_point[:4])
    latitude = float(str(mega_latitude)[:-6]) + float(str(mega_latitude)[-6:])/600000

For the led, I see it switch off when I get the configuration, but it switch back on just after this. After a download however, it stays off, and only a reboot of the device get it back to one. Not sure I'm clear enough, though...
Logged

GS_TECH01

  • Administrator
  • Hero Member
  • *****
  • Karma: 5
  • Offline Offline
  • Posts: 1755
Re: PyDG200 - Linux utility
« Reply #8 on: December 16, 2011, 05:09:13 pm »

Thanks for the detailed procedures. I was able to download the python3-serial successfully by following your instructions. However, I ran into another error after that. It seems like that it's missing the gobject or something to that effect. Then, I remembered that you suggested to download one of these files for the first version of the program: python-gobject. I went back to the Ubuntu Software Center and input python3-gobject in the search field. It showed me that file and installed it from there. After that, I was able to run the Py3DG200 successfully.

Thank you for providing the code for the negative values. Let me check with our engineers to see if they have any suggestions.
 
Regarding the status of the LEDs, let me also confirm with our engineers about it.

Moreover, should I be testing the Py3DG200 version and disregard the PyDG200 version? Or, can I utilize both version? Please advise.
Logged

Aurel07

  • Guest
Re: PyDG200 - Linux utility
« Reply #9 on: December 17, 2011, 07:52:51 pm »

Ok, it's great it finally works! Thanks for your help on those problems. Regarding the python version, any of them is fine. On Ubuntu, the python 2 version should be more adapted since it ships with python 2 rather than python 3 and the dependencies are a bit more difficult to find. On some other distribution it is the contrary, so I guess the python 3 version will be more adapted. Archlinux goes with python 3, and I use Py3DG200.
Logged

GS_TECH01

  • Administrator
  • Hero Member
  • *****
  • Karma: 5
  • Offline Offline
  • Posts: 1755
Re: PyDG200 - Linux utility
« Reply #10 on: December 19, 2011, 01:11:44 pm »

Alright, thanks for the info. Just wondering if there's any difference between the two version like how they're setup and utilized. In the meantime, I will follow up with our engineers regarding the status of the LEDs. Will keep you posted.
Logged

GS_TECH01

  • Administrator
  • Hero Member
  • *****
  • Karma: 5
  • Offline Offline
  • Posts: 1755
Re: PyDG200 - Linux utility
« Reply #11 on: December 20, 2011, 12:38:26 pm »

Regarding the negative coordinates, per our engineers, the latitude and longitude data are saved in 32-bit data type. Moreover, the positive range is 0x00000000 ~ 0x7fffffff and the negative range is 0x80000000 ~ 0xffffffff. So, if the values are negative, the most significant bit is equal to 1; it is greater or equal to 0x80000000 while in hex bit data type.

As for the LED status, please check your email for more details.
Logged

Aurel07

  • Guest
Re: PyDG200 - Linux utility
« Reply #12 on: December 20, 2011, 04:14:09 pm »

Thanks for your answer. That's what I thought about the negative longitude/latitude values, yet I don't think I coded that very well. Anyway it should be fixed in the next release. Regarding the LED status, it doesn't behave as explained and stay blank after a download. I will investigate a little bit more when I have enough time, and try to fix my software. Anyway, thanks for the info.
Logged

GS_TECH01

  • Administrator
  • Hero Member
  • *****
  • Karma: 5
  • Offline Offline
  • Posts: 1755
Re: PyDG200 - Linux utility
« Reply #13 on: December 21, 2011, 12:16:23 pm »

Understood. Just keep us posted regarding the next release of your application.

As for the LED status, keep us also updated if you were able to duplicate it. We need to know if there's a bug in the firmware or the problem lies with the unit itself.

You're welcome. Feel free to ask us if you have any questions.
Logged

GS_TECH01

  • Administrator
  • Hero Member
  • *****
  • Karma: 5
  • Offline Offline
  • Posts: 1755
Re: PyDG200 - Linux utility
« Reply #14 on: January 24, 2012, 02:35:17 pm »

Thanks for your answer. That's what I thought about the negative longitude/latitude values, yet I don't think I coded that very well. Anyway it should be fixed in the next release. Regarding the LED status, it doesn't behave as explained and stay blank after a download. I will investigate a little bit more when I have enough time, and try to fix my software. Anyway, thanks for the info.

Hello Aurel07,

Any updates regarding the LED status? How did your investigation go? Were you able to fix your software? Please keep us posted.
« Last Edit: January 25, 2012, 12:18:39 pm by USG_TECH10 »
Logged
Pages: [1]   Go Up
 

Page created in 0.262 seconds with 19 queries.