Python wrapper for MAVSDK
Project description
# 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.
## Build and run backend
First, we need to build and run the backend which is the gRPC server that the Python wrapper will connect to.
Note: it is planned to automate this step using package managers like brew, apt-get, etc. .
` git clone https://github.com/mavlink/MAVSDK --recursive cd MAVSDK mkdir -p build/default cd build/default cmake -DBUILD_BACKEND=ON ../.. cmake --build . `
For more help on this step, check the [docs on how to build from source](https://sdk.dronecode.org/en/contributing/build.html).
Once this is built, start PX4 SITL and run the backend:
` ./src/backend/src/backend_bin `
By default, the backend will connect using MAVLink on UDP port 14540 which is running by default when PX4 is run in SITL (software in the loop simulation). Run $ ./src/backend/src/backend_bin –help for more information.
## 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 pip install -r requirements.txt pip 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 ../.. pip 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:
` pip install -e . `
### Running the examples
Once the package has been installed, the examples can be run:
` examples/takeoff_and_land.py `
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.1.0-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d18570d099e030f42f0d0f347f9bc2e815179e2007aa06936138abce4537777 |
|
MD5 | 45d37810354651a6bf53fe407b7c8f9f |
|
BLAKE2b-256 | 54e17a982a0728b54231bb5ce8ceb89dec92d22829d9b047f58e85f34509e72c |
Hashes for mavsdk-0.1.0-py3-none-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1aa15b13a78bf40016082e3842b127cdae5bd875321a5b0ae72bf572608a429e |
|
MD5 | 110b21cec2901cbe9e2b216e560bc101 |
|
BLAKE2b-256 | be552b6321681f72a1fa7f336a4688c206bbb012bdab21ed42ce46db692c9470 |
Hashes for mavsdk-0.1.0-py3-none-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f59cf64e210c1a433b016f555a630d102d7e91f809b0785a6b54651444e78238 |
|
MD5 | 6b21a78cac3e707cd5321572a6d2b346 |
|
BLAKE2b-256 | 62b1dac8a194947b3a3fd1079d4ca87a17b6ae24650009a15689cde6bf92ba0b |