Autofocus uses an outer tracking loop to control motion using feedback from an analog input or encoder channel.
A target voltage is specified and the axis moves to the target analog input voltage.
Automation1
Autofocus does not apply when used with the GI4, the GL4, or the XL4s.
Configuration
The parameters to configure the Autofocus loop are located under Axes > Autofocus on the Configure tab in Automation1 Studio.
- To start, set the AutofocusInput parameter (under Inputs) to the analog input channel that you are using with this axis.
If you are using an encoder input instead, select the Auxiliary Encoder Feedback option. The encoder feedback is scaled to units of Volts as specified by the AutofocusEncoderScaleFactor parameter (under Tracking). The encoder counts are converted to Volts using the scale factor configured in this parameter. - Set the AutofocusTarget parameter (under Tracking) 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.
- The Autofocus Limits section of the AutofocusSetup parameter (under Tracking) 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 (under Thresholds).
- 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.
- 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 (under Thresholds) can be configured to set the maximum speed that the Autofocus loop will command the axis to reach.
- The AutofocusInitialRampTime parameter (under Tracking) can be configured to prevent an abrupt, instantaneous change in the Autofocus loop error if Autofocus is enabled at a voltage far away from the target voltage. Rather than introduce a large error into the Autofocus loop, this parameter will configure the loop to ramp the Autofocus target from the current voltage to the actual specified target voltage over a period of time.
Note: this parameter can cause problems if the time interval is long enough that the target voltage is not finished ramping by the time the axis reaches the actual target voltage. - The AutofocusHoldInput parameter (under Inputs) 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. - Configure the AutofocusDeadband parameter (under Inputs) with a range in volts around the target voltage for which the Autofocus loop will turn off when the axis is within the deadband range.
If a range was specified in the AutofocusDeadband parameter, Autofocus can be enabled in AeroScript using the following command: AutofocusOn(AutofocusFocusMode.Single). This will disable the Autofocus Loop once the axis is within the range specified by the AutofocusDeadband parameter.
Otherwise the Autofocus Loop can be enabled using AutofocusOn(AutofocusFocusMode.Continuous).
AutofocusOff() will disable the Autofocus Loop.
Tuning
The Loop Polarity setting of the AutofocusSetup parameter (under Tracking) 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.
For the most commonly used sensors (position and force), the AutofocusGainK, AutofocusGainKi1, and AutofocusGainKi2 parameters are the only gains needed to tune the response of the loop.
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.
Related articles