From 2192dfe9569974db296703ad134295bca94e1ebf Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Mon, 27 Dec 2021 15:21:34 +0100 Subject: [PATCH] docs: fix formatting --- mavsdk/source/index.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mavsdk/source/index.rst b/mavsdk/source/index.rst index 114fbcc1..47ed89a9 100644 --- a/mavsdk/source/index.rst +++ b/mavsdk/source/index.rst @@ -37,11 +37,10 @@ To install simply run: 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: +.. code:: python python from mavsdk import System - ... - drone = System() await drone.connect(system_address="udp://:14540") @@ -53,6 +52,7 @@ Run the examples Once the package has been installed, the examples can be run: +.. code:: bash 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. @@ -64,6 +64,7 @@ In order to get more debugging information, it is possible to run the mavsdk_ser For this case, let's assume the example was like this: +.. code:: python drone = System() await drone.connect(system_address="udp://:14540") @@ -72,15 +73,18 @@ The mavsdk_server binary is installed using ``pip3``. If installed with ``pip3 - It can then be run in a separate console with the ``system_address`` as an argument: +.. code:: bash ~/.local/lib/python3.9/site-packages/mavsdk/bin/mavsdk_server udp://:14540 Without an autopilot connecting, the output will look something like: +.. code:: bash [02:36:31|Info ] MAVSDK version: v0.50.0 (mavsdk_impl.cpp:28) [02:36:31|Info ] Waiting to discover system on udp://:14540... (connection_initiator.h:20) Once an autopilot is discovered, something like this should be printed: +.. code:: bash [02:38:12|Info ] MAVSDK version: v0.50.0 (mavsdk_impl.cpp:28) [02:38:12|Info ] Waiting to discover system on udp://:14540... (connection_initiator.h:20) [02:39:01|Info ] New system on: 127.0.0.1:14580 (with sysid: 1) (udp_connection.cpp:194) @@ -93,6 +97,7 @@ Once an autopilot is discovered, something like this should be printed: This would look promising, and the example can now be run against this server, however, without ``system_address``: +.. code:: python drone = System() await drone.connect()