Mellinger controller on Python

Firmware/software/electronics/mechanics
kristoffer
Bitcraze
Posts: 256
Joined: Tue Jun 30, 2015 7:47 am

Re: Mellinger controller on Python

Post by kristoffer » Mon May 11, 2020 12:14 pm

Yes, the problem you see is because CLOAD=0, in your case it should be 1.
CLOAD is actually not a good setting to be used as an example since it is rarely changed, I will update the docs. Sorry for the confusion!

Your config.mk file should probably be something like:

Code: Select all

PLATFORM=CF2

# DEBUG is optional, will give a bigger binary that takes longer to flash
#DEBUG=1

# CLOAD should be 1 in most normal use cases. 1 is also the default value, so there is no need to set it here
#CLOAD=1

# Enable this to force the mellinger controller to be used
# CONTROLLER=Mellinger
To create my controller, I just add a line with my file name in the same folders as the others controllers files?
or how can I add my controller to the firmware?
You need to:
1. Add the file in the same folder as the other controllers. Let's call it eduardoController.c
2. Add it in the make file, for instance on this line https://github.com/bitcraze/crazyflie-f ... efile#L174 Note the name here should be eduardoController.o
3. Add a new entry in the enum after the INDI controller (for instance ControllerTypeEduardo), https://github.com/bitcraze/crazyflie-f ... ller.h#L35

After that you are good to go (I think :-))

You can activate your controller by setting the

Code: Select all

stabilizer.controller
to 4, in runtime,
or force it in the make config with

Code: Select all

CONTROLLER=Eduardo
I saw some .o files in crazyflie-firmware/bin that I don't know how they are created, could you help me ??
This is how make works. A Makefile describes what we want, for instance some object files (*.o). Somewhere else in the Makefile there is a description of how to produce an object file by compiling a C file. When make is running it will see that there is an .o file missing and it will try find the corresponding C file to compile it. You can read more about make here https://en.wikipedia.org/wiki/Make_(software)



EduardoAguilar
Beginner
Posts: 14
Joined: Tue May 05, 2020 2:05 am

Re: Mellinger controller on Python

Post by EduardoAguilar » Wed May 13, 2020 4:22 pm

Hi Kristoffer thank you for the answer.

Yes, the problem you see is because CLOAD=0, in your case it should be 1.
CLOAD is actually not a good setting to be used as an example since it is rarely changed, I will update the docs. Sorry for the confusion!
No problem all its okay.


I have my controller already upload on the firmware, but I have some warnings on my code, are conversions float to double, I'm correcting it.

I have some questions, can you help me?


1. When I used the eduardo Controller on cflib will i select '4' for use my controller?

2. I don't understand this part to change the controller, Will i just write the next command in the other terminar?
You can activate your controller by setting the

kimberly
Bitcraze
Posts: 322
Joined: Fri Jul 06, 2018 11:13 am

Re: Mellinger controller on Python

Post by kimberly » Thu May 14, 2020 10:58 am

stabilizer.controller is a parameter value. Please check the documentation on how to set this from the cflib: https://www.bitcraze.io/documentation/r ... rameters-1

EduardoAguilar
Beginner
Posts: 14
Joined: Tue May 05, 2020 2:05 am

Re: Mellinger controller on Python

Post by EduardoAguilar » Thu May 14, 2020 3:19 pm

Thank you Kimberly I wiil check the documentation.

Post Reply