The drone used in this project was the absolutely deprecated CrazyFlie 1.0, since it was the only model that was available for check-out. This caused no small list of problems, and we hope that our below documentation of the workarounds would be useful for any future projects that require the CrazyFlie 1.0.
- The CrazyFlie 1.0 and corresponding Radio Transmitter
- Python 3
- cflib version 0.1.1 (can be easily installed with
pip install cflib==0.1.1
) - (Optional, only if debugging is necessary) BitCraze VM version 2017.03.
- First, make sure the radio is connected to the computer, and the drone is on. If this example code prints the drone is connected, great! Everything works and you can skip to Documentation and start coding. Else, go to Debugging.
# import logging
import time
import cflib.crtp
from cflib.crazyflie import Crazyflie
from cflib.crazyflie.syncCrazyflie import SyncCrazyflie
# URI to the Crazyflie to connect to
uri = 'radio://0/120/250K/E7E7E7E7E7'
def simple_connect():
print("Yeah, I'm connected! :D")
time.sleep(3)
print("Now I will disconnect :'(")
return None
if __name__ == '__main__':
# Initialize the low-level drivers
cflib.crtp.init_drivers()
with SyncCrazyflie(uri, cf=Crazyflie(rw_cache='./cache')) as scf:
simple_connect()
- If unluckily, the python code does not print that the drone is connected, you probably have to flash the correct firmware to the crazyflie. The general instruction to flashing firmware is documented here. Aside from specific files, library versions, and commands for the CrazyFlie 1.0 (documented below), most of the workflow still applies.
- Boot up into the VM (Read Required Materials).
- Set drone into firmware flash mode:
- Ensure Radio USB is plugged in, and drone is powered.
- Open the
cfclient
application (Shows asCrazyflie Client
on the Desktop). - Along the top bar of the
cfclient
application, navigate to the tabconnect > bootloader
. - Put the drone in
bootloader-mode
.
- Build & Flash Crazyflie 1.0 Firmware.
- Navigate to
/home/bitcraze/Desktop/projects/crazyflie-firmware
- execute
make PLATFORM=CF1 cload
(documented within the firmware's README). - If above doesn't work, then you may need to go inside the
cfclient
application and select the correct package to install.
- Navigate to
- If step 1 still does not resolve the issue (flashing drone firmware), then either the drone is smoked, the radio transmitter is borked, or you have some other issue.
- Documentation for the CrazyFlie 1.0 is sparse. The only way we got ours was autogenerating it from the
cflib==0.1.1
library. We provide those autogenerated documentation here. Feel free to download them and view them in your browser of choice.- The topmost module is documented in
cflib.html
. If you go open that file, the submodules shown includeCrazyFlie
, which is necessary to control the drone.
- The topmost module is documented in
- Additionally, to make using and finding the necessary functions easier, we also recommend using a Python LSP when coding. The one we used was Pyright and can easily be installed as a VSCode extension, or just a standalone LSP server for use with other editors like Neovim.
- If drone doesn't fly:
- The drone needs to be powered only by battery (cannot be connected to USB)
- In the Python code, the line
cf.commander.send_setpoint(0, 0, 0, 0)
wherecf
is typeCrazyFlie
, needs to be set before the drone can receive motion directions. - Radio can sometimes freeze. Usually fixes itself when unplugging and replugging, and powering the drone off and back on.
- Cannot run bluetooth (or any other asynchronous data collection) together with sending movement information to the CrazyFlie!
- Fix using Python's subprocess library. We have provided example boilerplate code here. The file to run is
recv.py
whileprinter.py
just outputs information to stdout.
- Fix using Python's subprocess library. We have provided example boilerplate code here. The file to run is