Code Monkey home page Code Monkey logo

pyubx's Issues

*_GET-message types confuse parseUBXPayload

I wrote a simple script trying to query some settings of a receiver. However, after sending (for example) a UBX.CFG.PRT_GET message, the UBXManager fails to parse the response correctly.

I traced this error down already to some extent:
The root cause is that both UBX.CFG.PRT_GET and UBX.CFG.PRT have the same _id. When initMessageClass initially fills the _lookup-dictionary of UBX.CFG, duplicate keys are partially discarded, only the last key-value is stored, leaving only UBX.CFG.PRT_GET in there.

When parseUBXPayload then tries to look up the subclass from the _lookup-dictionary with .get(msgid), only UBX.CFG.PRT_GET is present.

The issue can be worked around by changing the order of PRT and PRT_GET in the source code (same applies for TP5 and TP5_GET, but explicitly excluding _GET-messages from the list of parseable messages might be a better idea.

Interesting side effect: The Exception message wrongly states "Message not fully consumed while parsing a UBX.CFG.TP5_GET!", even though this should read UBX.CFG.PRT_GET. I did not track down what causes this, but it threw me off first while looking for the root cause of the problem.

Test code:

import serial
import time
import UBX
from UBXManager import UBXManager

ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=None)
manager = UBXManager(ser, debug=True)
manager.start()

# query port settings - response triggers bug
time.sleep(1)
prt = UBX.CFG.PRT_GET(b'\x01')
manager.send(prt.serialize())

Code is not packaged as a module

The code is not packaged as a module. (See the packaging guide. Ideally I would be able to do something like:

(bash)$ pip install /path/to/pyUBX
(bash)$ python
>>> import pyUBX
>>> manager = pyUBX.UBXManager(serial_port)

and so on. This lets you use the code with other software (such as a snazzy map display).

Instead, the M.O. of using it seems to be to cd into the pyUBX directory before running python, which makes it hard to integrate.

I will be tackling this after finishing support for relposNED. Any tripwires I want to avoid to keep compatible with your use cases? (Or objections to me doing this? It will involve moving directories around.)

Thanks.

Python3.4.x compatibility

Hi! I'm currently using an UDOO Neo with python 3.4.3
I cloned your pyUBX but python3 setup.py install fails at:

byte-compiling build/bdist.linux-armv7l/egg/ubx/UBX/ESF.py to ESF.cpython-34.pyc
  File "build/bdist.linux-armv7l/egg/ubx/UBX/ESF.py", line 37
    datas = (self.__getattribute__(f'data_{idx}') for idx in range(1, self.numMeas+1))
                                               ^
SyntaxError: invalid syntax

Thank you!

Problem when starting UBX Manager

Hello,

I'm trying to setup my device with the following code:

import serial from UBXManager import UBXManager ser = serial.Serial('COM4', 115200, timeout=None) manager = UBXManager(ser, debug=True) manager.start()

I'm getting the following error:
Traceback (most recent call last): File "c:/projects/pyUBX/start.py", line 4, in <module> manager = UBXManager(ser, debug=True) File "c:\projects\pyUBX\UBXManager.py", line 28, in __init__ from UBXMessage import UBXMessage File "c:\projects\pyUBX\UBXMessage.py", line 9, in <module> import UBX File "c:\projects\pyUBX\UBX\__init__.py", line 1, in <module> from UBX.ACK import * File "c:\projects\pyUBX\UBX\ACK.py", line 3, in <module> from UBXMessage import initMessageClass, addGet ImportError: cannot import name 'initMessageClass' from 'UBXMessage' (c:\projects\pyUBX\UBXMessage.py)

Do you have any ideas how to fix it?

Thank you for your work!

BR Michael

Improve logging

currently when debug=1 stuff will be dumped to UBX.log. In any case too much is printed to stdout.
Better use a framework such as logging.

Parsing .UBX files

I have created a ubx file by using u-center with ZED-F9P.

I just want to extract information from .ubx file created by u-center.

Am I able to do that with this repo?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.