Software and Programming help

Firmware/software/electronics/mechanics
Post Reply
savdont
Beginner
Posts: 4
Joined: Thu Feb 06, 2014 11:56 pm

Software and Programming help

Post by savdont »

Hi, I'm kinda new to the crazyflie. Before I buy the quadcopter, I would like to know the programming needed to get the crazyflie to run.
In what programming language can I program crazyflie with to make a simple autonomous program.
Also, what are the prerequisites that I need on my computer in order to be able to program.
Lastly, what tips would you recommend for an intro programmer like me.
As of right now, I know several programming languages including some intermediate-advanced java, some python, as well as HTML and CSS.

Thanks :D
Im really interested in this amazing quadcopter, its just that I want to know whether I will be able to program it or not, it would be a waste if I bought it and did not know the programming for it.
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Software and Programming help

Post by tobias »

Hi! If you don't want to manually control it, it can be controlled with python and several other languages it has been ported to. However you are only able to control roll, pitch, yaw and thrust. Making it fly a specific path or similar is not possible (which I would call autonomous ;) ).
savdont
Beginner
Posts: 4
Joined: Thu Feb 06, 2014 11:56 pm

Re: Software and Programming help

Post by savdont »

Hi Thanks for the response.
I'm still a bit confused. So do I program the python within eclipse or within another compiler or IDE.
Thanks for your help!
omwdunkley
Expert
Posts: 162
Joined: Thu Jun 06, 2013 9:56 pm
Location: Munich

Re: Software and Programming help

Post by omwdunkley »

savdont wrote:Hi Thanks for the response.
I'm still a bit confused. So do I program the python within eclipse or within another compiler or IDE.
Thanks for your help!
Hi! A few recommendations from my side:

If you want to do computations on the flie itself, the learning curve could be a little steep if you have not programmed/compile c like code before. By this I mean you run computations that run on the flies cpu. You probably do not need to do this...unless you are after something very specific.

I am guessing that for your needs python would be fully sufficient (possibly with a few very minor well documented exceptions). Python runs on your computer and communicates to the flie with a well implemented and documented library! its pretty easy to get started and python is very easy to learn. I suggest you use pycharm as an IDE and look at the examples in the cfclient repository. With advanced java under your belt, using python to "control" the flie should be very very easy.

However, please not that controlling the flie to do something you want (fly a perfect circle, hover in place) is not so easy. It really depends on what you are trying to do.

What do you mean by a "simple autonomous program"?

Prerequisites? Nothing you cannot easily attain. If you can run the cfclient (just download it and try), you can develop in python. See: http://wiki.bitcraze.se/projects:crazyf ... ls:install
Also check ontrolling the flie with python: http://wiki.bitcraze.se/projects:crazyf ... tils:pylib
savdont
Beginner
Posts: 4
Joined: Thu Feb 06, 2014 11:56 pm

Re: Software and Programming help

Post by savdont »

Hi thanks for the prompt response. Sorry that I was not able to respond sooner.
I have looked at the python library and due to some prior knowledge of python, I understand the coding.
However, would it be possible for anybody to post a simple autonomous code that just moves forward and back. I would learn faster with the use of examples.
I thank you for your help and you are amazing!
I also am having some trouble learning how to actually make the code in eclipse. Do I go to new file and then make a python program? Or do I make it in a text editor and save it as a python file? And after I'm done making this program, how do I export it to the crazyflie?
Thanks for all responses and sorry if I'm asking too many questions. I have never developed for anything like this before.
Thanks :D
marcus
Bitcraze
Posts: 659
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Re: Software and Programming help

Post by marcus »

Hi,

For building and flashing the Crazyflie firmware have have a look at this video showing how to do it in the Bitcraze Virtual Machine. For simple examples of setting the roll/pitch/yaw/thrust using the Python API look at the examples in the repo.
savdont
Beginner
Posts: 4
Joined: Thu Feb 06, 2014 11:56 pm

Re: Software and Programming help

Post by savdont »

Yes, thank you for the quick response. However, how could I make a simple autonomous program which moves forward and back by switching the pitch from positive to negative values every two seconds. Would it be possible? I am having a lot of trouble programming for the quadcopter as I have main experience in java. I have the virtual machine and I have looked at the examples and the video, but I am still having a little trouble. Are there any other videos or tutorials on programming this type of stuff?
Thanks! :D:D:D
omwdunkley
Expert
Posts: 162
Joined: Thu Jun 06, 2013 9:56 pm
Location: Munich

Re: Software and Programming help

Post by omwdunkley »

savdont wrote:Yes, thank you for the quick response. However, how could I make a simple autonomous program which moves forward and back by switching the pitch from positive to negative values every two seconds. Would it be possible? I am having a lot of trouble programming for the quadcopter as I have main experience in java. I have the virtual machine and I have looked at the examples and the video, but I am still having a little trouble. Are there any other videos or tutorials on programming this type of stuff?
Thanks! :D:D:D
I guess you have to decide if you want to modify the exisiting client or write your own from scratch. Pro for using the client is that its set up and working, has a functional GUI, etc etc. But it might be a little hard to understand the whole thing in one go.

To make the flie fly by itself you need some reference to the environment. Either you look from the environment to the flie (eg using a kinect) or from the flie to the environment (ultra sonic sensors, on board camera, barometer for altitude, etc). Even if you could balance the flie very very well, flying a predetermined route without a reference to the environment will probably only work for a fraction of a second.

If I were you I would start by writing a program that just connects to the flie and prints some sensor data. From there you could go on to sending it commands, and then you could build your autonomous logic on top of that. Consult the example files, the wiki and browse the source code.
For the first steps, don't use eclipse or modify the firmware. Just write code that you run on your computer. If you want to use an IDE, i suggest pycharm. There is a free community edition available for download. I think the latest VM already has it.

Once you get started you can ask more specific questions and it would be easier to help!
Cheers
Post Reply