Jump to content

PID control demo


Recommended Posts

For a school project, I made a demonstration of PID controllers. It's kind of primitive, but here it is. (Mostly-up-to-date source code here.)


When you start it, it creates three windows (since I didn't know how to get everything into one window).


The biggest window is the graph. The blue line is the target value, the red line is the controller's output. The green lines (if there are any) are the distance the controller can be pushed by the random noise selected. The straight red line at the bottom is the zero mark, and the red line across the middle is the controller's output.


To the right is the help window. It has a list of the parameters that can be changed, and next to each one is a short description of what it does. Note that the "historyLength" parameter is ignored.


To the bottom of the graph is the input window. Commands are entered in the form <parameter>=<value>, where parameter is one of the things named in the help window, and value is a (possibly decimal) number. For example, to set the proportional term to 0.9 I would type "p=0.9" and hit enter to run it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...