Skip to content

yousefh409/149-final-proj

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Glove-Controlled Drone Flight

CrazyFlie 1.0 Issues

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.

Getting Drone to Connect with the Radio:

Required Materials

  1. The CrazyFlie 1.0 and corresponding Radio Transmitter
  2. Python 3
  3. cflib version 0.1.1 (can be easily installed with pip install cflib==0.1.1)
  4. (Optional, only if debugging is necessary) BitCraze VM version 2017.03.

Testing

  1. 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()

Debugging

  1. 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.
    1. Boot up into the VM (Read Required Materials).
    2. Set drone into firmware flash mode:
      1. Ensure Radio USB is plugged in, and drone is powered.
      2. Open the cfclient application (Shows as Crazyflie Client on the Desktop).
      3. Along the top bar of the cfclient application, navigate to the tab connect > bootloader.
      4. Put the drone in bootloader-mode.
    3. Build & Flash Crazyflie 1.0 Firmware.
      1. Navigate to /home/bitcraze/Desktop/projects/crazyflie-firmware
      2. execute make PLATFORM=CF1 cload (documented within the firmware's README).
      3. If above doesn't work, then you may need to go inside the cfclient application and select the correct package to install.
  2. 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

  1. 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.
    1. The topmost module is documented in cflib.html. If you go open that file, the submodules shown include CrazyFlie, which is necessary to control the drone.
  2. 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.

Notable Quirks

  1. If drone doesn't fly:
    1. The drone needs to be powered only by battery (cannot be connected to USB)
    2. In the Python code, the line cf.commander.send_setpoint(0, 0, 0, 0) where cf is type CrazyFlie, needs to be set before the drone can receive motion directions.
    3. Radio can sometimes freeze. Usually fixes itself when unplugging and replugging, and powering the drone off and back on.
  2. Cannot run bluetooth (or any other asynchronous data collection) together with sending movement information to the CrazyFlie!
    1. Fix using Python's subprocess library. We have provided example boilerplate code here. The file to run is recv.py while printer.py just outputs information to stdout.

About

Final Project EECS149

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •