Page 1 of 1

Scaling Commanded Thrust as a Function of Height

Posted: Tue Mar 19, 2019 6:05 pm
by controlsysdes
Hi there,

I'm trying to scale the commanded thrust to the motors as a function of height. However, I'm not sure how to implement such a function and where to add it in the code. Does anyone have some experience with this? Please let me know.

Thank you.

Re: Scaling Commanded Thrust as a Function of Height

Posted: Wed Mar 20, 2019 9:00 am
by arnaud
The interesting part of the code for that is the stabilizer loop, it is the loop that runs the controllers and eventually controls the motors: https://github.com/bitcraze/crazyflie-f ... zer.c#L190. You can add a function there that modify the thrust in the control structure. One place to quickly hack would be to modify the power distribution directly: https://github.com/bitcraze/crazyflie-f ... on_stock.c.

Re: Scaling Commanded Thrust as a Function of Height

Posted: Thu Mar 28, 2019 9:18 pm
by controlsysdes
Thanks for your response. What about the position_controller_pid? There is already a section at the bottom of the code related to thrust scale and feedforward term.

Re: Scaling Commanded Thrust as a Function of Height

Posted: Fri Mar 29, 2019 7:47 am
by arnaud
This is also a possibility, basically you want to affect the control structure, where to put the code is mode a question of where does it fit logically.

Without having more precision about what you want to achieve, I would think that if your code is PID-specific then adding it in the PID code makes sense, if it could work with any controller (like the Melinger controller), then I would think that calling a function in the stabilizer loop makes more sense.