Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit a2fa009

Browse files
committed
Improve the Connecting topic
1 parent c7b5308 commit a2fa009

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

docs/guide/connecting_vehicle.rst

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,33 @@ Connecting to a Vehicle
88
The connection to the vehicle (or multiple vehicles) is set up within the
99
DroneKit script. Scripts import and call the :py:func:`connect() <dronekit.connect>`
1010
method. After connecting this returns a :py:class:`Vehicle <dronekit.Vehicle>`
11-
object from which you can get/set parameters and attributes, and control vehicle movement:
11+
object from which you can get/set parameters and attributes, and control vehicle movement.
1212

13-
.. code:: python
13+
The most common way to call :py:func:`connect() <dronekit.connect>` is shown below:
14+
15+
.. code-block:: python
1416
1517
from dronekit import connect
1618
1719
# Connect to the Vehicle (in this case a UDP endpoint)
1820
vehicle = connect('127.0.0.1:14550', wait_ready=True)
1921
20-
The first parameter above specifies the target address (in this case the loopback
22+
The first parameter specifies the target address (in this case the loopback
2123
address for UDP port 14550). See :ref:`get_started_connect_string` for the strings to use for
22-
other common vehicles.
24+
other common vehicles.
25+
26+
The second parameter (``wait_ready``) is used to determine whether ``connect()`` returns immediately
27+
on connection or if it waits until *some* vehicle parameters and attributes are populated. In most cases you
28+
should use ``wait_ready=True`` to wait on the default set of parameters.
29+
30+
:py:func:`connect() <dronekit.connect>` also has arguments for setting the baud rate,
31+
the length of the connection timeout, and/or to use
32+
a :ref:`custom vehicle class <example_create_attribute>`.
2333

24-
:py:func:`connect() <dronekit.connect>` also has arguments for setting the baud rate, whether ``connect()`` returns immediately or waits until vehicle parameters and attributes are populated (:py:func:`wait_ready=True <dronekit.Vehicle.wait_ready>`),
25-
the length of the connection timeout, and/or to use a :ref:`custom vehicle class <example_create_attribute>`.
34+
There is more documentation on all of the parameters in the :py:func:`API Reference <dronekit.connect>`.
2635

2736

37+
.. _connection_string_options:
2838
.. _get_started_connect_string:
2939

3040
Connection string options
@@ -61,3 +71,15 @@ The table below shows *connection strings* you can use for some of the more comm
6171
The default baud rate may not be appropriate for all connection types (this may be the cause
6272
if you can connect via a GCS but not DroneKit).
6373

74+
75+
Connecting to multiple vehicles
76+
===============================
77+
78+
You can control multiple vehicles from within a single script by calling
79+
:py:func:`connect() <dronekit.connect>` for each vehicle
80+
with the appropriate :ref:`connection strings <connection_string_options>`.
81+
82+
The returned :py:class:`Vehicle <dronekit.Vehicle>` objects are independent of
83+
each other and can be separately used to control their respective
84+
vehicle.
85+

0 commit comments

Comments
 (0)