Skip to main content

Setting of Filter in Servo Mode

JAKAAbout 6 min

Setting of Filter in Servo Mode

Introduction

Users can set filter types by changing the values of the parameter FILTER_TYPE in the configuration file SERVOMOVE in usersetting.

The value of FILTER_TYPE can be set as:

  • 0: use no filter;
  • 1: LPF_1ST, the first level low-pass filter in joint space;
  • 2: NLF_JOINT, the third level non-linear filter in joint space;
  • 3: MMF_JOINT, the multi-order mean filter in joint space;
  • 4: NLF_CART, the third level non-linear filter in Cartesian space;
  • 5: NLF_MMF_COMB, velocity predictive filter (non-linear and multi-order mean combined).

Filter of joint space is effective for both joint movements and Cartesian movements, while filter of Cartesian space is effective only for Cartesian movements.

Ways of calling:

  • By using SDK;
  • By using Python script.

LPF_1ST

To use this type of filter, users need to set the cutoff frequency by setting the values of parameter LPF_CUTOFF_FREQ: the lower the value is, the more smooth the movement would be. And vice versa.

Filter effect when the cutoff frequency is 0.1 and 0.5
Filter effect when the cutoff frequency is 0.1 and 0.5

When tested on real robot, the result shows that if the value of LPF_CUTOFF_FREQ is set to 0.1, the robot movement would be very smooth, while its positioning accuracy might be lost.

As the value increases, the positioning accuracy increases too, but the robot movement would get less and less smooth.

When the value is set to 40 and above, no obvious difference showed on the robot movement.

Therefore, if there's no special requirements on positioning accuracy, but the priority is smoothness and stableness, low values are recommended.

NLF_JOINT

This type of filter is an online S-curve planner that tracks the target based on jerk, acceleration, and velocity limits.

When using this filter, 3 parameters are required to be set:

  • NLF_MAX_VR: joint velocity limit. The unit is °/s.

    This parameter is related to the velocity of the filter planner. The higher the parameter's value is, the faster the filter planner will be.

  • NLF_MAX_AR: joint acceleration limit. The unit is °/s².

  • NLF_MAX_JR: joint jerk limit. The unit is °/s³.

If these 3 parameters are set to default value (NLF_MAX_VR=120; NLF_MAX_AR=180; NLF_MAX_JR=720), then the velocity curve of the planner would be rather smooth. As shown below:

The higher the jerk limit, acceleration limit and velocity limit are, the better can the planner to track the target.

But a high jerk limit would cause velocity oscillation with a high amplitude. Therefore, the most suitable value would be less than 2000.

Example:

If the values are:

  • NLF_MAX_VR=120
  • NLF_MAX_AR=720
  • NLF_MAX_JR=5000

Then the robot's velocity curve would be like:

Robots run in actual working scenarios show that when using this filter type, the positioning accuracy of robots is underperformed, while the movement smoothness increases as the parameter values increase.

Therefore, this type of filter is suitable to be implemented in working conditions that require a low level of accuracy and high level of smoothness.

MMF_JOINT

When using this filter, 4 parameters are required to be set:

  • MMF_MAX_BUF: the buffer range of mean filter. If this value is set to be less than 3, then the movement plan might fail. If the value is set to be more than 100, the controller might be overloaded, causing a possible lag in movement plan. The larger the value is, the longer the lag might be.
  • MMF_KP: position filter coefficient.
  • MMF_KV: velocity filter coefficient.
  • MMF_KA: acceleration filter coefficient.

These 3 filter coefficients are the major parameters, through which can adjust the position tolerance between original command and the command after the filter takes effect.

Velocity curve when the parameters are in reasonable range:

Velocity curve when the parameters are not in reasonable range:

Robots run in actual working scenarios show that the filter coefficients cannot be negative, and the range should be within 0-1, otherwise the robots might have severe shakings, joint overcurrent and controller outage.

Adjusting the coefficients within the reasonable range shows no obvious effect on the robots. The positioning accuracy and movement response are fine while the smoothness might underperform with noticeable shakings and pauses when powered on and off.

NLF_CART (Cartesian Space)

This type of filter is an online S-curve planner that tracks the target based on maximum jerk, and only takes effect on servop.

When using this filter, 6 parameters are required to be set:

  • NLF_MAX_VP: the end linear velocity limit. Unit: mm/s.
  • NLF_MAX_AP: the end linear acceleration limit. Unit: mm/s².
  • NLF_MAX_JP: the end linear jerk limit. Unit: mm/s³.
  • NLF_MAX_VR: the end pose velocity limit. Unit: °/s.
  • NLF_MAX_AR: the end pose acceleration limit. Unit: °/s².
  • NLF_MAX_JR: the end pose jerk limit. Unit: °/s³.

If the values are:

  • NLF_MAX_VP=1000
  • NLF_MAX_AP=500
  • NLF_MAX_JP=800
  • NLF_MAX_VR=120
  • NLF_MAX_AR=180
  • NLF_MAX_JR=720

Then the robot's velocity curve would be like:

Like NLF_JOINT, higher limits for velocity, acceleration, and jerk improve target tracking capability. However, excessively high limits for velocity, acceleration, and jerk can lead to severe velocity fluctuations. It is recommended to keep the jerk limit below 5000.

Example:

If the values are:

  • NLF_MAX_VP=1000
  • NLF_MAX_AP=3500
  • NLF_MAX_JP=5000
  • NLF_MAX_VR=120
  • NLF_MAX_AR=180
  • NLF_MAX_JR=720

Then the robot's velocity curve would be like:

Since this mode calculates position through integration, cumulative errors may occur. If the parameters are set too large, it may result in continuous minor movements, causing oscillations around the target position without being able to stop.

Users need to set the appropriate parameters according to the actual working scenarios.

NLF_MMF_COMB (Cartesian Space)

This type of filter takes effect only on servop.

When using this filter, 2 parameters are required to be set:

  • MMF_KP: position filter coefficient. When the value is set to be low, the movement would be smooth with a loss in positioning accuracy. When the value increases, the reaction time is shorter with a higher positioning accuracy. But the movement might be shaky, especially when the raw data contains a high level of noise.
  • MMF_MAX_BUF: this represents the range of the buffer for the mean filter. A larger buffer results in smoother output but leads to greater accuracy loss and longer planning lag time.

Users need to set the appropriate parameters according to the actual data conditions.

Testing Result on the Real Robot

When using these filters on real robot, the results show that LPF_1ST has the best effect on servoj movement while NLF_MMF_COMB has the best effect on servop movement.

Tips:

Green: slight changes

Yellow: moderate changes

Pink: significant changes

Filter typeParametersNumber of positions (original number: 1352)Change of curve
First level low-pass filter (LPF)Cutoff frequency (cutoffFreq): 0.21377 (+25)The curve fluctuates greatly but remains smooth.
Cutoff frequency (cutoffFreq): 0.5The curve fluctuates slighty and is relatively smooth.
Cutoff frequency (cutoffFreq): 0.8The curve fluctuates greatly.
Non-linear filter (NLF)Max velocity (max_vr): 21356 (+4)The curve fluctuates greatly and tends to shape as a straight line.
Max acceleration (max_ar): 2
Max jerk (max_jr): 4
Max velocity (max_vr): 101364 (+12)The curve fluctuates greatly and tends to shape as a diagonal line.
Max acceleration (max_ar): 10
Max jerk (max_jr): 20
Max velocity (max_vr): 401369 (+17)The curve fluctuates greatly and almost loses the original shape.
Max acceleration (max_ar): 40
Max jerk (max_jr): 80
Multi-order mean filter (MMF)Max buffer (max_buff): 41371(+19)The curve fluctuates slightly.
Position filter coefficient (kp): 0.25
Velocity filter coefficient (kv): 0.25
Acceleration filter coefficient (ka): 0.25
Max buffer (max_buff): 41367 (+15)The curve fluctuates slightly.
Position filter coefficient (kp): 0.5
Velocity filter coefficient (kv): 0.5
Acceleration filter coefficient (ka): 0.5
Max buffer (max_buff): 41357 (+5)The curve fluctuates slightly.
Position filter coefficient (kp): 1
Velocity filter coefficient (kv): 1
Acceleration filter coefficient (ka): 1
Velocity predictive filter (speed_foresight)Max buffer (max_buff): 21353 (+1)The curve fluctuates slightly.
Position filter coefficient (kp): 0.5
Max buffer (max_buff): 4
Position filter coefficient (kp): 1
Max buffer (max_buff): 61354(+2)
Position filter coefficient (kp): 2
Last update: