Running the ExamplesΒΆ

General instructions for running the example source code are given below (more explicit instructions may be provided in the documentation for each example):

  1. 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/droneapi-python.git
    

    Tip

    The Windows Installation copies the example code here: C:\Program Files (x86)\MAVProxy\examples\.

  2. Start MAVProxy and connect to the vehicle. For example:

    • To connect to a simulated vehicle when starting MAVProxy (from the command line):

      mavproxy.py --master=127.0.0.1:14550
      
    • To connect to a simulated vehicle after starting MAVProxy (for example, on Windows):

      link add 127.0.0.1:14550
      
  3. You should already have set up MAVProxy to load DroneKit automatically. If not, manually load the library using:

    module load droneapi.module.api
    
  4. Once the MAVProxy console is running, start the example by entering:

    api start absolute_path_to_example/example_name.py
    

    Tip

    If you start MAVProxy from the same directory as the target script you can omit the full file path:

    api start example_name.py
    

Warning

Propellers should be removed before testing examples indoors (on real vehicles).