Skip to main content

A library for the MAVLink protocol

Project description

Libmav Python

Native python bindings for the libmav library. libmav-python is a runtime defined low-level MAVLink library.

In comparison to other python MAVLink libaries, it has certain advantages:

  • Runtime defined message set. No need to recompile on message set change or custom messages
  • Implemented in C++. Much faster than pure python
  • Simple, pythonic API. No need to learn a new API or asyncio, just use python

Installation

pip install libmav

Example usage

import libmav

# Create a message set from a mavlink xml file
message_set = libmav.MessageSet('<PATH TO common.xml>')
# You can also add additional messages here with inline xml
message_set.add_from_xml_string('''
<mavlink>
    <messages>
        <message>
            ...
        </message>
    </messages>
</mavlink>''')

# Create a message from the message set
message = message_set.create('MY_PROTOCOL_MESSAGE')

# Set fields of the message individually
message['my_numeric_field'] = 1
message['my_char_array_field'] = 'Hello world'
message['my_float_array_field'] = [1.0, 2.0, 3.0]
message['my_int_array_field'] = [4, 5, 6]

# Get fields individually
my_num = message['my_numeric_field']
my_string = message['my_char_array_field']
my_float_array_field = message['my_float_array_field']

# You can also use pythonic things like list comprehensions
    # This creates a list of all the values in my_float_array_field multiplied by 2
my_float_array_field = [x * 2 for x in message['my_float_array_field']]

# Set fields from a dict
message.set_from_dict({
            'my_numeric_field': 1,
            'my_char_array_field': 'Hello world',
            'my_float_array_field': [1.0, 2.0, 3.0],
            'my_int_array_field': [4, 5, 6]
        })


# Get fields as python dict
message_dict = message.to_dict()


# Connect to a TCP server
conn_physical = libmav.TCPClient('192.168.1.12', 14550)
conn_runtime = libmav.NetworkRuntime(self.message_set, heartbeat, conn_physical)

connection = conn_runtime.await_connection(2000)

# Check if connection is still alive
if not connection.alive():
    print('Connection lost, waiting for reconnect...')
    connection = conn_runtime.await_connection(2000)

# Send a message
connection.send(message)

# Receive a message, timeout 1s
received_message = connection.receive("HEARTBEAT", 1000)

# Receive a message, no timeout
received_message = connection.receive("HEARTBEAT")

# Receive a message as the result of a message we send
# This avoids the race condition between us sending and then waiting for reception
expectation = connection.expect("PARAM_VALUE")
connection.send(our_param_request_message)
received_message = connection.receive(expectation, 1000)


# Connect to a Serial port
conn_physical = libmav.Serial('/dev/ttyUSB0')
conn_runtime = libmav.NetworkRuntime(self.message_set, heartbeat, conn_physical)

⚠️ Note: The network runtime object and the physical interface object must be kept scope for the duration of the connection. Otherwise, the connection will not have a valid underlying network and will crash.

Install from source

Prerequisites

  • A compiler with C++11 support
  • Pip 10+ or CMake >= 3.4 (or 3.14+ on Windows, which was the first version to support VS 2019)
  • Ninja or Pip 10+

Just clone this repository and pip install. Note the --recursive option which is needed for the pybind11 submodule:

git clone --recursive https://github.com/Auterion/libmav-python.git
pip install ./libmav-python

With the setup.py file included in this project, the pip install command will invoke CMake and build the pybind11 module as specified in CMakeLists.txt.

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

libmav-0.1.0.tar.gz (366.3 kB view details)

Uploaded Source

Built Distributions

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

libmav-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl (300.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

libmav-0.1.0-cp312-cp312-manylinux_2_28_aarch64.whl (272.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

libmav-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (188.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

libmav-0.1.0-cp312-cp312-macosx_10_15_universal2.whl (397.6 kB view details)

Uploaded CPython 3.12macOS 10.15+ universal2 (ARM64, x86-64)

libmav-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl (299.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

libmav-0.1.0-cp311-cp311-manylinux_2_28_aarch64.whl (270.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

libmav-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (188.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

libmav-0.1.0-cp311-cp311-macosx_10_15_universal2.whl (395.6 kB view details)

Uploaded CPython 3.11macOS 10.15+ universal2 (ARM64, x86-64)

libmav-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl (298.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

libmav-0.1.0-cp310-cp310-manylinux_2_28_aarch64.whl (269.1 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

libmav-0.1.0-cp310-cp310-macosx_11_0_arm64.whl (188.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

libmav-0.1.0-cp310-cp310-macosx_10_15_universal2.whl (393.0 kB view details)

Uploaded CPython 3.10macOS 10.15+ universal2 (ARM64, x86-64)

libmav-0.1.0-cp39-cp39-manylinux_2_28_x86_64.whl (297.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

libmav-0.1.0-cp39-cp39-manylinux_2_28_aarch64.whl (269.7 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ ARM64

libmav-0.1.0-cp39-cp39-macosx_11_0_arm64.whl (188.0 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

libmav-0.1.0-cp39-cp39-macosx_10_15_universal2.whl (393.2 kB view details)

Uploaded CPython 3.9macOS 10.15+ universal2 (ARM64, x86-64)

libmav-0.1.0-cp38-cp38-manylinux_2_28_x86_64.whl (296.8 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.28+ x86-64

libmav-0.1.0-cp38-cp38-manylinux_2_28_aarch64.whl (268.6 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.28+ ARM64

libmav-0.1.0-cp38-cp38-macosx_11_0_arm64.whl (187.5 kB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

libmav-0.1.0-cp38-cp38-macosx_10_15_universal2.whl (392.3 kB view details)

Uploaded CPython 3.8macOS 10.15+ universal2 (ARM64, x86-64)

File details

Details for the file libmav-0.1.0.tar.gz.

File metadata

  • Download URL: libmav-0.1.0.tar.gz
  • Upload date:
  • Size: 366.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for libmav-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e12d4207bad8bbd2bc7eafa1edc716d9cefa1b159a0b4611f30fce47b0439e06
MD5 b00a8c50c02d416ba9de5f76b49ea028
BLAKE2b-256 de06092dae24655b6384357802018f229121bd392b4ea553a406f05df24149a2

See more details on using hashes here.

File details

Details for the file libmav-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for libmav-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 830e6a89f3852edb0860744373bf227f4a212d2e79ec15b90367eeabb38da3c4
MD5 7ccdcd94740bacb4c28109b96632aafd
BLAKE2b-256 8f9a7e606390a8fed72c2ac6621a39010651384c05f1db499413b1e1f2594337

See more details on using hashes here.

File details

Details for the file libmav-0.1.0-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for libmav-0.1.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8e729f4074b417a538b294989377eb245268090eb0c7455199d4cb9b13ed5feb
MD5 dcb331317cc1b476f0cde5ee979cdca1
BLAKE2b-256 377af06a61a9e1578cdf3d53cf5569264b10286d23f0fb7366b71cff3316ef38

See more details on using hashes here.

File details

Details for the file libmav-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for libmav-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6318ba4d3b9d37f1c844682cabe6a76f3d25cb6e50a091488df99423b2a26241
MD5 e3c776e15fe77fe556c975f772665866
BLAKE2b-256 c269b856c5d67452e3dd4a1eae8e8ab6e75bfdd4507293b7a56d10ee1bfcdd7b

See more details on using hashes here.

File details

Details for the file libmav-0.1.0-cp312-cp312-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for libmav-0.1.0-cp312-cp312-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 aa36e500dcb6ccdb21b65bd7e7c4900015f12817b2d588e5e252fa5609755718
MD5 7cdf0e79329581ce126afda04e288f98
BLAKE2b-256 35991c2f049b37e5f23b2bffca24dc8723ebc6726cb5db2747e8954093081302

See more details on using hashes here.

File details

Details for the file libmav-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for libmav-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9365f77ae2be3153e6a3ba66295c0ad152cf592aaeaf687b4dffd29b0f158fab
MD5 d05b6119263cac3df202b6dc665b64c1
BLAKE2b-256 3816ad61e5ca8d1f57e434b5704323c306e2ebc2dd8024ed308e085890bfba14

See more details on using hashes here.

File details

Details for the file libmav-0.1.0-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for libmav-0.1.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 63496f7df74f72cfd7f360bf0693c76dffece263795e54924d7eeecd05591e28
MD5 05c99d698796b1785ed1d4bd7526ed34
BLAKE2b-256 4850d56e601ed549998dda5cbb79a5fafe198aa3bbb225a40a799f702ba7d744

See more details on using hashes here.

File details

Details for the file libmav-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for libmav-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6f4cccc00b2166b6947d86b0c04fd625731ca3ea5a54cd5b892087cd2325141e
MD5 a05e7c459be7b2ffa09662b38c374117
BLAKE2b-256 147131769d06dc4d9ba3a816b825a4ffed9ffe13721232a682c86e1ec6e61f7f

See more details on using hashes here.

File details

Details for the file libmav-0.1.0-cp311-cp311-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for libmav-0.1.0-cp311-cp311-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 2762f286fd6253dfa7f9e0c3c97cbff6bf648e7ed0bf2580302d38fec688ec95
MD5 5d9479e7eafc44d959808ea491094ca1
BLAKE2b-256 36c6edc137558fd688b0360e330ef37616d1ef38e07134102012461dc987727c

See more details on using hashes here.

File details

Details for the file libmav-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for libmav-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 61ff0ec41d5dd92cfd5a2449dd3b3ee08a23c80f3e73a484cf2adb99770d5de3
MD5 014f28fffd2ae5fba095fbdbdab18c9a
BLAKE2b-256 4f840fff0f2f83de86b0956539affe66f49844e67baa08e18cb56beebee3598d

See more details on using hashes here.

File details

Details for the file libmav-0.1.0-cp310-cp310-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for libmav-0.1.0-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d5ed039cd8ddd3559f72be36266460ed7f334d81467bffdea343a404ebc912dd
MD5 9dbd0ccadb75cedbe7217e886a8f3789
BLAKE2b-256 daa19f1b760692e6aa41de0382c2a550682c45c98d3e01ea1c79bbb3d45ed303

See more details on using hashes here.

File details

Details for the file libmav-0.1.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for libmav-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0c47c711b408cc937a3470716371c00d9e93bdd9ae0711f12f15a9bc2d400b14
MD5 aec4783067a1d0736b18a772139d0ff1
BLAKE2b-256 87ecfceff5dcbece87778f818f6f3af6d9fb9965a8e4a35f40c1cb7abefa8be5

See more details on using hashes here.

File details

Details for the file libmav-0.1.0-cp310-cp310-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for libmav-0.1.0-cp310-cp310-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 730e93be92de2b5313119c066530f766041b50f2a63ee89ce6dab8e3ac4d1f61
MD5 33e688880a8c3e6df9b6d82fc4bdfbb2
BLAKE2b-256 ae6392bbbb4afaed4d294314ec54303a68053a9e91f42dd5c8529de6b0ac23be

See more details on using hashes here.

File details

Details for the file libmav-0.1.0-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for libmav-0.1.0-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f8c5693fc11434ec42e6e7ab2e7ba97401ef34ea7a90913ec640f7fa3a501af3
MD5 1e531726cdebe826664ca01873e757c8
BLAKE2b-256 b3d804ba61e89195feadf3b2bb72fef1df4b25aa1d0cfad4a64583a56933ed42

See more details on using hashes here.

File details

Details for the file libmav-0.1.0-cp39-cp39-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for libmav-0.1.0-cp39-cp39-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f970a31f54191ed602ed219311aa27b83e689d17dca7ff4594615962af77b475
MD5 9a6cf684588cfa38be7f41c1eace889d
BLAKE2b-256 0a8b01af6729637f3f9698e53fb4dfbb5669c591209b55f7fa18ce8bf6be37b9

See more details on using hashes here.

File details

Details for the file libmav-0.1.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for libmav-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c09cbbaa867a9d75c85cb2ae524264b4564dddf9d82ac7cae5ec97606c730d1a
MD5 be848ecf214a447cf8c809c3fd94d461
BLAKE2b-256 0749b72fd02a491cf52bb24784bc87187c9377b57e33d1a9f72d402fb9ec4186

See more details on using hashes here.

File details

Details for the file libmav-0.1.0-cp39-cp39-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for libmav-0.1.0-cp39-cp39-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 2a31b2f9992665bad52295c27935095d2b59a7493e6f5550fe5ffbef35fcb7ed
MD5 4c0a4de6307d46f2a1256e8623e5625c
BLAKE2b-256 7d2cae89dc1ca2da27b83a3e1551398511112ff9cce413708758b4f8ef560c38

See more details on using hashes here.

File details

Details for the file libmav-0.1.0-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for libmav-0.1.0-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ee191060f4a636acde323e47cc4e86d3e40b893ad387423050492d1b05a778db
MD5 fd312dc084c70fca9c4a946ada2b2ede
BLAKE2b-256 d73b7f2af39565be16eb19e1937d174efe6899807ec26c204096dd4151d60c7e

See more details on using hashes here.

File details

Details for the file libmav-0.1.0-cp38-cp38-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for libmav-0.1.0-cp38-cp38-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 923e822655ef04a37814cd7c8b754cfbe1098836cd6cf32264c64420089c724b
MD5 ce4f1f02d4fc9884953b875b22c55774
BLAKE2b-256 605d511703a1cd16591d6960bf96e1ab051c8280f53f3b15c76317d766b5efcc

See more details on using hashes here.

File details

Details for the file libmav-0.1.0-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for libmav-0.1.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6b6597aeb0e378623878f5343458aa7cd0bc17cf6c821503135fce01b7b20955
MD5 e5faf86b090215aedb094bf439fab7e0
BLAKE2b-256 478dcf67c5ff6e96e73693f4ed5aa4f2cda427a5f67a928f2b255ee1db69acb4

See more details on using hashes here.

File details

Details for the file libmav-0.1.0-cp38-cp38-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for libmav-0.1.0-cp38-cp38-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 0929e1f99d7b332894c563d8c1b9bd6746fa4845f889b377dbaa08e8f6ab10c1
MD5 3e4a780ff9d3a1acb776ed55a6091693
BLAKE2b-256 9636264f772e8daacec9df863a0e15d26ad73742aaa6768ac7fb8f8d374bc881

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