I'm searching pc controlled quadrotor code projects. I tried to do strangedev's project but not works for me. Is any one test this project. PID commands works like relays. suddenley speeds up and down. I tried to tune PID constants with Ziegler nichols but no success. Is there any realy working code and setup. Can you share your experiences?
1 Answer
I've not used the (unmaintained) code you reference, but if a PID is responding much too fast in a new system, cut the parameters down significantly, first focusing on P and later I. Turn off the D, and the I terms, then slow the P down until it is behaving reasonably. Once Proportional control is working then try bringing I up in proportion to the change you did with P.
The https://github.com/strangedev/Arduino-Quadcopter/blob/master/quadcopter/quadcopter.ino#L62 code starts with (P,I,D) values of (0.5,0,1), so back off to (0.25,0,0) or (0.05,0,0) or lower to get the speed or response more as you expect, and then experiment.
Higher P will make it faster and saturate to the PID limit values quicker and make it more-relay like. If your system is in a relay-like bang-bang mode, then Zeigler-Nichols tuning will be hard to do well. Reduce P until you get a non-relay-like response. Show your code and add in some print/debugging to see what sort of pitch values give you what sort of outputs. PID isn't magical, if you want a pitch measurement of -30 to cause a control output of +10, P=10/(-30)=0.3 might be a good starting point.
The way the unmaintained code looks, value of P=20 will saturate at your output limits of +/-20 with only a pitch measurement of +/-1 degrees.
Show your actual code and values in your question, slow down the PID, and add debugging output.
-
I did it with ziegler-nichols. But it behaves like relay. I tried pitch tuneup with increase of P slowly but each P constant from 0.1 to 20 gives suddenly speed up. Also sample time change gives nothing.– acsCommented Dec 17, 2015 at 22:56
-
Higher P will make it faster and saturate to the +/-100 values quicker and make it more-relay like. If your system is in a relay-like bang-bang mode, then Zeigler-Nichols will be hard to do well. Reduce P until you get a non-relay-like response. Show your code and add in some print/debugging to see what sort of pitch values give you what sort of outputs. PID isn't magical, if you want a pitch measurement of -30 to cause a control output of +10, P=10/(-30)=0.3 might be a good starting point.– Dave XCommented Dec 18, 2015 at 9:36