# CommandHandlerCallback

CommandHandlerCallback script can be found in the folder Scripting\User Scripts\Misc.

It is responsible for the following actions:

1. Converting results into a result string.

   For example, if a command to align parts is sent, this script extracts result data such as target x, y, theta for motion device and converts them to a result string.

   Some of the data that the result string can contain are:

   Key | Type | Description
   --- | --- | ---
   X | Object | X value of current position of motion device, only used for vision-guided hand-eye calibration or ultracalibration
   Y | Object | Y value of current position of motion device, only used for vision-guided hand-eye calibration or ultracalibration
   ThetaInDegrees | Object | Theta value of current position of motion device, only used for vision-guided hand-eye calibration or ultracalibration
   AbsoluteStageMotionX | Object | X value of target position of motion device should move to
   AbsoluteStageMotionY | Object | Y value of target position of motion device should move to
   AbsoluteStageMotionThetaDegrees | Object | Theta value of target position of motion device should move to
   RelativeStageMotionX | Object | X value of relative position of motion device should move
   RelativeStageMotionY | Object | Y value of relative position of motion device should move
   RelativeStageMotionThetaDegrees | Object | Theta value of relative position of motion device should move
   IsOK | Object | Specifies whether alignment result is within limit
   PoseValid | Object | Whether current position is valid or not, used only for vision guided hand-eye calibration

2. Send the result string either to CommandsFromPLC or ResultsToPLC depending on whether the task run in synchronous mode or not.