Many motion applications require high accuracy during and at the completions of moves. Even with perfectly optimized PID (proportional, integral, derivative) values to control position, the compensation loop is never perfect because it must manage the influence of many system forces.
Can we improve performance by adding control elements external to the PID loop? Yes. Here we consider torque control and the related subject of torque feedforward — which can make systems run more smoothly and deliver better accuracy.
Current loop is standard
A typical electronic motor control scheme includes a profile generator, PID position compensator, and current loop. Current flowing through the motor is ultimately what generates the motor's actual torque output.
Some simpler controls dispense with the current loop and directly output a voltage command to the motor, which in turn creates current in the motor coils. However, the relationship between voltage at the motor's coils and actual current flowing through the motor can be rather complicated. Therefore, for the majority of motion control applications, a current loop should be used.
This loop measures and actively attempts to control the motor current. Modern controllers perform this task digitally, using sensors, analog-to-digital converters, and one of several current-sensing schemes, depending on the target drive cost and performance. More accurate schemes continuously measure or infer the current through each leg, while simpler schemes measure one current for the whole motor.
Imperfect tracking and one control solution
Assume we set up our position PID loop and start the machine moving. Despite much fine-tuning of PID parameters, we find that we cannot perfectly track the desired profile. There always seems to be a lag, or overshoot, particularly while the machine is in motion.
Why? One reason is that for a PID loop to output anything, it must have an error upon which to operate. Therefore, by definition the motion has position error. Another reason is that real-world systems must balance the objective of high accuracy with the need for stable, nonoscillating motion over all profiles and loads. PID gains ultimately represent a compromise between these two goals.
If there were some way of giving the motion controller more information about the machine, perhaps we could ease the burden of the PID loop, and reduce position errors.
In fact, this is possible. Let us now discuss methods for adding a torque command directly to the PID output — to help reduce the burden on the PID loop. Our goal is to compensate for machine or motor forces that we know about in advance, thereby reducing the torque command output needed from the PID.
Types of compensation
The simplest possible kind of torque feedforward is a constant bias in the target torque command. The classic configuration that benefits from this is a vertical axis that is influenced by gravity. The optimal output bias for this application generates a torque just large enough to lift up the axis so that the PID loop, at least in theory, doesn't have to compensate for the force of gravity.
In the practical world, several factors don't allow perfect compensation. For starters, load masses are often variable. In addition, motors and mechanisms do not behave exactly the same, even if built to tight tolerances. Therefore, in adding a torque compensation value, our expectation should be to lower, but not eliminate, the amount of work that the PID loop must do.
In addition to a constant bias value, what additional terms can help zero-out forces experienced by the machine? Enter two popular feedforward approaches — velocity-proportional and acceleration-proportional.
Any force induced by the movement that can also be determined in advance by the controller is a candidate for feedforward compensation. In the case of velocity-proportional feedforward, a variety of frictional forces can counteract the machine's motion in a way that is proportional to the axis velocity. If we can determine the magnitude of these forces, we can compensate for them.
The same principle applies for acceleration-proportional forces, beginning with the tendency of the machine's load to resist being moved. If the mass of the machine load is known, then we should be able to feedforward an acceleration-proportional torque that pre-compensates for the force generated by the inertia of the load, also called reflected torque, during acceleration and deceleration.
The figure showing position error with no feedforward compensation includes the application of velocity and acceleration feedforward. As it turns out, there is no need to explicitly measure these on-the-fly machine forces. The PID loop, in its efforts to keep up with the commanded profile, shows us the torque output needed to compensate. Note that the technique is made simpler by zeroing the I term, and using just the P and D terms.
Analyzing the shape of the servo lag allows one to determine if a machine is experiencing velocity-proportional lags, acceleration-proportional lags, or both. As before, because loads may change and machines vary, we hope to lower the servo lag, but don't expect it to be zero.
Machines that are built with orthogonal actuators, such as X-Y stages, have simple reflected forces for which it's relatively easy to compensate.
However, some robot configurations, such as PUMA-style articulated robotic arms found in car factories, have much more complicated reflected torques, and include variables such as centripetal forces. Also, for these robots, as arms rotate, the previously constant reflected forces due to gravity may change.
In theory, with enough information about the robot, load, and motion profile, we can compensate for these forces. In the rarefied world of high-end articulated arms, such kinematic transformations and torque compensation techniques are common.
Even fancier techniques may be applied. For example, building an “observer” allows dynamic performance tracking to infer what the load is, or how friction affects aging machine components over time. While useful in specific industries, such exotic techniques are generally not provided by off-the-shelf motion controllers.
Correction at the motor
Another major category of forces for which we can electronically compensate comes from the motor itself. This is because motors, whether rotary or linear, do not provide perfect conversion of current flow into generated torque. Several sources of torque output bumpiness are to blame; this bumpiness get injected into machine mechanisms, making the job of the PID compensator more difficult.
One such source is detents, which are easily felt in a step motor as regular bumps during rotation. With brushless dc motors, these bumps are fewer per rotation, but just as undesirable. By mapping the torque profile of a motor through one complete electrical cycle, it is possible to develop compensating motor commands (yet another form of feedforward) that can counteract these detents.
Note that step motor positioning accuracy can be improved with a similar technique. At a fine resolution, even when presented with a perfect sinusoidal waveform, step motors do not move in exact increments. Small adjustments to the microstepping drive Sin/Cos lookup table can improve microstepping accuracy.
If all of this sounds intimidating, in the case of brushless dc motors, choosing a slotless motor is a good option (no slotted iron laminations in the stator), as it eliminates most detents. With step motors, there are skewed rotor techniques that help minimize detents. Both motor types tend to cost more, but may be the best choice based on the application.
On the other hand, once the motion controller moves to a software-based platform such as a DSP (digital signal processor), these techniques add zero cost. So in circumstances where motor cost is an issue, or just to take performance to the next level, designers should consider electronic compensation.
Making output linear
To close the discussion of torque compensation, we come to techniques that attempt to linearize a motor's torque output.
As it turns out, as a motor rotates, it does not output exactly the same torque, even when presented with a constant current. Torque output, depending on the motor, can vary ±20% within one full electrical revolution.
Fully correcting for all operating conditions, torque values, and rotation positions is complicated. But for delicate applications, a small torque-proportional compensation term for various motor phase angles can improve motor linearity significantly, and therefore reduce torque ripple injected into the mechanism.
To the laboratory
Check out the youtube.com video — Torque Control Deep-Dive Video 1 — which features a rotary brushless dc motor exhibiting modest but measurable detents.
Can an electronic compensation technique described above improve the performance of this low-cost motor? Yes.
Note that it is actually much easier to feel torque output than it is to see it; in fact, it is rather uncanny to twist the output shaft of a motor like the one featured in the video — and feel its detents disappear when a compensator is switched on.
In the video, the motor shaft is connected to a pulley, and wire is wound around the pulley to run it into to a sensitive hand-made scale consisting of a rubber band with an indicator glued to it. As the motor spools out, the thin elastic stretches by an amount proportional to the force required to move the motor — determined by the motor's torque output at that position.