/pycffirmware

Python module wrapping control and state estimation loops of the Crazyflie firmware for Ubuntu, macOS, and Windows

Primary LanguageCGNU General Public License v3.0GPL-3.0

pycffirmware

This project contains a python wrapper for the source code for the firmware used in the Crazyflie range of platforms, including the Crazyflie 2.X and the Roadrunner. This project is meant for simulation of on board controller response to sending commands from a ground station.

Installation

Clone this repo.

git clone https://github.com/utiasDSL/pycffirmware.git
cd pycffirmware/

Initialize submodules.

git submodule update --init --recursive

Ubuntu

Install SWIG for your machine. Ensure that the install location is added to your path variable.

sudo apt update
sudo apt -y install swig

Install NumPy, gcc, and make.

pip install numpy
sudo apt install build-essential

Navigate to and run the build script.

cd wrapper
chmod +x build_linux.sh
./build_linux.sh

macOS

Install brew.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install NumPy, SWIG, the gcc compiler and make command.

pip install numpy
brew install swig
brew install gcc 
brew install make

Also run xcode-select --install if prompted.

If gcc is installed in a different location than /usr/local/bin/gcc-12 you will need to edit build_osx.sh to reflect this. You can find the install location using

locate */bin/gcc-*

Navigate to and run the build script.

cd wrapper
chmod +x build_osx.sh
./build_osx.sh

Windows

Install SWIG for your machine. Installation instructions can be found here. Ensure that the install location is added to your path variable.

Install NumPy.

python -m pip install numpy

Install Visual Studio. Make sure to include C++ and MSVC build tools.

Navigate to and run the windows build script.

cd wrapper
build_windows.bat

Use

This module wraps parts of the firmware that are considered "value changing" when it comes to commands. These are the modules of the firmware that could change the intended values for a positional command to fit with Crazyflie constraints. These include:

  • Controller
  • High level commander and planner
  • State estimator (coming soon)

An example of how one can use this package can be found in safe-control-gym.


University of Toronto's Dynamic Systems Lab