# Feature Finding Commands

Feature finding commands are used to trigger feature finding task in run time.

## LF

Locates features of a part in synchronous mode. The external device should send one or more LF commands depending on the number of acquisition position of the feature finding task. At non-last acquisition positions, the execution mode should be set as Acquire Only and encoded in the LF commands; at the last acquisition position, the execution mode should be changed to Acquire and Process instead to acquire the last set of images and execute the feature extraction.

### Command String

LF,<EncodedID>,<PartID>,<X>,<Y>,<Z>,<A>,<B>,<C>[,<UserString>]

Field | Arguments
--- | ---
<EncodedID> | For non-last position: StepID of feature finder task at current position + Acquire Tag(1000) For last position: StepID of feature finder task at last position
<PartID> | Serial number of part if it has, or any string if it is consistent for one part (PartID used for multiple LF commands should be the same if they are used for the same part)
<X> | The X-coordinate of the current position of the motion system
<Y> | The Y-coordinate of the current position of the motion system
<Z> | 0 (not used)
<A> | The theta(in degrees) of the current position of the motion system
<B> | 0 (not used)
<C> | 0 (not used)
[,<UserString>] | Optional, for user to customize some extra data

### Result String

LF,<Status>,<Token>,<PartID>CR/LF

Field | Arguments
--- | ---
<Status> | The result status 1 : Success ErrorCode : Fail
<Token> | The Token identifying the corresponding command.
<PartID> | The PartID provided by command string

## LFA

Locates the features of a part in asynchronous mode. The command sequence and execution modes are the same as described in LF command.

### Command String

LFA,<EncodedID>,<PartID>,<X>,<Y>,<Z>,<A>,<B>,<C>[,<UserString>]

Field | Arguments
--- | ---
<EncodedID> | For non-last position: StepID of feature finder task at current position + Acquire Tag(1000) For last position: StepID of feature finder task at last position
<PartID> | Serial number of part if it has, or any string if it is consistent for one part (PartID used for multiple LF commands should be the same if they are used for the same part)
<X> | The X-coordinate of the current position of the motion system
<Y> | The Y-coordinate of the current position of the motion system
<Z> | 0 (not used)
<A> | The theta(in degrees) of the current position of the motion system
<B> | 0 (not used)
<C> | 0 (not used)
[,<UserString>] | Optional, for user to customize some extra data

### Result String

LFA,<Status>,<Token>,<PartID>CR/LF

Field | Arguments
--- | ---
<Status> | The result status 1 : Success ErrorCode : Fail
<Token> | The Token identifying the corresponding command.
<PartID> | The PartID provided by command string

Note:

Before a new LF/LFA is sent to the same feature finding task, the external device needs to make sure the previous LF/LFA command has already finished execution, otherwise AlignPlus program will throw an error saying task is busy. The external device can compare the <Token> in the acknowledge signal and the <Token> in the result string to confirm whether a requested task is finished. If two tokens are the same, it means that the task has already been executed, otherwise, the task is still running.