Skip to content

Commit adf41e0

Browse files
Merge pull request #195 from mavlink/pr-docs
Generate API docs
2 parents c87c22a + 364e039 commit adf41e0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+464
-29
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@ This is the Python wrapper for MAVSDK.
66

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

9+
910
## Important Notes
1011

1112
- Python 3.6+ is required (because the wrapper is based on [asyncio](https://docs.python.org/3.7/library/asyncio.html)).
1213
- You may need to run `pip3` instead of `pip` and `python3` instead of `python`, depending of your system defaults.
1314
- 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.
1415

16+
## API Reference docs
17+
18+
-> [API Reference documentation](http://mavsdk-python-docs.s3-website.eu-central-1.amazonaws.com/).
19+
1520
## Install using pip from PyPi
1621

1722
To install mavsdk-python, simply run:
@@ -65,7 +70,6 @@ First install the protoc plugin (`protoc-gen-dcsdk`):
6570
```
6671
cd proto/pb_plugins
6772
pip3 install -r requirements.txt
68-
pip3 install -e .
6973
```
7074

7175
You can check that the plugin was installed with `$ which protoc-gen-dcsdk`, as it should now be in the PATH.
@@ -85,6 +89,14 @@ Run the following helper script. It will generate the Python wrappers for each p
8589
./other/tools/run_protoc.sh
8690
```
8791

92+
### Generate the API documentation
93+
94+
```
95+
pip3 install sphinx numpydoc
96+
make -C mavsdk html
97+
```
98+
99+
88100
### Update `mavsdk_server` version
89101

90102
[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](./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).

mavsdk/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

mavsdk/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
if "%1" == "" goto help
14+
15+
%SPHINXBUILD% >NUL 2>NUL
16+
if errorlevel 9009 (
17+
echo.
18+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19+
echo.installed, then set the SPHINXBUILD environment variable to point
20+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21+
echo.may add the Sphinx directory to PATH.
22+
echo.
23+
echo.If you don't have Sphinx installed, grab it from
24+
echo.http://sphinx-doc.org/
25+
exit /b 1
26+
)
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

mavsdk/source/conf.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
# import os
14+
# import sys
15+
# sys.path.insert(0, os.path.abspath('.'))
16+
17+
18+
# -- Project information -----------------------------------------------------
19+
20+
project = 'MAVSDK-Python'
21+
copyright = '2020, Jonas Vautherin, Julian Oes'
22+
author = 'Jonas Vautherin, Julian Oes'
23+
24+
# The full version, including alpha/beta/rc tags
25+
release = '0.7.0'
26+
27+
28+
# -- General configuration ---------------------------------------------------
29+
30+
# Add any Sphinx extension module names here, as strings. They can be
31+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
32+
# ones.
33+
extensions = [
34+
'sphinx.ext.autodoc',
35+
'sphinx.ext.napoleon'
36+
]
37+
38+
# Add any paths that contain templates here, relative to this directory.
39+
templates_path = ['_templates']
40+
41+
# List of patterns, relative to source directory, that match files and
42+
# directories to ignore when looking for source files.
43+
# This pattern also affects html_static_path and html_extra_path.
44+
exclude_patterns = []
45+
46+
47+
# -- Options for HTML output -------------------------------------------------
48+
49+
# The theme to use for HTML and HTML Help pages. See the documentation for
50+
# a list of builtin themes.
51+
#
52+
html_theme = 'nature_adapted'
53+
html_theme_path = ["."]
54+
55+
# Add any paths that contain custom static files (such as style sheets) here,
56+
# relative to this directory. They are copied after the builtin static files,
57+
# so a file named "default.css" will overwrite the builtin "default.css".
58+
html_static_path = ['nature_adapted/static']

mavsdk/source/index.rst

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
.. MAVSDK-Python documentation master file, created by
2+
sphinx-quickstart on Sat May 30 10:40:26 2020.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
|
7+
8+
.. image:: nature_adapted/static/sdk_logo_full.png
9+
:alt: MAVSDK logo
10+
:scale: 30%
11+
12+
MAVSDK-Python API reference
13+
===========================
14+
15+
16+
.. toctree::
17+
:maxdepth: 5
18+
:caption: Contents:
19+
20+
system
21+
plugins/index
22+
23+
Important Notes
24+
---------------
25+
26+
- Python 3.6+ is required.
27+
- You may need to run ``pip3`` instead of ``pip`` and ``python3`` instead of ``python``, depending of your system defaults.
28+
- 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.
29+
30+
Install using pip from PyPi
31+
---------------------------
32+
33+
To install simply run:
34+
35+
pip3 install mavsdk
36+
37+
38+
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:
39+
40+
python
41+
from mavsdk import System
42+
43+
...
44+
45+
drone = System()
46+
await drone.connect(system_address="udp://:14540")
47+
48+
49+
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.
50+
51+
Run the examples
52+
----------------
53+
54+
Once the package has been installed, the examples can be run:
55+
56+
examples/takeoff_and_land.py
57+
58+
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.
59+
60+
61+
Indices and tables
62+
==================
63+
64+
* :ref:`genindex`
65+
* :ref:`modindex`
66+
* :ref:`search`
12.7 KB
Loading
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@import url("nature.css");
2+
3+
div.related {
4+
background-color: #f26622;
5+
}
6+
7+
div.body h1, div.body h2, div.body h3, div.body h4, div.body h5, div.body h6 {
8+
background-color: #cccccc;
9+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[theme]
2+
inherit = nature
3+
stylesheet = style.css

mavsdk/source/plugins/action.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Action
2+
====
3+
4+
.. automodule:: mavsdk.generated.action
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
8+
:exclude-members: translate_from_rpc, translate_to_rpc

mavsdk/source/plugins/calibration.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Calibration
2+
====
3+
4+
.. automodule:: mavsdk.generated.calibration
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
8+
:exclude-members: translate_from_rpc, translate_to_rpc

0 commit comments

Comments
 (0)