Dusty Robotics utilizes the ION/CME N-Series Drive
LEARN MORE
Resources / Articles / Feedforward in Motion Control - Vital for Improving Positioning Accuracy

Feedforward in Motion Control - Vital for Improving Positioning Accuracy

Chuck Lewin
Founder and CEO
Performance Motion Devices, Inc.

Feedforward is a powerful motion control technology for the all-important task of improving positioning accuracy. In this article we will introduce traditional control approaches such as acceleration feedforward, but also show how table-driven feedforward techniques can correct for mechanical linkage compliance and motor torque fluctuations in both servo and stepper-based systems.

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 for the position 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 article we will look at the motion control technology that applies the technique of feedforward to make your motion system deliver better accuracy.

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

It Begins with the Position Control Loop

Any discussion of feedforward begins with the servo control loop that translates output values from the trajectory generator into downstream commands to the amplifier. Figures 1a & 1b show two popular control loops. The first is a position PID control loop (Proportional, Integral, Derivative), and the second is a velocity loop, which generally uses just a PI (Proportional, Integral) filter.

Most positioning servo motor controllers use the position PID control loop, while many spinning and pumping applications provide motor velocity control using the velocity PI loop. Some 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 especially if a tachometer or other direct velocity measurement device is used.
Position Control Loop

Figure 1a: PID Position Control Loop Diagram

fig2-pi-current-control-loop-diagram-rev2

Figure 1b: PI Velocity Control Loop Diagram

 

Current Control Loop

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 within the servo motor controller, 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 motor’s coils equals the commanded current. A typical current loop used one for each motor coil is shown in Figure 2.

fig2-pi-current-control-loop-diagram-rev2

Figure 2: PI Current Control Loop Diagram

Some simpler servo control systems dispense with the current loop and directly output a voltage command to each motor coil. 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 more complicated than what one would expect from a simple application of Ohm’s law using the motor coil resistance. This is because when rotating, voltage is induced back into the motor coils, resulting in a distortion of actual current flow relative to desired current flow. These effects, if not countered by an active current loop, can lower motor drive efficiency and responsiveness.

Adding Feedforward to the Control Loop

OK, so we've set up our position PID loop (we'll keep things simple and assume just a position PID loop without a velocity loop) and start 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 acceleration phase, and overshoot during the deceleration 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 was some way to give the motion controller more information, perhaps we could ease the burden on the PID loop and reduce position error. It turns out that there is, and this brings us to the main topic of this article, feedforward.
From an algorithmic perspective introducing feedforward into the control loop is quite simple, as shown in Figure 3. Feedforward terms are numerically added to the PID position loop output, thereby modifying the current (torque) loop command.

Notice that the contribution of these terms is not influenced by anything measured in the actual system, such as the encoder position. Feed forward 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 motor axis will be.

Position Control with Feedforward

Figure 3: PID Position Loop with Feedforward

Trajectory Proportional Feedforward

The simplest type of feedforward is a constant bias in the desired torque command. In Figure 3 this is shown as the "Static Bias" term. The classic configuration that benefits from this is a vertical axis that must counteract the force of gravity. The optimal output bias for this application would generate a torque just large enough so that the position PID loop, at least in theory, doesn’t have to do anything to compensate for the force of gravity. The static bias current value handles this by itself.

In the practical world several factors get in the way of 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 static (or any type of) feedforward term our expectation should be to lower, but not eliminate, the amount of work that the position loop has to do.

Beyond static feed forward, 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 corresponding parameter of the profile generator with a programmable scale factor and then adding them directly to the current loop command.

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 axis load to resist a change in velocity. If the mass of the load is known, then we should be able to determine an acceleration proportional torque that pre-compensates for the force imparted by the mass of the load and connecting linkages during acceleration and deceleration.

fig4-4-graphs-rev2

Figure 4: Progressive Application of Velocity and Acceleration Feedforward

Figure 4 illustrates such a process, showing the PID loop position error during a trapezoidal motion profile with no feedforward compensation applied, velocity feedforward only applied, and both velocity and acceleration feedforward applied.

How do I set the velocity and acceleration feedforward gains? Using Figure 4 as a guide, examining 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, the goal is to lower, but not eliminate, the servo position error using feedforward.

A Real-World Feedforward Application

The graph below shows a point-to-point profile move from a real-world motion control application. The yellow line represents the commanded trajectory velocity, and the green line represents the position error (the difference between the commanded and the actual position).

Notice that despite the fact that the axis is accelerating and decelerating quite aggressively (the entire move duration is less than 200 mSec) the motion is stable throughout and the tracking accuracy is quite good even during the motion, varying from -5 encoder counts to +5 counts.

Feedforward-Pro-Motion-Screenshot-A-1

This image is taken from PMD’s Pro-Motion Application Development Software used in combination with a PMD N-Series ION Intelligent Drive operating at a 20 Khz sample rate controlling a three-phase Brushless DC motor.

Nevertheless, an application of acceleration feedforward can reduce the dynamic tracking error even further. The reason acceleration feedforward improves tracking accuracy here is that from the position error graph above we can see that the form of the position error mimics the form of the trajectory’s commanded acceleration. Conversely, there is no clear velocity-proportional component to the position error and thus the velocity feedforward gain will be set to zero.

After applying an optimized acceleration feedforward gain the results are shown below. Although the tracking is not perfect, the magnitude of the position error is nearly halved during the motion, with the maximum position range now reduced to a range of -3 to +3 counts.

Feedforward-Pro-Motion-Screenshot-B


One caution with feedforward is that it is load specific. If you tune the feedforward gain value by increasing and decreasing till the net position error during motion is minimized, you will find that if the load on the motor changes you will need to re-tune the gain value to achieve a similar result. This means systems that typically carry a variable load may not be good candidates for this type of feedforward.

 

Feedforward Control in Robotic Arms

In the above discussion we ignored kinematically complex machines, assuming control of machines that are built with orthogonal actuators such as linear or XY stages which have simple reflected forces that are relatively easy to compensate for. But some robot configurations such as PUMA style articulated arms (these are the types of robots you see welding cars in factories) have more complicated reflected torques and include entirely new sources of torque seen at the motor such as centripetal force.

For these mechanisms, as arms rotate previously constant reflected forces (such as gravity) may change according to the arm position. 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.

Angle on Reflected Torque

Figure 5: The Effect of Robot Arm Angle on Reflected Torque

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

White Paper
You may also be interested in: Motion Kinematics

 

Control Techniques that Correct for Compliance

So far we have looked at static, velocity-proportional, and acceleration-proportional feedforward terms. These schemes all focus on how the axis load motion reflects force back onto the motor and therefore affects 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’s mechanisms. That is, the gears, bearings, linkages and other mechanisms that connect the motor to the end effector and load.

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 as it moves to add a compensation term to the control loop so that actual positioning accuracy is improved. To illustrate, we will model compliance as an elastomer affecting the end-point positioning of a linear actuator, shown in Figure 6.

fig6-axis-with-elastomer-rev2

Figure 6:  Model Linear Axis Linkage with Compliance 

So what can we know in advance about this compliant linear actuator? What we can know is the deflection of the elastomer (the extent to which it will be compressed or elongated) based on the force it experiences. From the diagram above, when the motor applies a force that is positive (acting in the direction of the load) the elastomer is compressed, and when the force is negative (acting in the direction away from the load) the elastomer is elongated. 

fig7-torsion-range-graph-rev2

Figure 7: Force Versus Deflection for an Elastomer

While specific deflection values are a characteristic of the elastomer and the load, the overall form tends to follow a general pattern; at low force (or torque) the curve is flatter, meaning positional (or angular) deflection is larger for a given force increase, and as force increases the curve is steeper, meaning deflection is smaller for a given increase in force. This is shown in Figure 7.

Compliance-Correction Position Control Loop

The diagram below shows a position control loop with compliance correction. Notice that there are two changes from our previous loop. The first is that we don’t inject a torque feedforward value but rather a command position feedforward value. Second, we don't introduce this new term after the PID loop, but rather before.

PID Loop with Feedforward Compensation

Figure 8: PID Loop with Compliance Feedforward Correction

In this scheme the trajectory acceleration command is assumed to be proportional to the force that will be exerted on the elastomer. This is again from Newton’s laws which state that objects (in this case the load) at rest tend to stay at rest and vice versa.

The commanded acceleration is scaled and used as the lookup index in a table which converts the acceleration to a deflection in counts. This value is then added to the commanded position output by the profile generator to generate the corrected commanded position used by the PID position loop filter. The deflection entries in this table are negated – meaning if the elastomer decreases in length by a particular length in counts a positive deflection value is entered and vice versa.

This is because by increasing (or decreasing) the commanded position by an amount equal to the anticipated reduction (or expansion) of the elastomer dimension, the net final position of the end effector will in theory still be exactly correct. Below is a simplified example of such an acceleration to deflection lookup table:

Acceleration
Deflection
300 revs/sec2
57 counts
200 revs/sec2
45 counts
100 revs/sec2
32 counts
0 revs/sec2
0 counts
-100 revs/sec2
-32 counts
-200 revs/sec2
-45 counts
-300 revs/sec2
-57 counts

Figure 9: Compliance Correction Table

 

Using the Amplifier Current Command for Compliance Correction

In the feedforward scheme above the continuous profile trajectory acceleration value is used to determine the force experienced by the elastomer. In low friction systems where the majority of force comes from the change in velocity of the load, such a scheme works well.

However as frictional forces in the linear actuator (or load) increase relative to the force from change in velocity, this scheme generates a less and less accurate estimate of the force imparted on the elastomer, and therefore the compliance correction becomes less and less accurate.

Is there an alternate scheme to determine the force on the elastomer? The answer is yes. The alternate method is to use the amplifier current command generated by the position loop as the input lookup value to the deflection table.

This works because by definition the command from the position PID represents the torque needed from the motor to execute the requested position trajectory profile. For example, If the load is light and there is little friction in the linear actuator the amplifier current command will be low. And similarly for high friction, high mass systems large command torques from the position loop will be output to achieve the same position trajectory profile.

As convenient as this approach is, it has a significant downside which is that because the position loop current command is inside the servo loop, using it to correct for the commanded position may contribute to servo instability. This problem can be reduced using low pass filtering however, and so for systems operating in harsh or dirty environments which experience variable loads this alternate approach to correction table lookup may be preferred.

In closing this discussion, note that most of the effort to compensate for compliance is important for systems that need accurate positioning during motion. These include CNC machine tools, robotic welding arms, 3D printers, and other applications. In applications where only the end-of-motion accuracy matters, compliance compensation is rarely implemented because at the end of motion with the axis at rest, the torque experienced by compliant members and therefore the amount of compression or elongation of those members reduces to near-zero.

Stiction Compensation

Another important mechanical phenomenon that induces positioning accuracy errors 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 causes 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 a change of environmental conditions such as humidity or temperature. Consequently most stiction compensation schemes use a feedforward term consisting of a simple impulse function injected into the position loop’s 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 into oscillation, while not enough 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 use a trial-and-error approach to tune the strength and duration of the impulse force.

A second technique that has been used with success to counter stiction is known as dithering. Once again this technique uses direct injection feedforward. In this case what is directly fed into the torque command is a noise signal. By introducing noise, we are effectively not allowing the axis to settle and ‘stick’. The axis instead dithers around the target position due to the noise signal.

Dithering is not widely used because it may introduce audible noise and for most actuator 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 common technique.

Correcting Motor Torque Fluctuations

We will finish our discussion of feedforward by looking at schemes that correct for fluctuations of the torque output in the motor itself. In other words, the phenomenon that a constant current command from the controller may not result in constant torque output by the motor as it rotates. This is often called cogging, and electronic correction of this phenomenon is broadly called torque mapping.

What causes motor torque cogging? The answer is that there may be a number of sources of torque output ‘bumpiness’ including the geometry and resultant magnetic fields generated by the motor windings, the motor iron core, and the motor magnets. For BLDC motors an additional source of cogging may be the commutation technique used, with six-step trapezoidal commutation generating bumpier torque output than sinusoidal commutation (also called encoder-based commutation).

Like some of the earlier schemes described, a look up table is the method of choice to correct for motor cogging. By mapping the torque profile of a motor through one complete electrical cycle, it is possible to introduce compensating motor command offsets that can counteract cogging.

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 an actual Brushless motor in the PMD lab. Note that the compensating values entered into the table should be based on an average of a few rotations and a few different motors.

The values entered in the table scale the torque command from the PID loop before sending them to the current loop. So if, at a certain angular position the actual mechanical torque generated by the motor is 4.0 % below the expected amount, the corrected current command sent to the amplifier is increased by a factor of 1.0/0.96 = 1.042

Motor Command Torque

Figure 11: Example Motor Cogging Correction Table Entries

How are the torque correcting table values determined? Several methods can be used to measure motor torque output and create a correction table. These include use of a dynamometer, and use of a scale at the end of a lever bar on the motor shaft, recording the actual torque output by the motor at fixed small intervals of angle.

Note that the above compensation scheme assumes a single torque-proportional adjustment will fully correct the torque output over the full operating range of the motor. Particularly for non-slotless Brushless DC motors however (which have relatively large detent torques even when no current is applied) this assumption may be too simple, and therefore with BLDC motor controllers a two-dimensional correction table may be required. In a 2D lookup table corrections are recorded as a function of both the motor rotation angle and the current output by the amplifier.

What types of applications require this level of torque output constancy and linearity? Systems that use motors for precision torque generation or torque measurement may benefit from torque mapping. In addition, some biotech, semiconductor, and scientific applications may also use torque mapping if ultra smooth rotation is required or if highly calibrated torque output is required.

Dual Loop Position Control

So far this article has focused almost entirely on servo motor 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 control, 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. Another issue is that while in theory the load tracking can be perfect (since we explicitly measure its location), this is almost never actually the case. The challenge is that if there are compliant members in the mechanical linkage it can be difficult to maintain servo loop stability due to the large phase lag between the position measuring encoder and the motor.

Nevertheless, dual loop control has found adoption in higher end applications. And as it turns out, all the compensation schemes described in this article so far 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 discussed earlier, the more we can do to reduce the burden on the servo loop (even a dual loop) the better the tracking performance will be.

Improving Stepper Motor Positioning Accuracy

For stepper motor controllers, positioning is also affected by variations stemming from internal magnetic and physical characteristics of the motor. This means that even if perfect sinusoidal current waveforms are applied to the step motor coils the motor will not make exact equal movement increments.

White Paper
You may also be interested in: How To Control Stepper Motors

 

What can be done to improve smoothness and accuracy from stepper motor controllers? Stepper motors can have their positioning accuracy improved by table-based approaches similar to the torque mapping method described above. Instead of holding torque compensating entries the lookup table holds microstep position offsets. For example, if at a particular commanded microstep position the actual motor is +3 microsteps ahead of where it should be, a value of -3 microsteps is entered into the table so that the corrected actual position of the motor is in theory perfect.

Note that generally these step motor control correction tables do not record a value for every possible lookup input. Most tables hold 32 or as many as 128 entries and use a linear or 2nd-order curve fitting algorithm to look up values between recorded entries.

What types of applications benefit from microstep position mapping? Stepper motor controllers for pan & tilt security cameras often use such techniques to reduce jitter in the camera image when executing a slow pan. In addition, positioning systems such as 3D printers, XY tables, and a wide variety of other scientific, measurement, and printing applications may use a step motor position mapping technique.

Closed Loop Stepper Control

Before closing it’s worth mentioning a control technique for stepper motors that completely decouples characteristics of the motor from the microstepping control scheme used to control it. The technique is called closed loop stepper and it uses an encoder to operate the stepper as a commutated two-phase servo motor. Positioning accuracy comes from the encoder, not the internal magnetics of the motor or the accuracy of the microstepping scheme.

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, and over time operating in the field these differences may grow.

PMD Products That Provide Feedforward and Torque Linearization

PMD has been producing motion control ICs that provide advanced control of DC Brush and Brushless motors for more than twenty-five years. Since that time, we have also embedded these ICs into motor amplifiers, motion control drives, and motion control boards. While different in packaging, all PMD products are controlled by C-Motion, PMD’s easy to use motion control software library 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

ION®/CME N-Series Drives are high performance intelligent drives in an ultra-compact PCB-mountable package. In addition to advanced servo and stepper 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. These all-in-one devices make building your next machine controller a snap.

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. Junos 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 Series ICs

The MC58113 series of ICs are part of PMD's popular Magellan Motion Control IC Family and provide advanced position control for stepper, Brushless DC, and DC Brush motors alike. Standard features include FOC (Field Oriented Control), trapezoidal & s-curve profiling, direct encoder and pulse & direction input, and much more. The MC58113 family of ICs are an ideal solution for your next machine design project.

Learn more >>

 

You may also be interested in:

x