Last edit: February 1, 2016
LeapDrone Python is a Python script that enables you to control your Ardupilot drone with your hand thanks to the Leap Motion controller.
For now it can just handles the pitch and roll.
In order to work properly, this script needs the following dependencies:
- Python v2.7
- DroneKit-Python 2.X
- Leap Motion SDK (Python)
Follow instructions on the Leap Motion developer portal.
To avoid inserting the path of the Leap Motion SDK in all your Python projects, you can copy the libraries in the Python site-packages
directory.
The following steps show how to do it on a mac OS X setup.
Locate the path of the site-packages
directory
$ python
>>> import site; site.getsitepackages()
['/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/Library/Python/2.7/site-packages']
Copy the files into the site-packages
directory
Refer to Leap Motion Website to know what are the needed files.
$ cp LeapSDK/lib/{Leap.py,LeapPython.so,libLeap.dylib} /Library/Python/2.7/site-packages
Please refer to Dronekit official documentation.
A simple git clone is all you need to install this project:
$ git clone https://github.com/TenOs/leapdrone-python.git
usage: leapdrone.py [-h] [-d] [-a Z] [-b B] [-l] [-t] [-o VAL] [-r]
vehicle_address
Control a drone with your hand thanks to the Leap Motion tracker
positional arguments:
vehicle_address For vehicle's address format see
http://python.dronekit.io/guide/connecting_vehicle.html#get-started-connecting
optional arguments:
-h, --help show this help message and exit
-d, --debug Show debug messages, kind of a verbose mode
-a Z, --altitude Z Relative flight altitude in meters, default is 5m
-b B, --baud B Set connection Baud rate
-l, --land Land and disarm when flight is over
-t, --takeoff Arm and takeoff the vehicle
-o VAL, --overrideThrottle VAL
Override throttle to a value (default value is 1500)
-r, --rtl Return to launch, land and disarm when flight is over
NB: if both land and return to launch are set, the vehicle will only land, the priority is on land mode
Please refer to the Dronekit documentation for the vehicle address format.
$ python leapdrone.py udp:localhost:14551 -a 7 -d
The script currently only supports the pitch and roll. For safety measures the flight mode is switched to ALT_HOLD
.
Since the Leap Motion SDK only supports Python v2.7 this script cannot be run with Python 3.
LeapDrone Python is released under the permissive open source Apache v2.0 license.
Copyright 2016 Jean-Baptiste Martin (github at martinjb dot com)