
A motion controller performs four fundamental tasks: decoding position feedback, generating the commanded position or motion profile, closing the position loop, and compensating stability.
Of these four tasks, the most fundamental are decoding the motor position and closing the loop. The motor position is determined from the feedback signal, often an incremental encoder, and compared with the commanded position. The difference between the actual and the commanded motor position is known as the position error.
The controller's task is to minimize the position error without oscillating the load. Most often, a proportionalintegralderivative or PID control algorithm can do the job. The output from the PID is applied through the digital to analog converter (DAC) to the amplifier and the motor. Mathematically, the PID algorithm is expressed as:
where the proportional term, KP, affects speed of response, the derivative term, KD, provides stability and damping, and the integral term, KI, determines system accuracy. Adjusting these three coefficients tunes a servosystem for optimum system response.
The motion controller also creates profiling functions, generating a timedependent position function which corresponds to the required velocity profile. Typically, the motion requirements are specified in terms of the total distance, slew speed, and acceleration rate. Because the motor position follows the commanded position, the motion profile controls the motion path and rate. In addition to these basic tasks, an advanced motion controller may perform highlevel functions such as processing commands from a host computer, program sequencing, I/O processing, and error handling. These highlevel functions let the controller operate as a complete standalone machine controller.
Consider an example with the following parameters:
 Kt = 0.1 Nm/A (motor torque constant)
 Jm = 10 ^{4 }kgm ^{2 }(moment of inertia)
 r = 2 (motor resistance)
 N = 500 lines/rev (encoder line density)
 Ka = 3 A/V (amplifier current gain)
Suppose the system is required to be at position zero, but the actual motor position is 20. The controller determines the position error according to the equation E=RC, resulting in an error of 20 counts. The error signal, E, is then processed by the PID control algorithm. Assume for simplicity that the combined gain of the PID control algorithm and the DAC is 0.1 V/count. This implies that an error signal of 20 counts produces a motion command signal, X, of 2V.
The signal X is applied to the amplifier with the given gain of 3 A/V, resulting in a current of 6 A. When the current is applied to the motor, it generates a torque of 0.6 Nm. The positive torque drives the motor forward in the direction that reduces the position error. The applied current produces a torque Tg which equals the product of the current and the torque constant Kt. The generated torque accelerates the motor at the rate where a = Tg/Jm. For the given system parameters, a = 6,000 rad/sec ^{2 }. As the motor moves closer to the commanded position, the error as well as the drive signal to the motor decreases. When the motor reaches the commanded position, the position error drops to zero, as does the motion command signal. No current is applied to the motor while it remains in the correct position. However, when the motor moves away, a correction torque forces it back to the commanded position.
The motor may approach the commanded position in several ways. If the motor approaches the required position from one direction and stops, the system response is overdamped. If, on the other hand, the motor position overshoots the target several times before settling, the response is underdamped. Under some conditions the motor response may oscillate and never stop; such a system is called unstable. The system response is a function of the system hardware and the PID coefficients. The ideal system has minimum rise time, minimum overshoot, and quick settling into the commanded position.
Information for this article was contributed by Galil Motion Control Inc., 3750 Atherton Rd., Rocklin, CA 95765, (916) 6260101, fax: (916) 6260102, (800) 3776329, www.galilmc.com