To properly design a complex motion controller, you need to know what PID is all about.
John Mazurkiewicz
Product Line Manager
Baldor Electric
Fort Smith, Ark.
EDITED BY Miles Budimir

Proportionalintegralderivative, or PID, control is the most common type of controller used in industry.
Depending on the specific application, any of the three components of PID can be implemented alone or in combination with another.
A proportional controller is the simplest and easiest to understand. In a typical system using proportional control, a desired setting or setpoint is compared to the output feedback signal. The difference between these two signals is the error signal. The proportional controller amplifies this error signal, using it to drive the system actuator to bring the output to the setpoint.
Proportional control, however, has limitations. A proportional controller cannot achieve a zero steadystate error. Increasing the gain in the system can decrease the steadystate error somewhat. However, when the gain is too high, the system overcorrects and may cause instability. Because a proportional controller cannot reduce the steadystate error to zero, it is used primarily in processes where gain can be made sufficiently large to reduce steadystate error, while at the same time maintain stability.
Proportional plus integral control
In systems where the amount of error generated from a proportional controller cannot be tolerated, a technique is needed to respond to the steadystate error and drive it toward a smaller value, ideally zero. This technique is known as proportional plus integral, or PI, control.
A PI controller continuously adds up or integrates the error. An integrator by itself, with a constant input, would essentially provide an ever increasing output signal. However, used in conjunction with a proportional controller, as the error signal is integrated, the proportional control drives the error to a smaller value. It accomplishes the same effect as a large gain in a proportional controller without the adverse effect on stability. Thus, PI control is used in systems where the steadystate error must be reduced to smaller levels than with proportional control alone.
Because the integral section of the control operates within a specific reaction time, as the error signal approaches zero, the output from the proportional section goes to zero. However, because of the time constant, there could be a significant output from the integrator. This output causes the error to cross zero and create an error in the opposite direction. The error crossing zero produces overshoot which may cause instability. This tendency increases as the proportional gain increases and the integral reaction time or time constant is reduced.
A PI controller is used primarily in applications with frequent load disturbances and a minimum of setpoint changes. In practical applications using a PI controller, the proportional gain is set somewhat smaller than for a proportionalonly control. The integral time constant is adjusted to provide either one overshoot or no overshoot.
Proportional plus derivative control
Integral control is added to decrease long term or steadystate error. However, the faster and larger the process error, the greater the overshoot becomes, and the longer it takes to settle to an acceptable level. To deal with fast response times and large errors, derivative control is added.
Derivative control reduces the amount of time required for the output to return to the setpoint. It also reduces initial overshoot and has a stabilizing effect by damping the overshoot or oscillation. This permits the proportional gain to be set at higher values than with proportionalonly control, and improves response time to system disturbances.
Derivative control is always used with proportional or PI control because it isn't capable of maintaining the error signal under steadystate control. It is used in applications that have sudden and relatively large disturbances.
PID control
Each of the three above individual controllers has advantages. The proportional controller is the basic model. Increasing proportional gain to improve response produces instability. Integral control adds a complement which has a major effect on reducing long term errors. The derivative control has a major effect on transient disturbances when the proportional controller cannot respond fast enough.
The PID controller reduces steadystate error and responds rapidly to moves. Each has its own adjustment, and the various control adjustments interact.
Starting with the proportional control, gain is adjusted as high as possible to obtain adequate response to a change. When the integral component is added, the proportional gain must be reduced. If the integral reaction time constant is too fast (integral gain too large), it tends to become unstable. Adding the derivative component lets the proportional gain increase.
Feedforward
In applications where the controller must compute and react quickly, it may happen that the controller cannot drive the error to zero fast enough to maintain precise position control. To overcome this, another technique called feedforward is used. This is a predictive type of control. In a typical feedbackcontrol system with an inner velocity and a outer positioncontrol loop, velocity and acceleration feedforward is added after the position loop to the velocity loop. Predictive control depends upon earlier conditions, thus the signal has to bypass the position loop. In other words, the setpoint is compared to the next step in the process rather than the output. Highspeed servopositioning applications, such as some robotics and XYZ positioning systems, make use of this technique.
Tuning for an application
Tuning a controller refers to adjusting individual control parameters. This is first tested offline with no load attached, then switched online with a load or the process running. The parameters of the PID are fine tuned to obtain the best response for the application. In a typical motioncontrol application with a velocity and position loop, the velocityloop parameters must first be adjusted then the positionloop parameters.
If the gain is increased too much, the system becomes unstable and rings or oscillates. A motor typically produces an audible noise when the gain is set too high.
Reducing the integral gain eliminates the overshoot and still maintains zero steadystate error.  The commanded motor speed of 2,000 rpm and the actual speed of the motor are shown in the figure. Using proportional control produces a significant steadystate error and a slow response time. 
To reduce the steadystate error, increase the proportional gain or add an integral component to make a PI controller. Adding an integral component reduces the steadystate error to zero, but may cause some overshoot.  With overshoot reduced, both gains can be adjusted to reduce the response time or time up to speed. This might cause a small amount of overshoot to reappear, but the improvement in response time usually more than compensates for it. 
To implement a series of CW or CCW motions, similar to a pickandplace application, the motor position must follow the motion profile closely. With no controller action, the move does not accurately follow the commanded motion profile. Also, the response time is slow.  Increasing the position loop gain reduces the response time of the motor. However, the actual shape of the response still does not follow the commanded profile. 
To reduce the response time, some velocity feedforward is added. This greatly improves the motor's ability to follow the commanded profile.  Increasing the velocity feedforward gain forces the actual motor position to follow exactly the commanded motion profile. However, as load inertia is added or acceleration rates are increased, acceleration feedforward must be included as well. 
A typical motioncontrol application contains a position as well as a velocity feedback loop. Velocity feedforward can be added to improve the system response. Acceleration feedforward can be added as inertial load increases or when the acceleration rates increase. 