This is a little Processing sketch I wrote for playing with the parameters of a PID controller. Getting an interactive, visual feedback of the response can go a long way when trying to figure out the dependency between the values and the effect on the system.
Changes to the parameters on the right will update the simulation instantly. Use the horizontal slider to change the set position (the position the controller wants to reach). The vertical slider changes the slope for the car to simulate an asymmetrical system. Right-clicking a slider resets it.
The graph at the bottom displays some system states over time. Dark grey is the set point, blue is the current position and green is the motor force.
The little force vectors draw over the car are the separate components that went into the controller reaction.
Red for proportional, green for integral and blue for derivative.
The motor in this case is a "super motor", it reaches its desired torque instantaneously. I might add a better model for this later on to get a more realistic response.
For a general explanation see the PID controller wikipedia page. It's pretty good.
Find the source code below.