Flying CF2 from my own Python script

Firmware/software/electronics/mechanics
Post Reply
f-rower
Beginner
Posts: 16
Joined: Wed Jun 14, 2017 10:19 am

Flying CF2 from my own Python script

Post 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-
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Flying CF2 from my own Python script

Post 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.
f-rower
Beginner
Posts: 16
Joined: Wed Jun 14, 2017 10:19 am

Re: Flying CF2 from my own Python script

Post 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
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Flying CF2 from my own Python script

Post 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.
f-rower
Beginner
Posts: 16
Joined: Wed Jun 14, 2017 10:19 am

Re: Flying CF2 from my own Python script

Post 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 :)
Post Reply