Step 4: Edit robot program for vision offset
[Purpose]
Edit the robot program, so that the vision offset can be performed.

[Procedure]
TP
Open the robot program created in Step 1, and apply the modification indicated with the red letters in the ' Vision Offset Program' to the 'Original Program', both shown on the right figures.
Add a label
TP
Add LBL[] to the end of the program.
Although any label number can be used, 99 is used for an illustration purpose.
Add a VISION RUN_FIND command
TP
Insert two lines between the motion commands P[1] and P[2].
TP
In the second line, press [NEW INSTRUCTION] > [Vision] > [RUN_FIND].
TP
Press [CHOICE] and select the vision process created in the previous step.
This line executes the vision process to find the workpiece.

Note
The command [RUN_FIND] only needs to be called when a new snap must be taken.
However, the [GET_OFFSET] command will populate the supplied vision register (VR[]) with the offset data for the next found part.
Therefore, if multiple parts need to be found, [GET_OFFSET] would need to be called for every part that was detected by the [RUN_FIND].

Add a VISION GET_OFFSET command
TP
In the third line, press [NEW INSTRUCTION] > [Vision] > [GET_OFFSET].
TP
Press [CHOICE] and select the vision process created in the previous step.
TP
Enter 1 for the number after 'VR'.
TP
Enter 99 for 'JMP LBL'.
This line receives the offset data from the specified vision process, and stores it to the vision register [1]. If the workpiece is not found, it jumps to the label '99'.
Append a VISION VOFFSET command
TP
As an additional command for P[2] and P[3] motion commands, select [VOFFSET,VR[]].
TP
Enter 1 for the number after 'VR'.
This shifts the robot motion to P[2] and P[3] with the offset data stored in VR[1], so that the task at the correct workpiece position is possible.

Additional
When touching up a position in a Teach Pendant program, the question is asked whether to set a new ID for the updated position or not. The answer is normally 'No' as, if a position is being updated, often there is an explanatory comment in place that should be kept even when the position is retaught.
Also, when reteaching a point that has a [VOFFSET,VR[]], a question appears asking if the new point should 'subtract from the vision offset'.
The answer is most often 'Yes', as the point to be updated will have an offset applied from the vision process and the offset will need to be taken into account.
There are many things to be aware of when teaching and reteaching positions in a program that uses a vision process. This is why it is suggested that only one part be used during setup and initial programming as this will help avoid unexpected issues.