Instructions

This is a simulation of a PID system to control the altitude of a drone.

The helicopter will try to follow the cross (only on the Y direction). Move the cross using the mouse in order to see the helicopter following it. You also can move the helicopter away from the cross using the mouse. Click the helicopter, drag it and release the mouse button. The system will relax toward the cross position.

The slides on right show the value of the PID parameters.

You can change the parameters using the keyboard:

increase Kp: A
Decrease Kp: S
Increase Ki: Q
Decrease Ki: W
Increase Ti (tempo Integracao): Z
Decrease Ti: X

Actually this version has no DIfferential part, so it is a PI, not a PID.

The Kp is the proportional parameter.

The Ki is the integral parameter.

Thrust is applied to the helicopter (positive implies up motion, negative, down motion)

The helicopter is under effect of gravity, so you will notice that the amount of down thrust required by the system is lower.

TempoIntegracao represents the number of cycles of integration. I noticed that this time has to be compatible with the normal mode of the system. Large Ti's causes increase on the number of oscilations. Small either.

A good set of parameters would be:

Ti=7
Kp=-0.1234
Ki=0.02779

Increasing Ki reduces the number of oscilations that occur before the helicopter achieves the desired position. However, a too high Ki increases an undesired instability around the cross. I wonder if it could be atributed to numerical instability.

More negative Kp makes the final position more accurate with respect to the cross, but the lower the Kp, higher the instability.

Notes and Credits