Autofocus uses an outer tracking loop to control motion using feedback from an analog input.
A target voltage is specified and the axis moves to the target analog input voltage. 

A3200/Ensemble/Soloist

A3200 Only: Autofocus does not apply when used with the GL4, the Ndrive FCL or FLS, the Nmark CLS, GCL, or SSaM, or the XL4s.

Configuration

The parameters to configure the Autofocus loop are located under Axis > Autofocus Loop in the parameter file.

  1. To start, set the AutofocusInput parameter to the analog input channel that you are using with this axis.
  2. Set the AutofocusTarget parameter to the target voltage of the analog input. This is the voltage that will be the target, or set-point, of the control loop.

These are technically the only parameters that are required to enable Autofocus. There are other features however that could still be helpful to configure depending on the system.

  • Configure the AutofocusDeadband parameter with a range in volts around the set-point (target voltage) for which the Autofocus loop will turn off when the axis is within the deadband range.
    The Focus Mode of the AutofocusSetup parameter must be set to Single Focus for the Autofocus loop to turn off when the axis is in the deadband range.
  • The Autofocus Limits section of the AutofocusSetup parameter can be configured to enable limits on the Autofocus loop. If enabled, the loop will not command the axis past the limits configured in the AutofocusLimitHigh and AutofocusLimitLow parameters.
    • The limits can be Enabled (relative), where the values specified in the above limit parameters are relative to the position of the axis when the Autofocus loop is enabled.
    • Or the limits can be Enabled (absolute), where the limit values are absolute positions on the axis, relative to the axis home position.
  • The AutofocusSpeedClamp parameter can be configured to set the maximum speed the Autofocus loop will command the axis to reach.
  • The AutofocusHoldInput parameter can be configured to allow a digital input to essentially “pause” the Autofocus loop. When the digital input is active (either high or low depending on the Hold Input Polarity configured in the AutofocusSetup parameter), the axis stops moving but remains under the control of the Autofocus loop.
    When the digital input goes low, the axis continues moving as normal under Autofocus control.

On the A3200 and Ensemble platforms, Autofocus is enabled/disabled from an AeroBasic program using the AUTOFOCUS [axis] ON and AUTOFOCUS [axis] OFF commands respectively. For the Soloist, these commands are AUTOFOCUS ON and AUTOFOCUS OFF.


Tuning

The Loop Polarity setting of the AutofocusSetup parameter must be correctly configured before tuning the Autofocus loop.
To verify the loop polarity, enable Autofocus and observe the axis. If it moves further away from the target position, the loop polarity must be reversed.

The AutofocusGainKi, AutofocusGainKp, and AutofocusGainKi2 parameters are used to tune the response of the Autofocus loop. The Autofocus loop is a PI control loop where Kp is the proportional gain and Ki and Ki2 are the integral gains. In general Ki and Ki2 control the responsiveness of the loop and Kp controls the loop rigidity.

  • To tune the loop, start with Ki set to 1 and Ki2 and Kp set to 0. This should always be relatively stable and provides a good starting point. 
  • From there, adjust Ki. If the loop seems to be unstable (oscillating), decrease Ki. If it is not responding quickly enough (but is stable), slowly increase Ki.
    It is not uncommon to have a Ki value as low as 0.1. For low values of Ki, the loop should always be stable.
  • Once the loop is responding/converging quickly enough, slowly begin increasing Kp (0.1, 0.2, 0.3, etc.) to start introducing more rigidity into the response. As with any PI loop, too high of a gain will cause the loop to oscillate, or go unstable.

For reference, an example of some final gain values could be Ki = 0.4, Ki2 = 0, Kp = 4. The final gains you end up with will depend on your system.