Re-register a model automatically at result NG

Overview

Re-register a model automatically when the object image is influenced by the changes of external environment and does not match to the pre-registered model anymore.

Specification of this example


Behavior
When the measurement results of [Search] is NG, re-register a model.

How to try this example
1.When cleck the link of file, open the folder.
refFile

2.The zip file is stored in the folder. When drug & drops on the screen of FJ, read the scene data and the image data.

3.When remeasure the sample image(Image_1), the measurement result should be OK.
When remeasure the sample image(Image_2), the measurement result should be NG. At this time macro executes Re-register.
Then, When remeasure the sample image(Image_2), the measurement result should be OK.

How to implement

Scene data
Unit No.
Processing Item
0.
Camera Image Input
1.
Search
2.
Macro
The Macro Program below segment is to be set in '2.Macro'.
Macro Program
*MCRINIT
    UNITNO&& = 1                                            '(1)
    MODELFIGNO&& = 0
Return

*MEASUREPROC
    GetUnitData UNITNO&&, "JG",UNITJUDGE&                   '(2)

    If UNITJUDGE& = JUDGE_NG Then                           '(3)
        Dim FIGDATA&(20)
        GetUnitFigure UNITNO&&, MODELFIGNO&&, FIGDATA&()
        SetUnitFigure UNITNO&&, MODELFIGNO&&, FIGDATA&()
    EndIf
Return

The macro program is in refthis link.
Explanation
(1)Set the unit number and the model figure number of the target unit.
(2)Get the judgement results of the target unit.
(3)Re-register a model when the results is NG.