Created Self Learning PID Algorithm library

I did some research and implemented a self learning PID algorithm. It is located in my cloned repo I really like how it turned out. I hope you all are able to use it with success i'm lacking hardware right now to do further testing. 

For those looking at the repo it is in the libraries/PID/ location.

I couldn't figure out how to add a parameter to the EEPROM memory so it is 95% implemented.

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –


  • Matt how are u grabbing the individual PID gain values? I thought the SLPID controller sums it all up into a single plot?

    I have integrated the SLPID model with a UAV's state space matrix. So far, it isn't working. The SLPID isn't able to stabilize the responses of the MIMO system. it does wonders on a SISO transfer function... but that's it.

  • These are the results from my MATLAB / SIMULINK test. I used a simple transfer function of 1/s+10 with a step input. I did have to add a rate limiter to the derivative because it was exploding when it first got hit with a step.

    I haven't added a rate limiter to the code, but i'm going to. I also need to find a way to monitor values inside my SLPID while i'm doing HIL or SITL tests.


  • Developer

    Out of curiosity, were you able to use the SITL in the cloud?

  • Developer

    Matt, How would you expect this self learning PID algorithm to cope with nested PID control loops? I am thinking that if I used this library for the Stab PIDs and the Rate PIDs it may not work. Thoughts?

    I will try with Rate gains first.



  • Developer

    This is super cool! I made a very caveman-like attempt at this a while back... this is much better.

  • Neat! Something is telling me your apm 2 gonna ship much kicker than you think :D

  • I figured out the param_table.h, c files and generated my new ones that should work with the self learning PID. Located at me cloned repo

  • Here is the self learning PID diagram.


  • 3D Robotics

    Can you tell us more about this? Is it based on ArduPlane or ArduCopter?

This reply was deleted.


sam liked Jimmy Oliver's profile
Aug 25
Mike Whitney liked Mike Whitney's profile
Jul 19
Abdulatif Tlaib liked Ryan's profile
Jun 24