Crazyflie API and python development

Firmware/software/electronics/mechanics
Post Reply
franco
Beginner
Posts: 3
Joined: Sat Jul 11, 2015 10:47 am

Crazyflie API and python development

Post by franco »

Hello All,

I recently got a crazyflie 2.0 and after a few days playing with it, I would like to develop some client code. I am working in windows 7, as in the VM 0.6 the radiolink was not working properly at the beginning, but can try to switch back if required. I have some background on C++, C# but not exactly in python, so although I have checked the API and tutorials I am not able to understand all the functions underlaying the API.

For the moment, I have been able to open with PyQt the cfclient source code, mainly the UI files, and more or less understood some of the code associated with the "py" files but I have two basic questions to move further on:

1) Once modified some UI file in PyQt to change the layout (let say add a button and wanting a onclick event for example). Should I add the code manually into the source "py" with the onclick event? I don't get how to add what in Qt is called the "signals" in the PyQt Designer and link it with code in the "py" source. Any advice?

2) Is any way I can get more documentation from the API? I have not manage to get all the functions, members and variables that are written in the library, but in the source code of cfclient there is a lot of code that I imagine was written knowing exactly how the API worked.

Any advice on how to "tweak" the "cfclient" source code to change the layout and code would be appreciated, as I want to develop a simpler interface and not able from scratch due to crazyradio not detecting directly crazyflie (see my other post in crazyradio support for this issue).
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Crazyflie API and python development

Post by arnaud »

Hi,

1) The python code is actually loading the ui file so there is no need to generate codes from the ui designer, just save the UI and the modification will be visible next time you launch the client. To edit the code itself you can use pycharm installed in the virtual machine.
Some time ago we made videos to explain how to modify the client. It is for Crazyflie 1 and an old version of the client but the concepts are still the same: https://www.youtube.com/watch?v=chWrNh73YBw

2) The public cflib API is documented in the wiki: https://wiki.bitcraze.io/doc:crazyflie:api:python:index
The cfclient internal API is ... internal and so documented by the source code.There has been some effort for an architecture description: https://wiki.bitcraze.io/doc:crazyflie: ... ient:index but it is still in progress.

We have kept a separation between the GUI and the lib. cflib communicates with Crazyflie and cfclient is the GUI client. If you want to implement a very simple client this can be done just by using cflib and any GUI lib you want (the first client we used was using only pygame and with an SDL display). Otherwise our client is modular with "tabs" so following the video I sent above you would be able to make a new tab and you can run the client with only this tab active.
Post Reply