ubxtranslator 
Overview
This module provides a simple way to decode messages from uBlox GPS devices in the UBX format.
Like the high accuracy NEO-M8U module that I have created,
click here for more info.
This package has no dependencies! This is written in pure python using only the standard lib and supports any
standard byte stream. The predefined messages are not added to the parser by default, this allows
you to have tight control over what messages can be parsed.
Is this the fastest implementation of a UBX parser? Probably not. If speed is critical then you probably need to go write something in C. If you want something that is fast enough and easy to use, you are in the right place. Keep reading.
Supports Python 3.5 and up.
Quickstart
Install the package with pip
pip install ubxtranslator
Import the core module
from ubxtranslator import core
If the message class you want has already been defined, just import it.
If not you will need to construct the messages and classes yourself, see the examples for more information.
from ubxtranslator import predefined
Construct the parser
parser = core.Parser([
predefined.CLS_ACK,
predefined.CLS_NAV
])
Then you can use the parser to decode messages from any byte stream.
cls_name, msg_name, payload = parser.receive_from(port)
The result is a tuple that can be unpacked as shown above.
The variables cls_name and msg_name are strings, i.e. 'NAV', 'PVT'.
The payload is the namedtuple of the message and can be accessed like an object. The attributes share the names of the fields.
print(cls_name, msg_name, payload.lat, payload.lng)
Bitfields are also returned as namedtuples and can be accessed the same way.
print(payload.flags.channel)
Repeated Blocks are returned as a list of blocks, the fields within each block are also named tuples.
All of the repeated blocks in the predefined messages are name RB.
for i in range(len(payload.RB)):
print(payload.RB[i].gnssId, payload.RB[i].flags.health)
The best way to look at what fields are available is where the fields are defined. However, if you want to inspect on the fly you can either help(payload) and look at the attributes, or use the named tuple protected method payload._asdict() which will return an ordered dict of all of the attributes.
Examples
For full examples see the examples directory.
TODO's
Want to contribute? Please feel free to submit issues or pull requests. Nothing in this package is very complicated, please have a crack and help me to improve this.
- Add more and better tests
- Add Field type RU1_3
Metadata
Release files for ubxtranslator 0.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ubxtranslator-0.2.6.tar.gz | 25.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ubxtranslator-0.2.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 49.4 kB
Release files / ubxtranslator-0.2.6.tar.gz
| Download URL | ubxtranslator-0.2.6.tar.gz |
|---|---|
| Size | 25.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
82a50c199e0b8bf1e26451a7404abd51ba0eae1f0111a5b22ab3182d08b7b910
|
|
BLAKE2b-256 checksum How to use checksums |
397c8ce8b99f7592752c3e711d6c16736d800e2116980aa1cd3f0d739479cda5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Release files / ubxtranslator-0.2.6-py3-none-any.whl
| Download URL | ubxtranslator-0.2.6-py3-none-any.whl |
|---|---|
| Size | 24.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4c54401b4a6fb0983dc16938377c334fd5e8a3c9d12fc4d156e46963024e3431
|
|
BLAKE2b-256 checksum How to use checksums |
b4bf156b4cf45b8eaa70c6a81913706e564d69fdbbefd58ce919cba470367d76
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Security for ubxtranslator 0.2.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.