Autofocus Functions
HARDWARE: Autofocus does not apply when used with the GI4, the GL4, or the XL4s.
The autofocus feature uses an outer tracking loop to control axis motion. It uses sensor feedback from an analog input or an encoder input. The feedback is compared to a specified target voltage to generate an error signal for the autofocus control loop. Based on the configured autofocus loop gains, the control loop generates a position command response to the error signal. Also, a target feedforward path can generate a position command associated with the specified target value. This cumulative position command is then added to additional motion commands (in Additive Motion Mode) and used as an input to the standard servo loop. This moves the axis in response to error between the sensor input and target voltage. Refer to the block diagram that follows for more details.
Tuning the Autofocus Loop
You can calculate gains analytically for tuning the autofocus loop, or you can manually tune the loop. For analytic calculation, refer to the transfer function in the AutofocusGainK Parameter. To manually tune the loop, set the AutofocusGainKi1 Parameter to a value greater than the servo loop bandwidth and all other AutofocusGainKi gains to zero. Then, adjust only the AutofocusGainK Parameter. For low values of AutofocusGainK, the autofocus loop should always be stable. If you cannot stabilize the system using this method, you can reverse the height sensor polarity by using the Loop Polarity setting of the AutofocusSetup Parameter.
You can also use the AutofocusGainTff Parameter to include a position command component directly proportional to the autofocus target.
For the most commonly used sensors (position or force), only AutofocusGainK Parameter, AutofocusGainKi1 Parameter and AutofocusGainKi2 Parameter are needed.
Enabling or Disabling Autofocus
Use the AutofocusOn() function to enable the autofocus feature on an axis.
function AutofocusOn($axis as axis, $focusMode as AutofocusFocusMode)
Enables autofocus on an axis.
Arguments
$axis The axis on which to enable autofocus.
$focusMode Selects if autofocus will run in continuous focus or single focus mode.
When you issue the AutofocusOn() function, the autofocus control loop activates with the configuration specified in the autofocus parameters. You must use the $focusMode argument to specify the mode in which the autofocus feature is enabled. Specify the option for this argument with the AutofocusFocusMode enumeration.
Use the AutofocusOff() function to disable the autofocus feature. You can also disable autofocus with the Abort() function.
function AutofocusOff($axis as axis)
Disables autofocus on an axis.
Arguments
$axis The axis on which to disable autofocus.
When you disable autofocus with the AutofocusOff() or Abort() functions, the axis decelerates at the rate specified by the AbortDecelRate Parameter.
In Continuous focus mode, the autofocus feature is enabled until you issue the AutofocusOff() or Abort() functions. You must specify this option if you are using Additive mode as the Motion mode setting of the AutofocusSetup Parameter. In Single focus mode, autofocus automatically disables when the configured autofocus input reaches the specified autofocus target value, using the AutofocusDeadband Parameter.