Measurements, Setpoints, Errors and Ouputs
To start with, let's define some terms commonly used to describe control systems:
Measurement  This is typically the value of the parameter you are trying to control. It could be temperature, pressure, speed, position or any other parameter. Before you can control anything, you have to be able to measure it.

Setpoint  This is the desired value for the parameter you are trying to control.

Error  This is the difference between the desired value and the measured value.

Output  This is a value calculated based on the error. It is fed back into the system to 'correct' the error and bring the measurement closer to the setpoint.
Types of Control
There are many ways in which the output value can be calculated. We'll discuss a few of the more common ones.
On/Off Control
In this type of control, the only values for the output are ON or OFF. This is how the thermostat in your house works. If the measured temperature is below the setpoint temperature, it turns on the heat. If the measured temperature is above the setpoint, it turns it off. To prevent rapid cycling which could damage the system, there is typically some gap between the 'on' threshold and the 'off' threshold. This is called 'hysteresis'.
An On/Off controller with hysteresis s sometimes called a "Differential Gap Controller". That sounds pretty sophisticated, but it is still a very primitive type of controller.
On/Off control works well for controlling the temperature of your house, but it is not very good for applications like robot motion control.
PID Control
You have probably heard of PID controllers. PID stands for Proportional, Integral and Derivative control. So a PID controller is actually 3 types of controller in one. Because of this, PID control is fairly versatile. But not all applications require all three forms of control.
Many socalled PID controllers are actually just operated as PI, PD or even just P type controllers. Motion Control applications like the Pixy Pet generally use mostly P or PD control.
Proportional Control
Proportional control allows for a much smoother response than simple on/off control. Proportional control calculates an output value that is proportional to the magnitude of the error. Small errors yeild a small response. Larger errors result in a more aggressive response.
Proportional control can be used alone, or augmented with Integral or Derivative control as needed. The Pixy object following code uses only proportional control. The object tracking code uses both proportional and derivative control.
Integral Control
Integral control integrates the error over time. If the measurement is not converging on the setpoint, the integral output keeps increasing to drive the system toward the setpoint.
Integral control is good for nudging steady, predictable processes closer to perfection. Since Pixy Pet needs to always respond quickly to random unpredictable movements, integral control is not appropriate.
Derivative Control
Derivative control looks at the rate of change in the error. If the error is rapidly approaching zero, the output of the derivative calculation attempts to slow things down to avoid overshooting the setpoint.
The Pixy object tracking algorithm uses derivative control in conjunction with the proportional control to help prevent overcorrection when tracking objects.