MCPcopy Index your code
hub / github.com/bitcraze/crazyflie-lib-python

github.com/bitcraze/crazyflie-lib-python @0.13

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.13 ↗ · + Follow
1,136 symbols 3,581 edges 118 files 443 documented · 39%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

cflib: Crazyflie python library CI

cflib is an API written in Python that is used to communicate with the Crazyflie and Crazyflie 2.0 quadcopters. It is intended to be used by client software to communicate with and control a Crazyflie quadcopter. For instance the cfclient Crazyflie PC client uses the cflib.

See below for platform specific instruction. For more info see our documentation.

Development

Developing for the cfclient

Note: If you are developing for the cfclient you must use python3. On Ubuntu (16.04, 18.08) use pip3 instead of pip.

Linux, OSX, Windows

The following should be executed in the root of the crazyflie-lib-python file tree.

Virtualenv

This section contains a very short description of how to use virtualenv (local python environment) with package dependencies. If you don't want to use virualenv and don't mind installing cflib dependencies system-wide you can skip this section.

  • Install virtualenv: pip install virtualenv
  • create an environment: virtualenv venv
  • Activate the environment: source venv/bin/activate

  • To deactivate the virtualenv when you are done using it deactivate

Note: For systems that support make, you can use make venv to create an environment, activate it and install dependencies.

Install cflib dependencies

Install dependencies required by the lib: pip install -r requirements.txt

To verify the installation, connect the crazyflie and run an example: python examples/basiclog

Testing

With docker and the toolbelt

For information and installation of the toolbelt.

  • Check to see if you pass tests: tb test
  • Check to see if you pass style guidelines: tb verify

Note: Docker and the toolbelt is an optional way of running tests and reduces the work needed to maintain your python environment.

Native python on Linux, OSX, Windows

Tox is used for native testing: pip install tox * If test fails after installing tox with pip install tox, installing with sudo apt-get install toxresult a successful test run

  • Test package in python3.4 TOXENV=py34 tox
  • Test package in python3.6 TOXENV=py36 tox

Note: You must have the specific python versions on your machine or tests will fail. (ie. without specifying the TOXENV, tox runs tests for python 3.3, 3.4 and would require all python versions to be installed on the machine.)

Platform notes

Linux

Setting udev permissions

The following steps make it possible to use the USB Radio without being root.

sudo groupadd plugdev
sudo usermod -a -G plugdev $USER

You will need to log out and log in again in order to be a member of the plugdev group.

Create a file named /etc/udev/rules.d/99-crazyradio.rules and add the following:

# Crazyradio (normal operation)
SUBSYSTEM=="usb", ATTRS{idVendor}=="1915", ATTRS{idProduct}=="7777", MODE="0664", GROUP="plugdev"
# Bootloader
SUBSYSTEM=="usb", ATTRS{idVendor}=="1915", ATTRS{idProduct}=="0101", MODE="0664", GROUP="plugdev"

To connect Crazyflie 2.0 via usb, create a file name /etc/udev/rules.d/99-crazyflie.rules and add the following:

SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", MODE="0664", GROUP="plugdev"

You can reload the udev-rules using the following:

sudo udevadm control --reload-rules
sudo udevadm trigger

Contribute

Everyone is encouraged to contribute to the CrazyFlie library by forking the Github repository and making a pull request or opening an issue.

Core symbols most depended-on inside this repo

add_callback
called by 107
cflib/utils/callbacks.py
add_variable
called by 79
cflib/crazyflie/log.py
set_value
called by 75
cflib/crazyflie/param.py
set_header
called by 50
cflib/crtp/crtpstack.py
call
called by 41
cflib/utils/callbacks.py
start
called by 39
cflib/crazyflie/log.py
take_off
called by 38
cflib/positioning/motion_commander.py
send_packet
called by 33
cflib/crazyflie/__init__.py

Shape

Method 905
Class 128
Function 103

Languages

Python100%

Modules by API surface

cflib/positioning/motion_commander.py40 symbols
cflib/crtp/radiodriver.py39 symbols
cflib/crtp/debugdriver.py34 symbols
examples/positioning/bezier_trajectory.py33 symbols
cflib/crazyflie/log.py33 symbols
cflib/crazyflie/mem/lighthouse_memory.py31 symbols
test/positioning/test_motion_commander.py28 symbols
cflib/crazyflie/__init__.py26 symbols
cflib/crazyflie/mem/__init__.py24 symbols
test/utils/test_multiranger.py23 symbols
test/positioning/test_position_hl_commander.py23 symbols
examples/qualisys/qualisys_hl_commander.py22 symbols

For agents

$ claude mcp add crazyflie-lib-python \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact