Skip to main content

⚠️ This package has been renamed to mavsdk-grpc

This is the last release of the gRPC wrapper under the mavsdk name. That name on PyPI now belongs to the native MAVSDK binding, which has a different API and does not depend on gRPC.

  • To carry on with this API, install mavsdk-grpc and import it as mavsdk_grpc. The code is identical, so import mavsdk_grpc as mavsdk is enough if you would rather not touch anything else. Development continues there, including releases tracking MAVSDK v4. It deliberately installs under a separate import name, so it can never collide with the native binding.
  • To freeze, pin mavsdk<4. This release keeps working, but will not receive any further updates.
  • To move to the native binding, see https://mavsdk.mavlink.io/main/en/python/migration.html.

MAVSDK-Python

GitHub Actions Status

This is the gRPC-based Python wrapper for MAVSDK, published on PyPI as mavsdk-grpc and imported as mavsdk_grpc.

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).

⚠️ Renamed from mavsdk to mavsdk-grpc

This wrapper used to be published as mavsdk. That name on PyPI now refers to the native MAVSDK binding, which has a different API and no gRPC dependency — see the migration guide.

This project carries on under the mavsdk-grpc name, including releases tracking MAVSDK v4. If you were using mavsdk:

  • Install mavsdk-grpc and use import mavsdk_grpc as mavsdk — the code is identical. The separate import name is deliberate, so that the two packages can never overwrite each other's files.
  • Or pin mavsdk<4 to freeze on the last release under the old name, which will not receive further updates.

Important Notes

  • Python 3.7+ is required (because the wrapper is based on asyncio).
  • You may need to run pip3 instead of pip and python3 instead of python, depending of your system defaults.
  • Auterion used to have a Getting started with MAVSDK-Python (web.archive.org) guide if you're a beginner and not sure where to start.

API Reference docs

-> API Reference documentation.

Install using pip from PyPi

Note for Raspberry Pi 1/2 and Zero:

This wrapper requires grpcio. However, there are no binary packets of grpcio for armv6 available via pip (also see files on pypi.org). In this case, install grpcio via the package manager, e.g. sudo apt-get install python3-grpcio.

To install it, simply run:

pip3 install mavsdk-grpc

The package contains mavsdk_server already (previously called "backend"), which is started automatically when connecting (e.g. await drone.connect()). Have a look at the examples to see it used in practice. It will be something like:

from mavsdk_grpc import System

...

drone = System()
await drone.connect(system_address="udpin://0.0.0.0:14540")

Note: System() takes two named parameters: mavsdk_server_address and port. When left empty, they default to None and 50051, respectively, and mavsdk_server -p 50051 is run by await drone.connect(). If mavsdk_server_address is set (e.g. to "localhost"), then await drone.connect() will not start the embedded mavsdk_server and will try to connect to a server running at this address. This is useful for platforms where mavsdk_server does not come embedded, for debugging purposes, and for running mavsdk_server in a place different than where the MAVSDK-Python script is run.

Run the examples

Once the package has been installed, the examples can be run:

examples/takeoff_and_land.py

The examples assume that the embedded mavsdk_server binary can be run. In some cases (e.g. on Raspberry Pi), it may be necessary to run mavsdk_server manually, and therefore to set mavsdk_server_address='localhost' as described above.

Contribute

Note: this is more involved and targeted at contributors.

Most of the code is auto-generated from the proto definitions, using our templates. The generated files can be found in the generated folder. As a result, contributions are generally made in the templates or on the build system. Regularly, there is a need to update MAVSDK-Python to include the latest features defined in the proto definitions. This is described below.

Clone the repo

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-mavsdk):

cd proto/pb_plugins
pip3 install -r requirements.txt

You can check that the plugin was installed with $ which protoc-gen-mavsdk, 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 the code

Run the following helper script. It will generate the Python wrappers for each plugin.

./other/tools/run_protoc.sh

Adding support for new plugins

In case you updated the ./proto submodule to include a new plugin, you will also have to manually edit the file mavsdk/system.py to register the plugin.

Update mavsdk_server version

MAVSDK_SERVER_VERSION contains exactly the tag name of the mavsdk_server release corresponding to the version of MAVSDK-Python. When the proto submodule is updated here, chances are that mavsdk_server should be updated, too. Just edit this file, and the corresponding binary will be downloaded by the setup.py script (see below).

Build and install the package locally

After generating the wrapper and only in ARM architectures with linux, defines a variable MAVSDK_SERVER_ARCH:

export MAVSDK_SERVER_ARCH=<ARM embedded architecture>

Supported architectures: armv6l, armv7l and aarch64. For example for Raspberry Pi it is armv7l, or aarch64 (if a 64 bit distribution is used).

Then you can install a development version of the package, which links the package to the generated code in this local directory. To do so, use:

python3 setup.py build
pip3 install -e .

Note: MAVDSK-Python runs mavsdk/bin/mavsdk_server when await drone.connect() is called. This binary comes from MAVSDK and is downloaded during the setup.py step above.

Generate the API documentation

Make sure the version tag is set correctly before generating new documentation.

pip3 install -r requirements-docs.txt
make -C mavsdk html

Formatting checks before committing

We use the following checks in CI:

pipx run ruff format --check --line-length=100 examples
pipx run ruff check --select=ASYNC,RUF006,E,F --line-length=100 examples
pipx run codespell .

Release steps

  1. Check the proto submodule is up-to-date and the generated code has been updated.
  2. Check all required pull requests are merged to main
  3. Check MAVSDK_SERVER_VERSION is set to the correct version of mavsdk_server.
  4. Create git tag on laster main, e.g.:
    git switch main
    git pull
    git tag X.Y.Z
    git push --tags
    
  5. Go to releases page and create new release. The CI will now:
    • Create and push a wheel for Windows, Linux and macOS to PyPi.
    • Generate the latest docs and push them to s3.

Metadata

Release files for mavsdk 3.17.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for mavsdk 3.17.4
File
mavsdk-3.17.4-py3-none-win_arm64.whl Python 3 none Windows ARM64 Details
mavsdk-3.17.4-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
mavsdk-3.17.4-py3-none-win32.whl Python 3 none Windows x86-32 Details
mavsdk-3.17.4-py3-none-manylinux2014_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details
mavsdk-3.17.4-py3-none-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64, Linux glibc 2.5+ x86-64 Details
mavsdk-3.17.4-py3-none-macosx_14_0_arm64.whl Python 3 none macOS 14.0+ ARM64 Details
mavsdk-3.17.4-py3-none-macosx_13_0_x86_64.whl Python 3 none macOS 13.0+ x86-64 Details
mavsdk-3.17.4-py3-none-linux_armv7l.whl Python 3 none linux armv7l Details
mavsdk-3.17.4-py3-none-linux_armv6l.whl Python 3 none linux armv6l Details

Total release size: 131.3 MB

Release files / mavsdk-3.17.4-py3-none-win_arm64.whl

Download URL mavsdk-3.17.4-py3-none-win_arm64.whl
Size 14.3 MB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
36ed82bc50334df2ef51b84135c12aac52dd13df8a77147f6c12d41cb7615fa6
BLAKE2b-256 checksum
How to use checksums
0b0c6e2d3b23712a1241a8f315d78627b895cf0f5852e7455c5053918ab12205
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / mavsdk-3.17.4-py3-none-win_amd64.whl

Download URL mavsdk-3.17.4-py3-none-win_amd64.whl
Size 14.3 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
708356857d2f245d2026bcada4c3f02debca9464d1d2cd1e69c3d76c666db932
BLAKE2b-256 checksum
How to use checksums
a562b6643cdfeb2bb98b7ec62e2653cfbd3e5fdcc69e227ceecb154e6a3c7b34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / mavsdk-3.17.4-py3-none-win32.whl

Download URL mavsdk-3.17.4-py3-none-win32.whl
Size 12.1 MB
Tags Python 3 Windows x86-32
SHA-256 checksum
How to use checksums
74b43ebbdec23d7e51f7308ef4ccd13a15983a9aacd614765f37c65910e5545e
BLAKE2b-256 checksum
How to use checksums
159f8d9e12f27f7063ac14575ad7c7732b4b4701893fe540faa4ccc74d89460a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / mavsdk-3.17.4-py3-none-manylinux2014_aarch64.whl

Download URL mavsdk-3.17.4-py3-none-manylinux2014_aarch64.whl
Size 18.2 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
f202d396efa77271d7a5e1cc3a1e66cd036b585b8cdb54de9732ba358a8ace2b
BLAKE2b-256 checksum
How to use checksums
4a5cf709d9de0cecd675f3c65adf9b83e0a703cde1d154598924c49e320b7721
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / mavsdk-3.17.4-py3-none-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl

Download URL mavsdk-3.17.4-py3-none-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl
Size 15.2 MB
Tags Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 Python 3
SHA-256 checksum
How to use checksums
89ad14c04681b364c5a9ebe53898463b0c53d1ce70ca2eaf4fb23cac6885879b
BLAKE2b-256 checksum
How to use checksums
49f583e89191beda78d9571364eebb4e1f66f4127c9c78fdf5890db71be04eb6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / mavsdk-3.17.4-py3-none-macosx_14_0_arm64.whl

Download URL mavsdk-3.17.4-py3-none-macosx_14_0_arm64.whl
Size 11.7 MB
Tags Python 3 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
b2be501209410bc876a218eceb9ca2d0eb0e42a5d991da182c984a1a83de3fbc
BLAKE2b-256 checksum
How to use checksums
3f48770b7e475caf871f92b32766035e76da96aa074a9ca8da88970b3eeba557
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / mavsdk-3.17.4-py3-none-macosx_13_0_x86_64.whl

Download URL mavsdk-3.17.4-py3-none-macosx_13_0_x86_64.whl
Size 12.2 MB
Tags Python 3 macOS 13.0+ x86-64
SHA-256 checksum
How to use checksums
313b10626c8ad441a5b2a0066aa0e809f4781bbc19dfc08b4768f30053ec38c1
BLAKE2b-256 checksum
How to use checksums
f94bdb61fa7282bbbb8fa0a838c190602aa78994c89baaa0351a2e6c95c5bacc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / mavsdk-3.17.4-py3-none-linux_armv7l.whl

Download URL mavsdk-3.17.4-py3-none-linux_armv7l.whl
Size 16.6 MB
Tags Python 3 linux armv7l
SHA-256 checksum
How to use checksums
2b19a2b691cc48ca28fd853a60217d5ed880c0c15ad3f1de6c33ffdb4af53a94
BLAKE2b-256 checksum
How to use checksums
cbea3ab5cd4594408a301db502f3c33c5d30da1ac17a6747b485be6adc205467
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / mavsdk-3.17.4-py3-none-linux_armv6l.whl

Download URL mavsdk-3.17.4-py3-none-linux_armv6l.whl
Size 16.6 MB
Tags Python 3 linux armv6l
SHA-256 checksum
How to use checksums
21303ace95191a65043959f1cd5649b7c483696a1edbc848d236c417602312c2
BLAKE2b-256 checksum
How to use checksums
7e03b2d836e98b5dcc1278d30052f455472d7407271b9ca696df817bfc6df62e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

4.0.6

7 release files

4.0.5

7 release files

4.0.3

7 release files

4.0.2

7 release files

4.0.1

7 release files

4.0.0

7 release files

This release

3.17.4 This release

9 release files

3.17.2

9 release files

3.15.3

9 release files

3.15.1

5 release files

3.15.0

5 release files

3.10.2

9 release files

3.10.0

9 release files

3.9.0

9 release files

3.8.0

9 release files

3.6.0

8 release files

3.5.0

8 release files

3.0.1

8 release files

3.0.0

8 release files

2.8.4

8 release files

2.8.3

8 release files

2.8.2

8 release files

2.8.1

8 release files

2.8.0

8 release files

2.7.0

8 release files

2.6.2

7 release files

2.6.1

7 release files

2.6.0

7 release files

2.5.1

7 release files

2.5.0

7 release files

2.4.1

7 release files

2.4.0

7 release files

2.3.0

7 release files

2.2.0

7 release files

2.1.0

7 release files

2.0.1

7 release files

2.0.0

3 release files

1.4.9

7 release files

1.4.8

7 release files

1.4.7

7 release files

1.4.6

7 release files

1.4.5

7 release files

1.4.4

7 release files

1.4.3

7 release files

1.4.2

7 release files

1.4.1

7 release files

1.4.0

7 release files

1.3.0

7 release files

1.2.0

7 release files

1.0.0

7 release files

0.23.0

7 release files

0.22.3

6 release files

0.22.2

4 release files

0.22.1

7 release files

0.22.0

7 release files

0.21.0

7 release files

0.20.0

7 release files

0.19.0

7 release files

0.18.0

7 release files

0.17.0

8 release files

0.16.1

8 release files

0.16.0

8 release files

0.13.4

8 release files

0.13.3

5 release files

0.13.2

1 release file

0.12.0

5 release files

0.10.0

5 release files

0.9.1

5 release files

0.9.0

5 release files

0.8.2

5 release files

0.8.1

5 release files

0.8.0

5 release files

0.7.0

5 release files

0.6.1

4 release files

0.6.0

2 release files

0.5.4

4 release files

0.5.3

4 release files

0.5.2

3 release files

0.5.1

3 release files

0.5.0

0.4.0

4 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page