Skip to main content

Python bindings of the IMC message schema

Project description

PyIMCLSTS

This tool reads the IMC schema from a XML file, locally creates files containing the messages and connects (imports) the main global machinery.

See /example to check an example implementation of the Follow Reference maneuver.

Quickstart

  • Fancying a virtual env? (Not needed. Just in case you want to isolate it from your python setup)
$ sudo apt install python3.8-venv
$ python3 -m venv tutorial_env
$ source tutorial_env/bin/activate
  • To use:
$ pip3 install pyimclsts
$ # or, if you are cloning the repo, from the folder pyproject.toml is located:
$ pip3 install .
$ # If already installed, update it, with (might need to run it more than once):
$ pip3 install -U pyimclsts
  • Choose a folder and have a version of the IMC schema. Otherwise, the following command will fetch the latest IMC version from the LSTS git repository. Extract messages locally, with:
$ python3 -m pyimclsts.extract

Check how to provide a black- or whitelist using:

$ python3 -m pyimclsts.extract --help

This is unnecessary in most scenarios, but can be useful if you really have constrained resources. Use it with caution, because it may crash if, for example, you receive an inlined message that has been blacklisted.

This will locally extract the IMC.xml as python classes. You will see a folder called pyimc_generated which contains base messages, bitfields and enumerations from the IMC.xml file. They can be locally loaded using, for example:

import pyimc_generated as pg

In the top-level module, you will find some functions to allow you to connect to a vehicle and subscribe to messages, namely, a subscriber class.

import pyimclsts.network as n

conn = n.tcp_interface('localhost', 6006)
sub = n.subscriber(conn)

# for example:
sub.subscribe_async(myfunction1, msg_id =pg.messages.Temperature, src='lauv-noptilus-1', src_ent='AHRS')
sub.subscribe_async(myfunction2, msg_id =pg.messages.EstimatedState, src='lauv-noptilus-1', src_ent=None)

In most cases, you can find the embedded documentation (docstrings) by hovering the mouse or using help() on interactive mode.

Check /example for further details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyimclsts-0.1.2.1.tar.gz (26.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyimclsts-0.1.2.1-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file pyimclsts-0.1.2.1.tar.gz.

File metadata

  • Download URL: pyimclsts-0.1.2.1.tar.gz
  • Upload date:
  • Size: 26.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for pyimclsts-0.1.2.1.tar.gz
Algorithm Hash digest
SHA256 f7bc72a4819f84e7c343694a95d119a4bfc511e4bf8226a1f0cc37ce04c2ac78
MD5 cab7fcac81ca1a82756ff3d2318cfc06
BLAKE2b-256 fecd279c109cc74d906c3d866b73f780aa6bf4f8c93fc70c8be6a873895e40bd

See more details on using hashes here.

File details

Details for the file pyimclsts-0.1.2.1-py3-none-any.whl.

File metadata

  • Download URL: pyimclsts-0.1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for pyimclsts-0.1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6249337ad0ddec8803688a0e8cd0e42467c83eb233d220aef787019e56af409e
MD5 c39286dfbbe66a9a05f1d7735b5395cb
BLAKE2b-256 2f43cd8c5e0711dddc7ea9d25e73758d7c7c26bb8601df3eb9516e939de9d641

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page