Skip to content

Commit 865f9ea

Browse files
authored
Merge pull request mavlink#424 from mavlink/pr-debug-help
docs: add note how to debug concection issues
2 parents 92ed890 + af8a5f2 commit 865f9ea

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

mavsdk/source/index.rst

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,45 @@ Once the package has been installed, the examples can be run:
5757

5858
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.
5959

60+
Debug connection issues
61+
-----------------------
62+
63+
In order to get more debugging information, it is possible to run the mavsdk_server binary separately.
64+
65+
For this case, let's assume the example was like this:
66+
67+
drone = System()
68+
await drone.connect(system_address="udp://:14540")
69+
70+
71+
The mavsdk_server binary is installed using ``pip3``. If installed with ``pip3 --user`` it is usually (at least for Linux) to be found in ``~/.local/lib/python3.9/site-packages/mavsdk/bin/`` (of course depending on the Python version used).
72+
73+
It can then be run in a separate console with the ``system_address`` as an argument:
74+
75+
~/.local/lib/python3.9/site-packages/mavsdk/bin/mavsdk_server udp://:14540
76+
77+
Without an autopilot connecting, the output will look something like:
78+
79+
[02:36:31|Info ] MAVSDK version: v0.50.0 (mavsdk_impl.cpp:28)
80+
[02:36:31|Info ] Waiting to discover system on udp://:14540... (connection_initiator.h:20)
81+
82+
Once an autopilot is discovered, something like this should be printed:
83+
84+
[02:38:12|Info ] MAVSDK version: v0.50.0 (mavsdk_impl.cpp:28)
85+
[02:38:12|Info ] Waiting to discover system on udp://:14540... (connection_initiator.h:20)
86+
[02:39:01|Info ] New system on: 127.0.0.1:14580 (with sysid: 1) (udp_connection.cpp:194)
87+
[02:39:01|Debug] New: System ID: 1 Comp ID: 1 (mavsdk_impl.cpp:484)
88+
[02:39:01|Debug] Component Autopilot (1) added. (system_impl.cpp:355)
89+
[02:39:02|Debug] Discovered 1 component(s) (system_impl.cpp:523)
90+
[02:39:02|Info ] System discovered (connection_initiator.h:63)
91+
[02:39:02|Info ] Server started (grpc_server.cpp:52)
92+
[02:39:02|Info ] Server set to listen on 0.0.0.0:50051 (grpc_server.cpp:53)
93+
94+
This would look promising, and the example can now be run against this server, however, without ``system_address``:
95+
96+
drone = System()
97+
await drone.connect()
98+
6099

61100
Indices and tables
62101
==================

0 commit comments

Comments
 (0)