The connection to the vehicle (or multiple vehicles) is set up within the
DroneKit script. Scripts import and call the
method. After connecting this returns a
object from which you can get/set parameters and attributes, and control vehicle movement.
The most common way to call
connect() is shown below:
from dronekit import connect # Connect to the Vehicle (in this case a UDP endpoint) vehicle = connect('127.0.0.1:14550', wait_ready=True)
The first parameter specifies the target address (in this case the loopback address for UDP port 14550). See Connection string options for the strings to use for other common vehicles.
The second parameter (
wait_ready) is used to determine whether
connect() returns immediately
on connection or if it waits until some vehicle parameters and attributes are populated. In most cases you
wait_ready=True to wait on the default set of parameters.
There is more documentation on all of the parameters in the
The table below shows connection strings you can use for some of the more common connection types:
|Connection type||Connection string|
|Linux computer connected to the vehicle via USB||
|Linux computer connected to the vehicle via Serial port (RaspberryPi example)||
|SITL connected to the vehicle via UDP||
|SITL connected to the vehicle via TCP||
|OSX computer connected to the vehicle via USB||
|Windows computer connected to the vehicle via USB (in this case on COM14)||
|Windows computer connected to the vehicle using a 3DR Telemetry Radio on COM14||
The strings above are the same as are used when connecting the MAVProxy GCS. For other options see the MAVProxy documentation.
The default baud rate may not be appropriate for all connection types (this may be the cause if you can connect via a GCS but not DroneKit).