Controlling programatically

Firmware/software/electronics/mechanics
Post Reply
helicopter
Beginner
Posts: 1
Joined: Tue Feb 12, 2013 1:18 pm

Controlling programatically

Post by helicopter »

Hi,

Great work on the quadcopter - it looks brilliant.
Is it possible to control the quadcopter programatically i.e. get it to go left, right, up down, back and forward etc using command lines and without a joystick?
The idea would be to be able to understand the surrounding environment and move about automatically...

Best,
Heli
shnytzl
Beginner
Posts: 2
Joined: Mon Feb 11, 2013 7:48 pm
Contact:

Re: Controlling programatically

Post by shnytzl »

Hi Heli,

I'm not involved in the developement or anything, but as far as I understood the concept behind this, this should be farely easily achievable, all you need to do is writing the code I guess.
Any confirmation by an official developer is appreciated though :)

Marc
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Controlling programatically

Post by tobias »

It's not a problem to make the Crazyflie follow some commands but making it follow a predetermined path is a whole different story. This is a hot research topic. Now, ground mounted cameras are often used to determine the object position, like hawk-eye in tennis.
marcus
Bitcraze
Posts: 659
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Re: Controlling programatically

Post by marcus »

We have started to document the Crazyflie Python API on the wiki. It not finished yet but there are some examples where you get an idea of how the API is used.

We did a quick experiment using OpenCV to control the Crazyflie from a PC without using a controller: http://www.youtube.com/watch?v=iLePTRLJM7I. Since we didn't have the time we gave up after one night since we had problems with the latency created by the image processing. But it would be great to see this working :D

Here's a snippet of Python code that shows how to connect to a Crazyflie and send control commands using the API. I reserve myself for spelling errors and such :roll:

Code: Select all

cflib.crtp.initDrivers()
available = cflib.crtp.scanInterfaces()

crazyflie = Crazyflie()
crazyflie.openLink(available[0][0]) # Connect to the first Crazyflie found

while (True):
    [roll, pitch, yawrate, thrust] = calcTargetControlValues()
    crazyflie.commander.sendControlSetpoint(roll, pitch, yawrate, thrust)
Post Reply