The Crazyflie is setup to use the Makefile in the root of the firmware folder. Several settings can be specified on the command line when running make
. The common ones for compilation are listed here.
Specify the controller to use
To specify the controller to use during flight, set the CONTROLLER
flag when running make, make CONTROLLER="Student"
. This command will build with the student controller.
The name of the controller is defined in the controller.c file at:
static ControllerFcns controllerFunctions[] = {
{.init = 0, .test = 0, .update = 0, .name = "None"}, // Any
{.init = controllerPidInit, .test = controllerPidTest, .update = controllerPid, .name = "PID"},
{.init = controllerMellingerInit, .test = controllerMellingerTest, .update = controllerMellinger, .name = "Mellinger"},
{.init = controllerINDIInit, .test = controllerINDITest, .update = controllerINDI, .name = "INDI"},
{.init = controllerStudentInit, .test = controllerStudentTest, .update = controllerStudent, .name = "Student"},
};
During startup the crazyflie will record a message in the console that it is using a non-standard controller:
CONTROLLER: Using Student (4) controller
How to add new files to the build path
When creating new source files, they will need to be added to the Makefile in order to compile with the rest of the firmware.
- Create a new file in crazyflie firmware folder
- Add the to be generated .o file to the makefile's list of project objects, ex:
PROJ_OBJ += student_controller.o
on line 181 ofMakefile
- Note: As the make file executes it generates dependencies for each files based on the
#include
preprocessor command. These dependency files are automatically placed in/bin/dep/
folder.
- Note: As the make file executes it generates dependencies for each files based on the
- run
make
to ensure the new file is included in your build