"A proportional–integral–derivative controller (PID controller or three-term controller) is a control loop mechanism employing feedback that is widely used in industrial control systems and a variety of other applications requiring continuously modulated control. A PID controller continuously calculates an error value {\displaystyle e(t)}e(t) as the difference between a desired setpoint (SP) and a measured process variable (PV) and applies a correction based on proportional, integral, and derivative terms (denoted P, I, and D respectively), hence the name."
- Wikipedia
The kRPC mod for Kerbal Space Program is used to remotely control a rocket using Python. The included script uses a PID controller to hover the rocket at a specified altitude. For more information on PID controllers, see:
In the video below, the target altitude was set to 700m. With more optimal choices for the constants k, ki, and kd, the system could stabilize at 700m faster.
Below is a plot of the error (meters) vs time (seconds) for the above video.