User Tools

Site Tools


PC utils development guide


This guide will help you get up and started with working with and contributing code to the Crazyflie Python Client: Getting the source code, installing it in your home profile for testing and contributing them back, if wished, to the source repository.

Getting the source code

The sources for the Crazyflie Python client are hosted in a Git repository on GitHub. In order to start working with them, visit the repository and make your own copy by forking it (button at the top right of the page). If you don't have a GitHub account, you may need to sign up for one.

After forking the repository, you have a complete copy of the code and all its history on GitHub. You can clone this repository using Git:

git clone [[https://address_to_your_fork]]

Git will make a subdirectory in the directory that you execute the command in and clone the repository there.

Installing the sources in your home profile

When developing with the Crazyflie Python client, it is helpful to develop, run and test the code in a user profile rather than installing it with root permissions system-wide. This way you can test changes without needing to reinstall into root-owned directories. The best way to do this is to simply execute the Python client from its path where you're developing it.

However, you might want to install the client like a “normal” program. To do this, you can either add the repository's bin/ folder to your search path or you can use the Python setup script in the root folder of the repository:

python install --user

This installs the sources into your user profile (e.g. in ~/.local). If you want to be able to run the Python client, you can either execute it straight from the sources, or from the executable installed in your profile (e.g. ~/.local/bin/cfclient), or you can add the installation path to your profile's search path:

export PATH=$PATH:~/.local/bin  # Only valid if the binary is really installed here!

If you don't use the setup script, but want to be able to add the repository's bin folder to your search path, replace “~/.local/bin” with the corresponding folder in your repository. This path can be added permanently to your search path by adding the above line to your ~/.bashrc file.

Testing changes

Now that everything's set to go, code away! Don't forget to test the code after you're done. If you used the setup script earlier on to install the Python client in your profile, just repeat the installation and the new sources will be used.

Contributing your changed code

If you've tested your changes and everything's running well, you might want to contribute the code you've created back to the main repository. If you plan on doing this, remember to commit frequently and write descriptive commit messages that make merging easier later on. Then push the code back to your Git repository on GitHub with:

git push

The buttons on the top left left you compare the code you've written with Bitcraze's main repository. If you think that these changes are good for others too, you can open up a pull request and ask that the Bitcraze developers merge your code into the main development line. They'll review the code and, if they like it, pull it in. Congratulations, you've just contributed code to the Crazyflie Python Client!

Coding standard

Currently this code is pretty messy but it's being modified to follow PEP-8 and PEP-257. See coding standard for more info.

projects/crazyflie/pc_utils/dev_guide.txt · Last modified: 2015-07-15 16:31 (external edit)