Position Auto-tuning

The general purpose of the position control loop auto-tuning is to design position controller gains based on user specifications and the identified model of the set-up. The procedure calculates gains for cascade controller configurations: PI-P, P-PI.


Before conducting position auto-tung check the following:

  1. The System Identification has been executed successfully
  2. The obtained model corresponds to the current configuration of the system. Otherwise the identification procedure should be repeated
  3. If different sensors are used for position and velocity control and there is a gearbox in between, the gear ratio should be specified
  4. Make sure that the sensors are mounted properly and calibrated


  1. The procedure uses a linear mathematical model of the system. If there are strong nonlinearities there will be a difference between the actual and the requested performance
  2. The auto-tuning procedures tunes only linear controllers. Non-linear control parts should be tuned manually for better performance
  3. Hall sensors should not be used for precise position control

How to use

  1. Select “Controller Configuration” from the menu. Currently, two options are available that have different behaviour:

    1. PI-P configuration (default) focuses on trajectory following. Generally it has faster response, zero steady state error for constant and ramp reference inputs. The control loop bandwidth is higher than the P-PI configuration. However, it tends to overshoot:

    2. P-PI configuration focuses on soft damped step response. It has a slower response and less precise tracking, however it is usually possible to fully avoid overshoot. Additionally, it is more sensitive to noise in the velocity signal:

  2. The controller gains are updated automatically every time the sliders are dragged and released. The gains calculation has an optimization loop inside and may take a few seconds.

  3. After the initial tuning is done, it is possible to tune the control loop more precisely by changing the gains while executing a test signal. There are currently 4 repeatable test signals: square wave, ramp, bidirectional ramp and sine. It is possible to drag sliders and manually change gains during the reference signal following:

  4. There are 2 sliders that allow users to specify the demanded performance of the control loop:

    1. Settling time is the time [in ms] needed to settle the step response within 2% of the reference value. The auto-tuning procedure will try to find gains to ensure the specified settling time given the identified model.
    Settling time of 100 ms:
    Settling time of 300 ms:
    1. Damping ratio is a parameter that reduces oscillations in an oscillating system. In case of the cascaded control loop, this parameter indirectly influences overshoot and rise time. Practically, the damping ratio effect depends on the controller type.

      1. Values > 1 can be used for removing overshoot but at cost of slower settling time, it may also lead to undershoot and non-zero steady state error.
      Damping ratio is maximal:
      1. Values < 1 can be used to achieve a sharper response and a better bandwidth at a cost of overshoot:
      Damping ratio is minimal:


# Do I need to manually adjust controller gains after the auto-tuning?

  • Usually, sliders provide enough flexibility to achieve demanded performance. Mismatches between requested and actual step response can be compensated by entering a faster settling time.

# Can I define other position/velocity/torque units in the custom firmware?

  • The auto-tuning will provide gains only for default units.

# What if my enoder has low resolution?

  • This will definitely result in worse performance compared to higher resolution encoders. Additionally, the velocity signal used in system identification might have multiple zeros that may result in incorrect model.

# Do I have to repeat system identification and tuning after I attached a load to the system?

  • It is better to repeat both procedures. If it is not possible to repeat the system identification, auto-tuning still can be used. But the resulting settling time will differ from the requested.

# What if the system is unstable after auto-tuning?

  • Try to input a slower settling time
  • Check the motor and sensor configuration parameters
  • Check the velocity signal in the playground in the torque control mode. Ensure that it shows correct data during manual rotation of the shaft.
  • Soften filters in position/velocity control loops. They might introduce delay.

# What if the test signals trigger overcurrent/undervoltage?

  • Reduce the test signal amplitude or frequency
  • Increase the settling time.
  • Check the configuration of the motor and sensor.
  • Make sure that correct power supply is used.

# Is there a PID controller auto-tuning?

  • A simple PID is usually not used for position control.

# How do filters influence the auto-tuning?

  • Using a velocity filter results in a phase delay based on the filter order and its cutoff frequency. It is recommended to perform a system identification and tuning after filters were configured. Be careful, filters severely reduce stability due to phase delay.