# One Step Commands

For alignment or inspection applications in which the end of one feature finding task is surely followed by the beginning of an alignment task during run time, user can choose one-step command which merges the last LF command with the following alignment command (GP/MGP/MEA command) to trigger feature finding and alignment tasks at one time. These one-step commands are: LFGP, LFMGP, and LFMEA commands.

## LFGP

For alignment application, run the feature locating at the last acquisition position in the requested feature finding task, and then run pose computation in the requested alignment task.

### Command String

LFGP,<EncodedID0>,<EncodedID1>,<PartID>,<ResultMode>,<X>,<Y>,<Z>,<A>,<B>,<C>[,<UserString>]

Field | Arguments
--- | ---
<EncodedID0> | EncodedID0 = StepID for feature finder task's last position
<EncodedID1> | EncodedID1 = Alignment task + Process Tag(2000)
<PartID> | Serial number of part if it has, or any string if it is consistent for one part (PartID used here should be the same as used in LF commands if they are from the same part)
<ResultMode> | Abs (absolute value) or Off (offset from the current pose)
<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

When task runs successfully:

LFGP,<Status>,<Token>,<ProductID>,<X>,<Y>,<Z>,<A>,<B>,<C>CR/LF

Field | Arguments
--- | ---
<Status> | 1
<Token> | The Token identifying the corresponding command
<PartID> | The PartID provided by command string
<X> | The X-coordinate of the destination position for the motion system
<Y> | The Y-coordinate of the destination position for the motion system
<Z> | 0 (not used)
<A> | The theta(in degrees) of the destination position for the motion system
<B> | 0 (not used)
<C> | 0 (not used)

When task fails:

Field | Arguments
--- | ---
<Status> | ErrorCode
<Token> | The Token identifying the corresponding command
<PartID> | PartID provided by command string

## LFMGP

Runs multi-part feature locating at the last acquisition position of the feature finding task and pose computation in the alignment task sequentially.

### Command string

LFMGP,<EncodedID0>,<EncodedID1>,<PartID>,<StatusOnly>,<ResultMode>,<X>,<Y>,<Z>,<A>,<B>,<C>,<UserString>,<MainIndex>[,<Index2>]...[,<IndexN>]

Field | Arguments
--- | ---
<EncodedID0> | EncodedID0 = StepID for feature finder task's last position
<EncodedID1> | Alignment task + Process Tag(2000)
<PartID> | Serial number of part if it has, or any string if it is consistent for one part (PartID used here should be the same used in LF commands if they are from the same part)
<StatusOnly> | 0: return string feedback OK/NG information as well as target X,Y,Theta for each sub-region. 1: return string only feedback OK/NG for each sub-region
<ResultMode> | Abs (absolute value) or Off (offset from the current pose)
<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> | For user to customize some extra data(required field, not optional)
<MainIndex>[,<Index2>]...[,<IndexN>] | Indexes of sub-regions of parts that needs pose computation. MainIndex is required, Index2,...,IndexN are optional. If MainIndex is -1, command will compute all sub-regions' results If MainIndex is specific index, such as 5, and there is no other indexes, command will compute that specific sub-region(5) only If MainIndex, Index1, Index2, ..., IndexN are a serial of indexes(such as 1, 4, 7), command will only compute those given sub-regions(1,4,7).

### Result String

When task runs successfully with StatusOnly set as 0 in command string:

LFMGP,<Status>,<Token>,<PartID>,<ResultCount>,<Status1>,<X1>,<Y1>,<T1>[,<Status2>][,<X2>][,<Y2>][,<T2>]...[,<StatusN>][,<Xn>][,<Yn>][,<Tn>]CR/LF

Field | Arguments
--- | ---
<Status> | 1: Task run sucessfully
<Token> | The Token identifying the corresponding command
<PartID> | PartID provided by command string
<ResultCount> | The count of requested sub-regions
<Status1>,[,<Status2>]...[,<StatusN>] | 1: Pose computation runs successfully ErrorCode: Pose computation of given sub-region fails, by default ErrorCode = 0, but it can be other negative integers that defined by user in Custom Tool Block for feature finding
<X1>,[,<X2>]...[,<Xn>] | X component of target pose of requested sub-region
<Y1>,[,<Y2>]...[,<Yn>] | Y component of target pose of requested sub-region
<T1>,[,<T2>]...[,<Tn>] | Theta component of target pose of requested sub-region

When task runs successfully with StatusOnly set as 1 in command string:

LFMGP,<Status>,<Token>,<PartID>,<ResultCount>,<Status1>[,<Status2>]...[,<StatusN>]CR/LF

The field arguments are the same as described above.

When task fails:

LFMGP,<Status>,<Token>,<PartID>

Field | Arguments
--- | ---
<Status> | ErrorCode: Task fails
<Token> | The Token identifying the corresponding command
<PartID> | PartID provided by command string

## LFMEA

Runs the feature locating at the last acquisition position of the feature finding task and then inspection in the alignment task sequentially in synchronous mode.

### Command String

LFMEA,<EncodedID0>,<EncodedID1>,<PartID>,<RequestData>,<X>,<Y>,<Z>,<A>,<B>,<C>[,<UserString>]

Field | Arguments
--- | ---
<EncodedID0> | EncodedID0 = StepID for feature finder task's last position
<EncodedID1> | EncodedID1 = Alignment task + Process Tag(2000)
<PartID> | Serial number of part if it has, or any string if it is consistent for one part (PartID used here should be the same as used in LF commands if they are from the same part)
<RequestData> | 0: return string only feedback OK/NG information 1: return string feedback OK/NG and measurement result values
<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

When task runs sucessfully:

LFMEA,<Status>,<Token>,<PartID>,<ResultStatus>[,<DataCount>] [,<Data1>] [,<Data2>]... [,<DataN>]CR/LF

Field | Arguments
--- | ---
<Status> | 1
<Token> | The Token identifying the corresponding command
<PartID> | The PartID provided by command string
<ResultStatus> | 0: Measurement results are out of specs 1: Measurement results are within specs
[,<DataCount>] | The quantity of measurement results
[,<Data1>] [,<Data2>]... [,<DataN>] | Each measurement result data.

When task fails:

LFMEA,<Status>,<Token>,<PartID>

Field | Arguments
--- | ---
<Status> | ErrorCode
<Token> | The Token identifying the corresponding command
<PartID> | PartID provided by command string