PID Controller Demos

This is a Processing.js web-based version of my PID controller following a sinusoidal displacement. The red target moves back and forth according to a sin law. It's linear and angular velocity are adjustable by the large buttons. Hovering the mouse over the button will display the resulting velocity in case of click.

The green follower knows nothing of the behavior of the target. It simply measures the horizontal and vertical distances between the target center and its own center and feeds them to the 2 PID controllers as error input with a setpoint of 0. Each PID calculates a new velocity (horizontal or vertical) for the follower.

The radius of the follower is is a weighted maximum for the last 10 cycles. The idea is to keep the radius as small as possible.

The values of Kp,Ki,Kd were empirically determined by means of the Ziegler-Nichols method. You can manually adjust the Kp,Ki,Kd parameters to see the consequences on the follower's behavior.