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.
Scaling Commanded Thrust as a Function of Height
-
- Beginner
- Posts: 4
- Joined: Tue Mar 19, 2019 6:01 pm
Re: Scaling Commanded Thrust as a Function of Height
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.
-
- Beginner
- Posts: 4
- Joined: Tue Mar 19, 2019 6:01 pm
Re: Scaling Commanded Thrust as a Function of Height
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
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.
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.