# Command String Structure

Command String is a string which external devices send to the vision application requesting one task or multiple tasks be executed. Command String is composed of three parts: Command Key, EncodedID and optional parameters. The three parts are joined using comma without space. Each individual optional parameter is also linked with each other using comma without space.

## Command Key

Command key indicates the type of action that a vision task has to perform. For example, the hand-eye calibration task can be started, continued or completed by sending a suitable command key. Similarly, a task that finds the features on a part can be executed to perform train-time or run-time actions through a suitable command key.

Here is all the available command keys in AlignPlus:

CommandKey | Description | When to use
--- | --- | ---
HEB | Hand-eye Calibration Begins | Motion Guided Hand-eye Calibration
HE | Hand-eye Calibration
HEE | Hand-eye Calibration Ends
ACB | Auto Calibration Begins | Vision Guided Hand-eye Calibration
AC | Auto Calibration
IC | Intrinsic Calibration | Checkerboard Calibration, Cross Calibration or Manual Calibration
TA | Train Alignment (registers the golden pose of the target) | Train Time Commands
TT | Train VGR step (register target, single or multiply shots)
TTR | Train VGR step (register robot pick/place position for a target)
LF | Locate Features | Feature Finding in run time.
GP | Get Pose | Pose Computing
LFA | Locate Features Asynchronously | Feature Finding in run time in asynchronous mode
GPA | Get Pose Asynchronously | Pose Computing in asynchronous mode
LFGP | Locate Features, then run Get Pose | Feature Finding and Pose Computer in run time
MEA | Measure | Run inspection
MEAA | Measure Asynchronously | Run inspection asynchronously
LFMEA | Locate Features, then Measure | Run feature finding first, then run inspection
MGP | Multi-part Get Pose | Multi-part pose computation
MGPA | Multi-part Get Pose Asynchronously | Run multi-part pose computation
LFMGP | Locate Features, then run Multi-part Get Pose | Run feature finding first, then run multi-part pose computation synchronously

## EncodedID

See definition of encodedID in AlignPlus Tasks .

## Parameters

Some commands require additional parameters from the PLC. For example, applications such as LF, or GP require the current pose of the alignment device to execute correctly. These additional parameters are encoded in the command string.

Here is the summary of all possible parameters in AlignPlus commands; different commands will have different combination of these parameters.

Parameters | Description | When to use
--- | --- | ---
TargetID | 0 (not used) | Hand-eye Calibration
PartID | Serial number of part if it has, or any string to identify a part. | Feature Finding Run Time and Pose Computer
ResultMode | Abs: using absolute position as return result from vision to motion device Off: using relative position as return result from vision to motion device | Pose Computer
X | The X-coordinate of the current position of the motion system (x in 2D plane) | Hand-eye Calibration, Feature Finding train time and run time, Pose Computing
Y | The Y-coordinate of the current position of the motion system (y in 2D plane)
Z | The Z-coordinate of the current position of the motion system
A | The Z-rotation of the current position of the motion system (theta in 2D plane)
B | The Y-rotation of the current position of the motion system
C | The X-rotation of the current position of the motion system
UserString | The optional field which can be used to send some customized information to AlignPlus program (certain scripting needs to be done to utilize this self-defined string). | Feature Finding run time
RequestData | Whether return measurement result values besides their OK/NG information | Inspection
StatusOnly | Whether return target X,Y,Theta for each sub-region besides their OK/NG information | Multi-part alignment
Index | Index of sub-region in which run time part should be aligned