Closed andre-paraense closed 4 years ago
What would be the correct way to add a new possibility of a controller to be chosen by the user in the firmware? I believe there is an implementation of a different possible controller already (Mellinger) so maybe there is already an interface to add new controllers. If you can point me to the process of how to add a new possibility, or maybe to the PR or commits which added the Mellinger, it would be very helpful.
Hi Andre,
Great! Let's get this working on the crazyflie :)
Did you look at the first commit of the mellinger controller already? 2a87f5ac84242ac9956d2828a30928bea327d079
Hi, Kimberly!
Yes, I did. It helped me understand where things are located inside the folders organization, thank you. However, I think the PR Add option to switch controllers dynamically is closer to what I wanted to understand, which is how to add a new controller option through established interfaces. Is this the right direction?
Oh yes definitely :) good find!
I haven't implemented the controller myself but you can tack the contributors to those PR's to this thread if you have any specific questions.
Hi, @knmcguire ! We have some doubts, maybe you can help us or point someone that could give us a hint.
1 - Is it possible to change the controller during flight?
2 - We inferred from the other implemented controllers that the desired roll rate is already calculated somewhere else, as it can be accessed like this:
We understand there should be a gain on the attitude error that produces the desired rate. It would be good if you can point us to that such that we can change its value if needed.
Hi!
Let me see if I can answer it for you:
1- yes it seems so! modules/src/stabilizer.c has the following lines of code (l. 267)
// allow to update controller dynamically
if (getControllerType() != controllerType) {
controllerInit(controllerType);
controllerType = getControllerType();
}
You can change this with the stabilizer.controller parameter
@knmcguire can you help me understand exactly what are these modes in the setpoint?
I had to double check myself so I asked around in the office. These modes are to indicate if a setpoint would need to be handled in position mode (modeAbs) or velocity mode (modeVelocity). So you can check the following line as a reference:
So here in the hover command you can see that the z setpoint is handled in position mode and the x and y setpoint are handled in mode velocity. It is indicating which value needs to be controlled by the PID controller in which dimensions.
Does this make sense to you?
Yes, thank you Kimberly!
Hi @knmcguire . I opened a PR for the first version of this INDI controller.
Cheers!
@knmcguire closing this as the PR has been merged.
@andre-paraense i need to talk to Dr. Smeur. I have a self driving car using INDI. Please share his contact info with me if it is ok. I need help with adaptive INDI or to just have a pro advice. i use inner 15, effectiveness 15, outer 3.5-14.99 increasing with speed, and time 3.75-5.5 increasing with speed. thanks!
This issue is a request for a new controller for Crazyflie, an Incremental Nonlinear Dynamic Inversion (INDI) controller.
The original problem we had was to be able to Fly Crazyflie 2.1 inside a 200mm pipe, and kimberly pointed us to the works of Dr. @EwoudSmeur:
I have talked to Dr. Smeur and he is willing to collaborate in the implementation of an INDI controller for the Crazyflie. I will try to do something under his guidance, and he might have some of his own student on it as well.
There is no guarantee that this controller will have success in our original problem, but we consider it is a good next step in trying to solve it and in the worst case we will have contributed to the community with a more sophisticated controller for dealing with gust disturbance.
We are opening this issue as part of the contribution guide steps, in order to start a discussion on this implementation with the community. Please feel free to start any discussion here and to help and guide us in the best way to implement the controller so it will fit well inside the firmware. After having implemented it, we will open a pull request referencing this issue.
Now let's get to work. :)