User Tools

Site Tools


misc:hacks:leapmotion

Flying the Crazyflie with the Leapmotion

There's a quick hack for flying the Crazyflie with the Leap Motion in the Crazyflie Python client repo on the dev-leapmotion branch. The application replaces the normal input with a Leap Motion input. So this branch only works with Leap Motion and not normal controllers. The code will be integrated with the main branch once development is done. The client with Leap Motion have been tested on Linux/Windows and should also work on MacOSX.

Please note: This is VERY experimental so be careful!

What you need

A Crazyflie, a Leap Motion, the normal Leapmotion installer and the SDK for your platform.

How to get it working

  • Download the SDK and unpack it
  • Download and install the normal installer (for Linux the installer is in the SDK)
  • Copy the file Leap.py from the directory LeapSDK/lib into the crazyflie-clients-python/lib/leapmotion directory
  • Copy the files in the LeapSDK/lib/x86 (or x64 directory) into the crazyflie-clients-python/lib/leapmotion directory
  • Plug your Leap Motion
  • Start up the Leap Motion daemon if it's not already started. On Linux this is done by issuing the following command
sudo leapd
  • Clone the crazyflie-clients-python repository and switch to the dev-leapmotion branch
git clone https://github.com/bitcraze/crazyflie-clients-python.git
git checkout dev-leapmotion
  • Start the normal client
cd crazyflie-clients-python/bin
./cfclient
  • You shouldn't run any input device config (it's not working) and don't select any mapping
  • Don't connect to the Crazyflie yet! First try out the controls and watch the UI to see how they work. Move the hand up/down to increase/decrease thrust, tilt it front/back for pitch and left/right for roll and rotate you hand (around the Z axis) for yaw. The Crazyflie will move according to you hand, so leading your hand front and left will lean the Crazyflie front and left
  • Fly :-)

In order to minimize the risk of accidental flying the orientation is only read when 4 or more fingers are detected. If the Crazyflie just drops out of the air it's probably because of this. So making a fist with your hand during flight will make the Crazyflie drop :-)

Tweaking

Have a look in the crazyflie-clients-python/lib/cfclient/utils/leapreader.py file.

misc/hacks/leapmotion.txt · Last modified: 2015-07-15 16:31 (external edit)