Command smoothing and Interpolation

Overview

Commands are sent to the slaves with a step size that depends on the master’s update rate. In EtherCAT, these steps are usually in intervals of 250 µs to 8 ms while other protocols may have even slower rates.

These steps may cause audible noise or even instability when a controller is tightly tuned.

Fast command changes and slow update rates increase the negative effects on control performance.

To improve the quality of the trajectory, the input command can be shaped with a finite impulse response filter.

This filter somoothes the control values from the previous to the current target, smoothing out the input and preventing spikes in the derivative around the target changes.

This feature can be used in all position and velocity control modes:

  • Cyclic synchronous position mode

  • Cyclic synchronous velocity mode

  • Profile position mode

  • Profile velocity mode

  • Homing mode

Side Effects

Attention

This feature introduces delay to the control input therefore it’s important to close the control loop in the servo drive directly. If the control is closed on the master, this feature would introduce a lag that may affect that controller’s stiffness.

Note

All axes on the chain must be commanded together and should have the same FIR settings.

Applications

Input interpolation

The master is configured to use the distributed clock so that all input commands are equally spaced in time. The FIR filter is set to operate such that the filter order is equal to the number of control cycles between two successive target command updates. This ensures the command is fully respected, since the last step of interpolation hits the requested point.

Pros

  • The controller “ramps up” to the next commanded position instead of seeing a step function.

  • The controller can be tuned much tighter than it would normally

  • Removes noise that can occur when a tightly controlled system receives a step input.

Cons

Jerk limiting

When the input trajectory contains undesirable discontinuous or aggressive motion, the performance of the mechanical system can be unsatisfactory.

Fixing the input trajectory can be difficult if the trajectory is built from sensor input and dynamically updated. Some trajectory generators are very basic, and smoothing the input is ideal to avoid poor motion.

The FIR filter should be set to smooth the input to the desired magnitude. Higher filter order will result in a smoother trajectory. Lower filter order will result in closer following of the input command.

Pros

  • An easy way to avoid the need for complex trajectory generators on the master.

  • Stable smoothing that guarantees settling on the input command by the end of the filter order.

Cons

  • Smoothing will prevent the actuator from following the commanded trajectory, which may be problematic when part of a trajectory needs to be followed closely while other parts should be smoothed.

  • End effector precision may be poorly affected for robots with serial kinematics.

Note

The disadvantages above can be mitigated by slowing the trajectory in areas that need more precision.

Communication jitter mitigation

When no distributed clock is available, the clocks on the slave and master devices will drift, and this will cause a cycle to periodically either miss a command, or complete before the command arrives to the controller. This will effectively either double the input command or see no change to the input command. This creates a discontinuity that is twice the magnitude of the normal command steps.

Set the filter to an order similar to what should be chosen for input interpolation.

Pros

  • While distributed clock and interpolated input will yield the best performance, using the FIR filter here will also smooth the discontinuities caused by communication jitter.

  • The filter order can be boosted for additional smoothing if the communication delays are severe.

Cons

  • See Side Effects

  • The trajectory is not guaranteed to match the input, since large steps will still cause “bumps” in the command. These bumps will be much less aggressive, but they won’t be entirely removed from the input.

  • Extra smoothing will always yield extra deviation from the original command.

Detailed Description

A boxcar filter with rectangular gains is implemented, equivalent to a moving average filter (MAF). A moving average filter is equal to a linear interpolation if the filter order is equal to ratio between master and slave sample time - 1.

Filter~ order = \frac {master~ cycle~ time} {slave~ sample~ time} -1

An example of the filter order for a master with 1 ms cycle time and 250 µs cycle time SOMANET slave:

3 = \frac {1 ms} {250 \mu s} -1

The filter order is defined in multiples of 250 µs (e.g. 3 for a master with a 1 ms cycle), 3 is the default value that suits applications with 1 kHz EtherCAT masters perfectly. This number defines the length of the ring buffer that will be used as a MAF storage. At each 4 kHz cycle, the values in the buffer are summed up and divided by the buffer length to produce the output.

Command smoothing

../../../../../_images/FIR_trajectory_smooth.png

Usage

In object 0x2027, the expected update rate and/or desired smoothing can be configured:

  • Subitem 1 switches the feature on (1) or off (0)

  • Subitem 2 selects the order of the filter

The Order is allowed between 0 (no action) and 31. The filter is enabled by default with an order of 3.

The order reflects the amount of steps the algorithm “looks back”.