Page 1 of 1

Flying CF2 from my own Python script

Posted: Fri Jul 21, 2017 12:58 pm
by f-rower
Hi guys!

I've been doing some work developing autonomous landing for my cf 2.0, so thought it would be convenient to be able to control the cf (via joystick) through my own Python script. I was hoping to use code from the cfclient to find the joystick, configure mappings and send setpoints to the cf (https://github.com/bitcraze/crazyflie-c ... tils/input), but I am a bit at a loss as to how I should use this code in my script. Would you be able to give me some hints about how I could do this?

thanks very much,

f-

Re: Flying CF2 from my own Python script

Posted: Tue Jul 25, 2017 7:28 am
by arnaud
Hi,
I guess the best would be to look in the client source code to see how this code is used. Though we know that it is a a bit messy right now and this is something we want to clean up during the summer. Most of the code controlling the input subsystem seems to be located in main.py in the client.

Could you maybe tell a bit more of how you hoped to use the input subsytem? This would help in reworking it if I have some use-case in mind.

Re: Flying CF2 from my own Python script

Posted: Tue Jul 25, 2017 9:51 am
by f-rower
Hi Arnaud,

I was hoping to use that code to 1) read inputs from the joystick and send setpoints to the crazyflie and 2) trigger a landing process after a button has been pressed and 3) Trigger other functions by the press of other buttons

Re: Flying CF2 from my own Python script

Posted: Wed Jul 26, 2017 11:31 am
by arnaud
Hi,

Thanks, this is the kind use cases I was thinking about. I created a ticket, do not hesitate if you have any input to it: https://github.com/bitcraze/crazyflie-c ... issues/309. We will start thinking about how to revamp the input subsystem and update the ticket when we have something.

Re: Flying CF2 from my own Python script

Posted: Thu Jul 27, 2017 2:08 pm
by f-rower
Thanks Arnaud, in the meantime I wrote my own code for control using pygame, but I'll keep an eye on this as well :)