General instructions for running the example source code are given below. More explicit instructions are provided within the documentation for each example (and within the examples themselves by passing the
-h (help) command line argument).
The examples all launch the dronekit-sitl simulator and connect to it by default. The
--connect argument is used to instead specify the connection string for a target vehicle or an externally managed SITL instance.
To run the examples:
Get the DroneKit-Python example source code onto your local machine. The easiest way to do this is to clone the dronekit-python repository from Github.
On the command prompt enter:
git clone http://github.com/dronekit/dronekit-python.git
Navigate to the example you wish to run (or specify the full path in the next step). The examples are all stored in subdirectories of dronekit-python/examples/.
For example, to run the vehicle_state example, you would navigate as shown:
Start the example as shown:
To connect to a simulator started/managed by the script:
To connect to a specific vehicle, pass its connection string via the
For example, to run the example on Solo you would use the following command:
python vehicle_state.py --connect udpin:0.0.0.0:14550
Propellers should be removed before testing examples indoors (on real vehicles).