Resources / Articles / Feedforward in Motion Control - Vital for Improving Positioning Accuracy

Feedforward in Motion Control - Vital for Improving Positioning Accuracy

~ Chuck Lewin

Introduction

Many motion applications require high accuracy both during, and at the end of, the move. But even if you have perfectly optimized PID (proportional, integral, derivative) settings to control the servo loop the resultant motion is never perfect because it must manage the influence of a wide range of system forces.

Can we improve performance by adding control elements outside of the servo compensation loop? The answer is yes, and in this paper we will look at various methods for applying the technique of feedforward to make your system run smoother and deliver better accuracy.

In the end, what we will discover is that the more we know about the machine mechanics, the load, and the environment, the more we can utilize feedforward to improve system performance. While some applications will not require the use of feedforward or related special control techniques, increasingly, as systems are asked to deliver more accurate, more efficient, and faster motion, these techniques are gaining in popularity.

Loop me in

Any discussion of feedforward begins with the control loop. Figures 1a and 1b show two popular control loops. The first is the old standby the position PID (proportional, integral, derivative) loop, and the second is a velocity loop, which generally uses just a PI (proportional, integral) filter.

Most point-to-point positioning systems use the position PID loop, while many spinning and pumping applications use the velocity PI loop. Higher performance position control applications may actually use both, with the position loop operating as an outer loop feeding a command value to the velocity loop which functions as an inner loop. This arrangement is called a cascaded position velocity control loop. While a bit more complex to tune, it can sometimes provide a helpful extra level of control for improved smoothness and stability.

Position Control Loop

Figure 1a: Position PID loop

PI Velocity Loop

Figure 1b: Velocity PI loop

What's the current situation?

In the diagrams above you will notice that both the position PID loop, and the velocity PI loop output to what is called a current loop. The current loop is yet another control loop, but one that accepts a desired current (torque) command, measures the actual current through the motor coil(s), and runs a PI (proportional, Integral) loop to command the motor voltage in such a way that the actual current through the motors coils equals the commanded current. A typical current loop is shown in Figure 2.

PI Current Loop

Figure 2: PI Current loop

 

Some simpler servo control systems dispense with the current loop and directly output a voltage command to the motor, which in turn creates current in the motor coils. As it turns out though the relationship between the voltage at the motor’s coil connection and the actual current flowing through the coil can be rather complicated.

Why is this? Well in short, it's because when rotating, current is induced back into the motor coils resulting in a distortion of actual current flow relative to desired current flow. This effect is sometimes given the shorthand name back EMF (Electro-Motive Force), which most engineers interpret as a reduction of the effective voltage proportional to rotation speed.

That is indeed one overall effect of induced current in the coils, but in fact the millisecond by millisecond distortions of the current waveforms through the coil are much more complicated than this. Multi-phase motors such as Brushless DC type in particular are sensitive to these distortions because they result in the effective electrical angle of the stator being shifted, which in turn means commutation is inefficient, wasting energy and generating excess heat in the motor.

So for most motion control applications a current loop is used. Modern motion controllers perform this task digitally, using Hall sensors or sense resistors and either comparators or A/Ds (Analog to Digital converters). Several different current control schemes can be used depending on the desired performance of the drive. More accurate schemes continuously measure the current through each leg, while simpler schemes measure one current for the whole motor.

We're go for launch

OK, so now we are finally ready to spin our wheels. We've set up our position PID loop (we'll keep things simple and assume just a position PID loop rather than a velocity loop) and started the profile generator moving. Immediately though, despite a lot of fine tuning of PID parameters, we find that we cannot perfectly track the desired profile at the load. There always seems to be a lag during the accel phase, and overshoot during the decel phase.

Why is this? One reason is that for a PID loop to output anything, it must have an error to operate on. So, by definition, the motion will have a non-zero position error. Another reason is that real-world systems must balance the desire for high accuracy with the need for stable, non-oscillating motion operating over all executed profiles, and all loads. PID gains ultimately represent a compromise between these various goals.

If there were some way of giving the motion controller more information, perhaps we could ease the burden on the PID loop yet still reduce position error. It turns out that there is, and this brings us to the main topic of this article.

From an algorithmic perspective achieving this in the control loop is actually quite simple, as shown in Figure 3. What we will do is introduce feedforward by simply numerically adding it to the PID position loop output, thereby modifying the current (torque) loop command (or the velocity command if a cascaded position/velocity loop is used).

Notice that the contribution of these terms is not influenced by anything measured in the actual system, such as the encoder position. Feedforward terms by definition are outside the servo loop and depend on our knowledge of how the system will react to changes in desired motion profile or other factors. The better our feedforward value(s) anticipate the torques the motor will experience as it moves, the less the servo loop must do and the more accurate and responsive the machine performance will be.


Position Control with Feedforward
Figure 3: PID diagram with feedforward terms added

I’ve fallen and I can’t zero my servo error

The simplest possible kind of feedforward is a constant bias in the desired torque command. In figure  this is shown as the "Static Bias" term. The classic configuration that benefits from this is a vertical axis that is influenced by gravity. The optimal output bias for this application would generate a torque just large enough to lift up the axis when carrying the load so that the PID loop, at least in theory, doesn’t have to do anything to compensate for the force of gravity.

In the practical world, several factors do not allow perfect compensation. Load masses are often variable, and motors and mechanisms do not behave exactly the same, even if built to tight tolerances. So, in adding a torque compensation value our expectation should be to lower, but not eliminate, the amount of work that the PID loop has to do.

Beyond a static feedforward torque command, Newton's laws of motion and the desire to compensate for friction quickly bring us to the use of two additional feedforward terms; velocity proportional feedforward and acceleration proportional feedforward. These terms are calculated by multiplying the output of the appropriate variable of the profile generator with a programmable scale factor.

In the case of velocity feedforward, there are various kinds of frictional forces that may counteract the machine’s motion proportional to the velocity of the axis. If we can determine the magnitude of these forces, we can compensate for them. The same applies for acceleration proportional forces, beginning with the tendency of the machine’s load to resist a change in velocity. If the mass of the machine load is known, then we should be able to feed-forward an acceleration proportional torque that pre-compensates for the force imparted by the mass of the load during accel and decel.

Axis Moving Through Trapezoidal Motion Profile

Figure 4: Axis moving through a trapezoidal move profile

Figure 4 illustrates a typical application, showing the position error with no feedforward compensation applied, velocity feedforward only applied, and both velocity and acceleration feedforward applied.

How do I correctly set feedforward gains? Using figure 4 as a guide, looking at the shape of the servo lag with no feedforward compensation allows you to determine if your machine is experiencing velocity proportional lags, acceleration proportional lags, or both. Once you determine what kind of forces are at play your job is to tweak the feedforward gain settings until the servo lag is minimized. You may want to make a few back and forth runs of the axis and average the data to get the most accurate average feedforward scale value.

As before, because loads may change and machine mechanisms vary, we hope to lower the servo lag, but don’t expect it to be zero.

Angle on Reflected Torque

Figure 5: The effect of arm angle on reflected torque

 

Kinematics we talk?

In the above discussion we ignored more kinematically complex machines. Machines that are built with orthogonal actuators, such as an X Y stage, have simple reflected forces that are relatively easy to compensate for.

Some robot configurations, however, such as PUMA-style articulated arms (these are the types of robots you see welding cars in factories) have much more complicated reflected torques and include entirely new forces such as centripetal force. Also, for these robots, as arms rotate, previously constant reflected forces such as gravity may change. Figure 5 provides a simple diagram that illustrates this point. The reflected gravity-compensating torque required for the motor at position 1 is quite different than at position 2.

In theory, with enough information about the robot, the load, and the motion profile, these forces can be compensated for, and in the rarified atmosphere of motion controllers for high-end articulated arms such kinematic transformations and torque compensation techniques are common.

Even fancier techniques may be applied such as building an ‘observer’ that looks at performance dynamically to infer what the load is, or how friction changes from machine components that are aging over time. While useful in specific industries, such exotic techniques are generally not provided by general purpose off-the-shelf motion controllers.

Even fancier techniques may be applied such as building an ‘observer’ that looks at performance dynamically to infer what the load is, or how friction changes from machine components that are aging over time. While useful in specific industries, such exotic techniques are generally not provided by general purpose off-the-shelf motion controllers.

White Paper
You may also be interested in: Motion Kinematics

 

Compliance with me

So far we have looked at constant, velocity proportional, and acceleration proportional feedforward terms. These schemes are all about how the load, both when moving and when not moving, reflect a force back onto the motor and therefore affect the position control loop.

There is a broad class of additional feedforward schemes that are less about the load, however, and more about the machine. That is, the gears, the bearings, the linkages and other in-line mechanisms. In this 'interior' world our goal for feedforward will be to correct for the fact that mechanics are not frictionless, infinitely stiff, or even linear.

The first such factor that we will try to compensate for is compliance. Compliance is a broad term reflecting the notion that mechanical linkages, gears, and belts, are not infinitely stiff. So, feedforward for compliance can take different forms depending on whether we are trying to compensate for a flexible arm linkage, a 'squishy' gearhead, or an explicitly compliant component such as a rubber damper.

Whatever the source of the compliance, the goal is always the same - use something that we know about how the system will behave under particular operating conditions to compensate the control loop calculations so that dynamic servo tracking of the actual load is improved.

To illustrate we will model compliance as a simple elastomer. Figure 6 shows such an element schematically in a simple linear actuator.

Model Liinear Axis Linkage

Figure 6: Model linear axis linkage

So what can we know in advance about this compliant linear actuator? What we can know is the effect on deflection of the elastomer (the extent to which it will be compressed or stretched) versus the torque that it experiences. This relationship is shown in figure 7.

Torque versus Displacement

Figure 7: Torque versus displacement for an elastomer

This curve is representative of nearly all compliant elements in its overall form - at low torque the curve is flatter, meaning positional deflection is larger for a given torque increase. But as torque increases the curve is steeper, meaning deflection is smaller for a given torque increase.

The feedforward of champions

Our goal will be to characterize this deflection curve and then generate a feedforward term that injects a compensating signal over the acceleration and load range anticipated for the axis. Figure 8 provides an updated PID loop that is commonly used for compliance cancelling feedforward such as described above.

PID Loop with Feedforward Compensation

Figure 8: PID loop with compliance feedforward compensation

Notice that there are two major changes from our previous loop. The first is that we are going to inject not a torque feedforward value, but a command position feedforward value. Second, we don't introduce it after the PID loop but rather before.

So the overall approach is to use an estimator (or a measurement... read on) for the torque that the compliant element is experiencing, convert this to a deflection, and then add it to the command position. Example table entries for such a table are shown in figure 9. If everything works as planned the altered position will be exactly offset by the motion of the compliant element and the end position of the load will still be perfect.

Torque
Deflection
.3 Nm
57 counts
.2 Nm
45 counts
.1 Nm
32 counts
0.0 Nm
0 counts
-.1 Nm
-32 counts
-.2 Nm 
-45 counts
-.3 Nm 
-57 counts

Figure 9: Simplified lookup table example converting torque to actuator deflection

Most often the conversion from estimated torque to deflection is undertaken by table look up. This is because the form of this curve is seldom easily represented by a simple equation. The real world tends to be messy, particularly if there are multiple compliant elements acting together to affect the final load position. So a lookup table is the most flexible and convenient approach, perhaps encoding 25 to 100 positions with linear extrapolation between points.

Esteeming your estimate

One final question before we implement our control approach is where within the controller to extract an estimate for the torque that the elastomer experiences. The more obvious and certainly the simpler-to-implement approach is from the profile generator. In an idealized system the torque on the elastomer will be proportion to acceleration, which we know the value of from the profile generator.

But there is another way to estimate what the torque is, namely by looking at the command output value of the servo loop. By definition when a torque loop is active the command from the position PID represents the requested torque from the motor. Why might this approach be preferrable? The answer is that the servo loop outputs a command based on what is really happening at the axis, while the profile generator's represents a theoretical value.

For example, if the weight of the load on the axis is different than the one used to calculate the torque on the compliant load, the feedforward value will be incorrect. The output of the servo loop handles this automatically. If the load is heavier the motor command will be larger since that larger torque is what will be needed to track the profile. No estimate of the axis load is required.

But there is a big downside to using the PID loop's torque command as a feedforward term which is that this will contribute to dynamic servo instability. Because of this, ultimately this technique is not used all that often. When it is, the motor command is low-pass filtered before being used as the torque estimate.

In closing this discussion note that most of the effort to compensate for compliance is important for systems that need accuracy during motion. These include robotic arms and machine tool equipment along with other applications. In applications where only the end-of-motion accuracy matters, compliance compensation is rare. This is because at the end of motion, with the axis at rest, the dynamical torque and therefore the compliance-based positional error reduces to near-zero.

Mind your stiction

Another important type of internal error inducing phenomenon is stiction, also called starting friction. Stiction is the tendency of the axis to require a break-away force to get motion started. Depending on the nature of the bearings and actuators used there are a range of real-world sources of stiction including rust, dust, chemical adhesion, Van der Waals forces, and other micro-mechanical adhesion forces that occur between objects in contact when at rest.

Developing a compensation scheme for stiction can be tricky because these forces may change over time, or upon change of environmental conditions such as humidity or temperature. Nevertheless, most stiction compensating schemes use a simple direct feedforward scheme consisting of an impulse function injected into the torque command. In other words when a resting axis is about to begin motion it is briefly pulsed so as to overcome stiction and get motion started. Such a function is shown in figure 10.

Torque Function Waveform

Figure 10: Torque impulse function waveform

Tuning this impulse function must be done carefully. Too much force and the axis will be jolted unnecessarily, inducing vibration into the axis mechanics, while not enough force means the axis won't move, resulting in a time lag until the servo builds up enough error to overcome the stiction. Ultimately, most engineers who try to correct for stiction use a trial-and-error approach to tune the strength and duration of the impulse force.

Before closing it is worth noting that there is another technique that has been used with success for stiction correction known as dithering, and once again this technique uses direct injection feedforward. In this case what is directly fed into the torque command is a bi-polar noise signal. By introducing noise, we are effectively not allowing the axis to settle. The axis instead dithers around the target position due to the noise signal.

Dithering is not widely used because it introduces audible noise and for most motor types induces unwanted vibrations elsewhere in the mechanics. But in some types of special motor drives, for example electro-hydraulic valve controllers, it is a commonly used technique.

Moving right along

We will finish our discussion of feedforward and torque compensation by looking at schemes that correct for positional distortions that come from the motor itself.

Why would one want to correct a motor's torque or position output? The reason is that motors, whether rotary or linear, do not provide perfect conversion of current flow to mechanical torque. There are several sources of torque output ‘bumpiness’, and this bumpiness gets injected into the machine mechanisms, making the job of the PID compensator more difficult.

Similarly for step motors, where torque is less of a concern but position accuracy is paramount, even perfectly applied sinusoids through each coil do not generate exact equal movement increments. There are several reasons for this all having to do with the complexities of the rotor and stator shape and the resultant B-fields (magnetic fields) that create torque.

White Paper
You may also be interested in: Step Motor Noise and How To Fix It

 

So what can be done? The compensation schemes to correct non-linear torque output of servo motors, or non-linear position increments for step motors, broadly follow the same approach already discussed. We will apply a correction scheme based on something we know in advance about the motor to linearize its output.

Unlike most of the earlier schemes described though, equations are almost never used to characterize the correction. Instead, a look up table records the compensating values based on an average of a few rotations and a few different motors.

By mapping the torque profile of a motor through one complete electrical cycle, it is possible to develop compensating motor commands (feedforward) that can counteract detents and other flaws. The input to this table is the rotor position provided by the encoder. By way of example, Figure 11 graphs a compensating table that was constructed for a particular BLDC motor in the PMD lab.

Motor Command Torque

Figure 11: Motor Command Torque Compensation Table Entries

Algorithmically, the values in the table scale the torque command from the PID loop before sending them to the torque loop.

How are these torque table values derived? Several methods can be used including even a fish scale at the end of a lever bar on the motor shaft. For a given fixed torque command, as the motor rotates through fixed small increments, the scale records the actual force needed to hold the motor at that location. A variation of this approach is attaching a string with a weight hanging from it to the lever bar. The weight applies a fixed torque on the motor, and then at small fixed increments the command output is adjusted till the torque actually generated by the motor results in no net rotation force.

Note that the above compensation scheme assumes a single torque-proportional adjustment will fully linearize the torque output. However, particularly for Brushless DC motors with detents, the net torque output is a combination a fixed non-torque-proportional function and the torque proportional function. To compensate for such as system a 2-dimensional table scheme could be used, recording adjustments as a function of both rotation angle and torque command.

The above scheme applies to torque linearization of a Brushless DC or (less commonly) a DC Brush motor, but it is worth noting that step motors that use a high resolution microstepping scheme can have their positioning smoothness and accuracy improved by a similar technique. Instead of a torque compensating table, however, we will use a table that holds a modified microstepping sin/cos lookup table to replace the standard perfectly sinusoidal one.

Particularly for applications involving camera pointing or other applications where the smoothness of motion is critical, pre-compensating the sin/cos microstepping table can result in very meaningful improvements in motion smoothness. And since all we are doing is changing the lookup table values of the microstepping controller, there is usually no increase in computation load.

I challenge you to a dual loop

So far this article has focused almost entirely on compensation schemes applied to the motor control loop resulting, hopefully, in improved tracking and stability at the load. But there is an entirely different control technique that attempts to achieve this same thing. The method is called dual loop, so-named because it uses two encoders per controlled axis; one at the motor and one at the load.

Dual loop control, which is described in more detail in Precision Fluid Handling: Optimizing Lab Automation Mechanics, uses a special servo filter to generate the motor command. There are a number of different dual loop control schemes in use today but most use the motor encoder for stabilization and the load encoder for position control.

Why not use a dual loop all the time? There are several reasons, beginning with the added cost of two versus one encoder per axis. But the larger issue is that while in theory the load tracking can be perfect since we explicitly measure its location, in reality, this is almost never the case. The big challenge is that if there are compliant members in the mechanical linkage it will be difficult to maintain servo loop stability. This is because in this dual encoder scheme there is such a large phase lag between the position measuring encoder and the motor.

Nevertheless, dual loops have found adoption especially in higher end applications. And as it turns out, all of the compensation schemes described in this article still apply. Even with a dual loop scheme feedforward and torque compensation techniques applied at the motor will still improve end point positioning at the load. This is because as stated earlier, the more we can do to reduce the burden on the servo loop (even a dual loop one) the better the performance will be.

Summary

There are a broad range of internal and external machine dynamics that may be candidates for performance improvements using feedforward. The simplest of these include static, velocity, and acceleration proportional compensation. More complex, be still potentially rewarding, are compensation schemes that attempt to reduce the effect of compliance and stiction. Finally, using encoders, it is possible to linearize the torque output of BLDC motors as they rotate, and to improve the smoothness and linearity of step motors.

All of these techniques have the potential to improve the performance of the machine, but seldom provide perfect compensation. This is because in the real world each machine and motor will differ slightly in its behavior. An interesting area of motion control science adds algorithmic observers to the servo compensation scheme in an attempt to automatically map and scale these variations. This active research area may be the subject of a future article, but in the meantime, I hope you enjoyed this walk-through of feedforward techniques.


PMD Motion That Provides Feedforward And Torque Linearization

PMD has been producing ICs that provide advanced motion control of DC Brush and Brushless DC motors for more than twenty-five years. Since that time, we have also embedded these ICs into plug and play modules and boards. While different in packaging, all PMD products are controlled by C-Motion, our easy to use motion control language and are ideal for use in medical, laboratory, semiconductor, robotic, and industrial motion control applications.

ION N-Series Drive

ION/CME N-Series Digital Drives

N-Series ION Digital Drives combine a single axis Magellan IC and a high performance digital amplifier into an ultra-compact PCB-mountable package. In addition to advanced servo and step motor control, N-Series IONs provide S-curve point to point profiling, field oriented control, downloadable user code, general purpose digital and analog I/O, and much more. With these all-in-one devices building a custom controller board is a snap, requiring you to create just a simple 2 or 4-layer interconnect board.

Learn more >>

 

Juno Velocity and Torque ICs

Juno Velocity & Torque Control ICs

The Juno family of ICs are perfect for building your own low cost, high performance controller. Juno's excel at velocity and torque control, with features such as FOC (Field Oriented Control), profile generation, high/low switching amplifier control signal generation, leg current sensing, and more. Available in packages as small as 7mm x 7mm and costing $12 in quantity, these ICs are an ideal solution for your next controller design.

Learn more >>

 

Motion Control Chips

MC58113 Motion Control IC

The MC58113 is part of PMD's popular Magellan Motion Control IC family and provides advanced position control for BLDC, DC Brush, and step motors alike. Standard features include s-curve profiling, programmable breakpoints, two axes of encoder input, FOC (Field Oriented Control), intelligent performance trace, and more. The MC58113 family of ICs are the ideal solution for your next positioning application challenge.

Learn more >>

 

You may also be interested in:

x