Python wrapper for MAVSDK
Project description
# MAVSDK-Python
[![Build Status](https://travis-ci.org/mavlink/MAVSDK-Python.svg?branch=master)](https://travis-ci.org/mavlink/MAVSDK-Python)
This is the Python wrapper for MAVSDK.
The Python wrapper is based on a gRPC client communicating with the gRPC server written in C++. To use the Python wrapper the gRPC server called “backend” needs to be running on the same system. The wrapper is essentially auto-generated from the message definitions ([proto files](https://github.com/mavlink/MAVSDK-Proto)).
## Important Notes
Python 3.6+ is required (because the wrapper is based on [asyncio](https://docs.python.org/3.7/library/asyncio.html)).
You may need to run pip3 instead of pip and python3 instead of python, depending of your system defaults.
Auterion has a [Getting started with MAVSDK-Python] (https://auterion.com/getting-started-with-mavsdk-python/) guide if you’re a beginner and not sure where to start.
## Install using pip from PyPy
To install mavsdk-python, simply run:
`sh pip3 install mavsdk `
The package contains mavsdk_server already (previously called “backend”). It needs to be run manually with start_mavlink(). Have a look at the examples to see it used in practice.
## Run the examples
Once the package has been installed, the examples can be run:
` examples/takeoff_and_land.py `
## Build and run from sources
Note: this is more involved and targetted to contributors.
### Get the Python wrapper
Clone this repo and recursively update submodules:
` git clone https://github.com/mavlink/MAVSDK-Python --recursive cd MAVSDK-Python `
### Install prerequisites
First install the protoc plugin (protoc-gen-dcsdk):
` cd proto/pb_plugins pip3 install -r requirements.txt pip3 install -e . `
You can check that the plugin was installed with $ which protoc-gen-dcsdk, as it should now be in the PATH.
Then go back to the root of the repo and install the dependencies of the SDK:
` cd ../.. pip3 install -r requirements.txt -r requirements-dev.txt `
### Generate wrapper
Run the following helper script. It will generate the Python wrappers for each plugin. If the submodules are not initialized already, the script will take care of it.
` ./other/tools/run_protoc.sh `
### Install the package locally
After generating the wrapper you can install a development (editable) version of the package using:
` pip3 install -e . `
### Build mavsdk_server
MAVDSK-Python runs the mavsdk_server when start_mavlink() is called. Under the hood, this will run mavsdk/bin/mavsdk_server, which has to be built separately from [MAVSDK](https://github.com/mavlink/MAVSDK) and copied there.
For more help on this step, check the [docs on how to build from source](https://mavsdk.mavlink.io/develop/en/contributing/build.html).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for mavsdk-0.5.4-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7bc9a7d4f3898ac280c0c13602c2865fc6ff6e5662c1fab6e7024b8a8cf78a6a |
|
MD5 | 622e7487761602d4d2fcc558d3ba47a4 |
|
BLAKE2b-256 | 97e51bc96a618cf62bae48d1f8d5205cb7b54691fa3da63b23b23d6e5bee0325 |
Hashes for mavsdk-0.5.4-py3-none-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ffb2bbece76844e62626e016bd7f516731ff64909ef1bf5d365201e2181a28a |
|
MD5 | 6f9ab940189b3b6430f0cde04b9f136c |
|
BLAKE2b-256 | 124c513e86552e67203a708aa59c21cda8231b1ba7c690978314a526f4d9aa4d |
Hashes for mavsdk-0.5.4-py3-none-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c379d231df5de017b69b183953f624e8c10a7e1a7e621de2e15226e05e2c942 |
|
MD5 | a9eb12834b331d46a253c93e9ae3238e |
|
BLAKE2b-256 | da04a400c271d9aceb1e03af8c771182b3807a3c2e8d19b0c836b0c62b8b40e8 |