Page 1 of 1

Mellinger and PID controllers

Posted: Tue May 04, 2021 12:31 pm
by fede_tiberti
Hi, I have a crazyflie 2.0 with the flow deck 2.0... I would like to compare the two controllers with a simple script. Is it possible?
I know that the problem with the Mellinger could be the position, but can I manage it in some ways?

I have already installed the latest firmware version (2021.03)

Thanks ;)

Re: Mellinger and PID controllers

Posted: Wed May 05, 2021 7:56 am
by kristoffer
You can change controller using the stabilizer.controller parameter
The available types are defined in https://github.com/bitcraze/crazyflie-f ... .h#L31-L37

PID = 1
Mellinger = 2
INDI = 3

You can find an example of how to set the parameter from python here https://github.com/bitcraze/crazyflie-l ... el.py#L147

Re: Mellinger and PID controllers

Posted: Wed May 05, 2021 2:42 pm
by fede_tiberti
Yes, I knew this.. maybe I didn't ask the right question, sorry.
The question is: Can I use different controllers, besides the PID, with only the flow deck 2? If yes, how can I do?

Does the Mellinger could have problems with the position? Unfortunately I don't have a positioning system, like mocap or LPS.

Re: Mellinger and PID controllers

Posted: Thu May 06, 2021 11:46 am
by kristoffer
Ah, I see. The mellinger is more sensitive to errors in the position estimate and it is mainly useful with a good mocap system. I do not know a lot about the INDI controller, but I don't think it works without some tweaking.

I think the PID controller is the best option for the flow deck, it is robust and forgiving.

I have not tried a flow deck and the mellinger controller my self, but you can try to switch to the mellinger and see what happens. In worst case you will crash :-)

Re: Mellinger and PID controllers

Posted: Fri May 07, 2021 11:08 am
by fede_tiberti
I've already done several attempts.
Using the client, I'm able to takeoff with the Mellinger controller. I set '2' on the parameter stabilizer.controller and then I click "Take off" from the "Command Based Flight Control" window. No problem, it works very well. Also to land of course.

But when I execute the script, with the Mellinger, it does not work. Probably I'm not using the right class.
Which library does the client use to execute the commands?

Re: Mellinger and PID controllers

Posted: Mon May 10, 2021 1:30 pm
by kristoffer
As mentioned before, the mellinger controller requires very good position estimation and the flow deck is probably not good enough.

I did a quick test my self with the autonmouse_sequence_high_level.py script, it contains a line that is commented out that switches to the mellinger. I did see the same problem and I could not complete a full figure 8 with the mellinger + flow.

I also tried with the client and switched to the mellinger controller using the param tab and used the Command based flight control buttons. It actually worked surprisingly well but was a bit shaky from time to time. I tested on the 2021.03 release.
Note: there is a known bug with the flow deck that makes the CF move backwards 1.5 m after take off when clicking one of the arrow buttons (https://github.com/bitcraze/crazyflie-f ... issues/760)

Re: Mellinger and PID controllers

Posted: Tue May 11, 2021 1:52 pm
by fede_tiberti
Thanks, but I don't understand which class the client uses.
Do your autonmouse_sequence_high_level.py script and the client use the same library? If yes, which?

Because I would try the library that the client uses (when I click takeoff) with a script, but the problem is that I don't know which class the client uses.

Re: Mellinger and PID controllers

Posted: Tue May 11, 2021 2:48 pm
by kristoffer
Ah, I see. The client uses the PositionHlCommander, you can find it here https://github.com/bitcraze/crazyflie-c ... ab.py#L436

Re: Mellinger and PID controllers

Posted: Wed Dec 01, 2021 5:44 pm
by TallyFeli
Hi....I absolutely need to ensure assuming that you have approved your control design as we are attempting to execute it in Simulink to tune the regulator in a reproduction… Are there different issues than the IP+D issues in the position and demeanor circles?

Re: Mellinger and PID controllers

Posted: Mon Dec 06, 2021 12:14 pm
by kimberly
@TallyFeli,

This thread has concluded a pretty long time ago, so if you still have any questions or concerns I highly recommend for you to start a new thread and also provide more information about your situation.