Defining a new controller

Firmware/software/electronics/mechanics
Post Reply
cemart01
Beginner
Posts: 3
Joined: Wed Jun 18, 2014 8:38 pm

Defining a new controller

Post by cemart01 »

I'm trying to use the Leap to fly the crazyflie, and although I found the instructions to use Leap4Joy, I couldn't get it to work. I was wondering if it would be difficult just to use the python scripts for the Leap to define a new controller within the cfclient. I also don't know where to begin with this, since the limited definitions in the cfclient part of the repository don't make much sense to me. Can anyone offer any guidance on how to go about defining a new controller?

Someone previously linked this as helpful, but I'm not sure how. https://github.com/openleap/PyLeapMouse ... Control.py
marcus
Bitcraze
Posts: 659
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Re: Defining a new controller

Post by marcus »

Hi,

We have done some tests with the LeapMotion so there's code available that should work on this branch and there's also a blog post about it here.

The implementation is done by switching out the pygamereader.py with a leapreader.py. These input-device "drivers" are polled at a predefined interval (I think it's 10ms). For the pygamereader when the reading is done the events from PyGame is processed and values are returned. For the Leap things are done a little bit different. Since the output from the Leap is acquired though callbacks, these callbacks directly alter the values that will be returned when reading. So the Leap might update the values faster or slower than 100Hz, but the values are still read at 100Hz.
cemart01
Beginner
Posts: 3
Joined: Wed Jun 18, 2014 8:38 pm

Re: Defining a new controller

Post by cemart01 »

I've looked through those and the hacks page, and I can't make it work. Did it end up using the Leap4Joy and VJoy piece?
marcus
Bitcraze
Posts: 659
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Re: Defining a new controller

Post by marcus »

No, the flying we are doing in the video is using the code in the repo. We haven't tried any other apps/libs.

What issues are you having with the code? I have some recollection of an API change in the Leap API a while back and I'm not sure the code has been updated for that.
cemart01
Beginner
Posts: 3
Joined: Wed Jun 18, 2014 8:38 pm

Re: Defining a new controller

Post by cemart01 »

When I try to run the cfclient file with ./ it asks me to choose an application to run it. When I try to do it with the python compiler, it tells me that it can't run because I don't have pyusb installed (which I do).
Post Reply