ubxtranslator


Nameubxtranslator JSON
Version 0.2.4 PyPI version JSON
download
home_pagehttp://github.com/dalymople/ubxtranslator
SummaryA lightweight python library for translating UBX packets
upload_time2023-01-25 10:16:46
maintainer
docs_urlNone
authorDalymople
requires_python
licenseGNU GPL v3
keywords
VCS
bugtrack_url
requirements nose2
Travis-CI
coveralls test coverage No coveralls.
            # ubxtranslator [![Build Status](https://travis-ci.org/dalymople/ubxtranslator.svg?branch=master)](https://travis-ci.org/dalymople/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, 
<a href="https://www.tindie.com/products/dalymople/gps-dead-reckoning-board-neo-m8u-compact/">click here for more info.</a><br>
<br>
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<br>
`pip install ubxtranslator`

Import the core module<br>
`from ubxtranslator import core`

If the message class you want has already been defined simply import it. 
If not you will need to construct the messages and classes yourself, see the examples for more information.<br>
`from ubxtranslator import predefined`

Construct the parser<br>
```
parser = core.Parser([
  predefined.CLS_ACK, 
  predefined.CLS_NAV
])
```

Then you can use the parser to decode messages from any byte stream.<br>
`cls_name, msg_name, payload = parser.receive_from(port)`

The result is a tuple which can be unpacked as shown above.<br>
The variables `cls_name` and `msg_name` are strings, ie. `'NAV'`, `'PVT'`.<br>

The payload is the namedtuple of the message and can be accessed like an object. The attributes share the names of the fields.<br>
`print(cls_name, msg_name, payload.lat, payload.lng)`

Bitfields are also returned as namedtuples and can be accessed the same way.<br>
`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`.<br>
```
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 the ability to pack messages into packets for two way communications
- Add more and better tests
- Add Field type RU1_3
- Add async support



            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/dalymople/ubxtranslator",
    "name": "ubxtranslator",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Dalymople",
    "author_email": "dalymople@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c8/ca/b569b5e9953a44b2ee5f18422b27d93b623a32e9ac0e4b5ff6b932d94514/ubxtranslator-0.2.4.tar.gz",
    "platform": null,
    "description": "# ubxtranslator [![Build Status](https://travis-ci.org/dalymople/ubxtranslator.svg?branch=master)](https://travis-ci.org/dalymople/ubxtranslator)\n\n## Overview\nThis module provides a simple way to decode messages from uBlox GPS devices in the UBX format. \nLike the high accuracy NEO-M8U module that I have created, \n<a href=\"https://www.tindie.com/products/dalymople/gps-dead-reckoning-board-neo-m8u-compact/\">click here for more info.</a><br>\n<br>\nThis package has no dependencies! This is written in pure python using only the standard lib and supports any\nstandard byte stream. The predefined messages are not added to the parser by default, this allows\nyou to have tight control over what messages can be parsed.\n\nIs this the fastest implementation of a UBX parser? Probably not. If speed is critical then you \nprobably need to go write something in C. If you want something that is fast enough\nand easy to use, you are in the right place. Keep reading.\n\nSupports Python 3.5 and up.\n\n\n## Quickstart\n\nInstall the package with pip<br>\n`pip install ubxtranslator`\n\nImport the core module<br>\n`from ubxtranslator import core`\n\nIf the message class you want has already been defined simply import it. \nIf not you will need to construct the messages and classes yourself, see the examples for more information.<br>\n`from ubxtranslator import predefined`\n\nConstruct the parser<br>\n```\nparser = core.Parser([\n  predefined.CLS_ACK, \n  predefined.CLS_NAV\n])\n```\n\nThen you can use the parser to decode messages from any byte stream.<br>\n`cls_name, msg_name, payload = parser.receive_from(port)`\n\nThe result is a tuple which can be unpacked as shown above.<br>\nThe variables `cls_name` and `msg_name` are strings, ie. `'NAV'`, `'PVT'`.<br>\n\nThe payload is the namedtuple of the message and can be accessed like an object. The attributes share the names of the fields.<br>\n`print(cls_name, msg_name, payload.lat, payload.lng)`\n\nBitfields are also returned as namedtuples and can be accessed the same way.<br>\n`print(payload.flags.channel)`\n\nRepeated 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`.<br>\n```\nfor i in range(len(payload.RB)):\n  print(payload.RB[i].gnssId, payload.RB[i].flags.health)\n```\n\nThe 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.\n\n\n## Examples\nFor full examples see the examples directory. \n\n## TODO's\nWant to contribute? Please feel free to submit issues or pull requests. \nNothing in this package is very complicated, please have a crack and help me to improve this.\n\n- Add the ability to pack messages into packets for two way communications\n- Add more and better tests\n- Add Field type RU1_3\n- Add async support\n\n\n",
    "bugtrack_url": null,
    "license": "GNU GPL v3",
    "summary": "A lightweight python library for translating UBX packets",
    "version": "0.2.4",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "46f1955c3463a86b7c1bbebde8a40433fc0d65f6467601fee2b0308870487b8b",
                "md5": "e7088f32760903ba37582046438b77d3",
                "sha256": "5000c479583d6dd89f1ffb65117e8ab92747360ffddd8445f320c81067168032"
            },
            "downloads": -1,
            "filename": "ubxtranslator-0.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e7088f32760903ba37582046438b77d3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 22436,
            "upload_time": "2023-01-25T10:16:44",
            "upload_time_iso_8601": "2023-01-25T10:16:44.740045Z",
            "url": "https://files.pythonhosted.org/packages/46/f1/955c3463a86b7c1bbebde8a40433fc0d65f6467601fee2b0308870487b8b/ubxtranslator-0.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c8cab569b5e9953a44b2ee5f18422b27d93b623a32e9ac0e4b5ff6b932d94514",
                "md5": "ce44d94d2d549f87dfd11ea0e2c6b9f5",
                "sha256": "cbea8892471c56d5598af718a09c689a1de035311b94638e59ccec2b7c90f070"
            },
            "downloads": -1,
            "filename": "ubxtranslator-0.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "ce44d94d2d549f87dfd11ea0e2c6b9f5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 23379,
            "upload_time": "2023-01-25T10:16:46",
            "upload_time_iso_8601": "2023-01-25T10:16:46.087638Z",
            "url": "https://files.pythonhosted.org/packages/c8/ca/b569b5e9953a44b2ee5f18422b27d93b623a32e9ac0e4b5ff6b932d94514/ubxtranslator-0.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-25 10:16:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "dalymople",
    "github_project": "ubxtranslator",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "nose2",
            "specs": [
                [
                    ">=",
                    "0.6.5"
                ]
            ]
        }
    ],
    "lcname": "ubxtranslator"
}
        
Elapsed time: 0.03242s