PID Controller

Since the last post, I have added a PID Controller to the quadcopter in the hope of stabilizing the oscillations experienced from my last test. I have also notice that the application causes a considerable amount of CPU load which intern has an adverse effect on flight and data communication. For this reason I have spent some time optimizing code and removed one of the three threads that were running.

I have been using a PID controller for python located here, However I have been unsuccessful in tuning it, In order to ensure I have a firm grasp of how these controllers work I decided to build one in C# from scratch.


PID Test

As you can see from above the controller is fully functional, the main thing I learnt was how simple PID controllers actually are. Implementing the c# test application did not take very long at all. I have since ported the code to python for use on the quadcopter, to replace the existing one I’m using, Hopefully this will rule out external code as the problem source.

As far as tuning is concerned I have been using the Ziegler Nichols method of tuning, Where initially the Integral (Ki) and Derivate (Kd) are set to zero and the Proportional (Kp) gain is then slowly increased from zero until output of the controller oscillates at a ultimate gain (Ku), When oscillations level out. The ultimate gain and time constant (Tc) of oscillates is then used to set the gains using a table.

Thus far I have unsuccessful in tuning but intend to continue working on the problem over coming days and weeks until it solved as it is a key part of my project.

 

Leave a Reply

Your email address will not be published. Required fields are marked *