Trouble With OnError Commands (Is it me?)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Trouble With OnError Commands (Is it me?)

    Hello!
    Running PC-DMIS 2013 MR1 SP5 Online on an Optiv Performance 443 connected to a Windows 7 PC
    -------------------------------------------------------------------------------------------------------------------------------------------
    This might technically be a Vision question, but I bear with me.
    I have a program that uses two tips to measure a hole on a cylindrical part mounted on a rotary table.
    The touch probe (TP200) creates an initial alignment, then switches to Vision
    The camera is supposed to go to a hole location and measure.
    Using OnError commands (or anything, really!) I would like to do the following:
    - Check if the hole is there
    - If Edge_Not_Detected, rotate 180°, realign and remeasure
    Continue program from that location

    Essentially, I have it more or less hashed out.
    I take the initial measurement using Matching Edge. This usually only works if the whole feature is encompassed in the target area
    (E.g. the hole is there)
    The program is able to fail, and then rotates 180° and realigns, where it attempts to remeasure the hole.
    It rotates fine, it focuses fine, it levels fine, and it measures fine (the green dots show up around the hole).
    But that's it.
    Best case scenario, it stops at this point. It's as if it measured the hole, but is not able to send the data to PC-DMIS? It just hangs with the green dots around the circle.
    Worst case scenario (what usually happens) as soon as it tries to measure the hole (after it focuses, but before it draws the dots) PC-DMIS crashes and I have to restart.
    -------
    I will post the code I am using for that part below.

    My question is, is this how you would go about doing this?
    Would I be better off not using OnError, or should I change how I'm using it now?
    Is that an error with my code, or with PC-DMIS?
    Could my hardware (I can post specs if necessary) be the issue, as in somethings not powerful or fast enough to keep up?
    Could the problem be due to the use of variables in the measurement being used incorrectly?

    Hopefully this makes sense, and I'm always happy to give whatever information you guys need to help me out

    ---
    I'd like to clarify, also.
    The OnError section works in this code. Everything works absolutely fine, perfect, whatever. Except the actual physical (visual) measurement of the hole. Before and after is great
    Last edited by InspectorJester; 09-29-2017, 10:32 AM.

  • #2
    Code:
     LOADPROBE/ZOOM
                TIP/TIP1, SHANKIJK=0, 0, 1, ANGLE=0
    HOLE_Z     =FEAT/POINT,CARTESIAN,YES
                THEO/<0,0,ABS(0.365)>,<0,0,1>
                ACTL/<0,0,0.365>,<0,0,1>
                CONSTR/POINT,OFFSET,ORIGIN,0,0,0.365
    FA_180     =ALIGNMENT/START,RECALL:FINE_ALIGN_0,LIST=YES
                ALIGNMENT/ROTATE_OFFSET,180,ABOUT,YPLUS
                ALIGNMENT/END
    180_Z      =FEAT/POINT,CARTESIAN,YES
                THEO/<0+0,0+0,ABS(0.365)>,<0+0,0+0,ABS(1)>
                ACTL/<0,0,0.365>,<0,0,1>
                CONSTR/POINT,OFFSET,ORIGIN,0+0,0+0,ABS(0.365)
    A180       =ALIGNMENT/START,RECALL:FA_180,LIST=YES
                ALIGNMENT/ROTATE,ZPLUS,TO,180_Z,ABOUT,YPLUS
                ALIGNMENT/TRANS,ZAXIS,180_Z
                ALIGNMENT/END
    A1         =ALIGNMENT/START,RECALL:FINE_ALIGN_0,LIST=YES
                ALIGNMENT/TRANS,ZAXIS,HOLE_Z
                ALIGNMENT/END
                MOVE/ROTAB,0,SHORTEST,A1
    VIS_LINFACE=FEAT/VISION/LINE/DEFAULT,CARTESIAN,BOUNDED
                THEO/<-0.05,0,-0.015>,<0.05,0,-0.015>,<1,0,0>,<0,-1,0>,<0,0,1>,0.1
                ACTL/<-0.0495,0.0009,-0.015>,<0.0493,0.001,-0.015>,<0.9999998,0.000561,0>,<0.000561,-0.9999998,0>,<0.0000012,-0.0003926,0.9999999>,0.0988
                TARG/<-0.05,0,-0.015>,<0.05,0,-0.015>,<1,0,0>,<0,-1,0>,<0,0,1>
                SHOW FEATURE PARAMETERS=YES
                  SURFACE=THEO_THICKNESS,0
                  MEASURE MODE=NOMINALS
                  RMEAS=NONE,NONE,NONE
                  CIRCULAR MOVES=NO
                  CLEARPLANE=NO
                  PREPOSITION=NO
                  GRAPHICAL ANALYSIS=NO
                  DIAGNOSTICS=NO
                  FEATURE LOCATOR=NO,NO,""
                SHOW_VISION_PARAMETERS=YES
                  TYPE=AUTOMATIC HIT TARGET
                  COVERAGE=100%
                  COVERAGE ACTIVE TARGETS=4
                  MAGNIFICATION=1.5001
                  HIT TARGET COLOR=RED,NOMINAL COLOR=GREEN
                  HIT TARGET=EA1,0,1,NORMAL,0.0045
                  FILTER=NO,NO
                  EDGE=SPECIFIED EDGE,16,[?]->[?],-->,1,1,1,1,NO,Backlight=<OFF,99.5,ON>,Toplight=<OFF,55,OFF>,Ringlight=<OFF,55.9,OFF>
                  FOCUS=NO
    A0         =ALIGNMENT/START,RECALL:A1,LIST=YES
                ALIGNMENT/TRANS,YAXIS,VIS_LINFACE
                ALIGNMENT/END
                CLEARP/ZPLUS,0.5,ZPLUS,0,OFF
                ASSIGN/V1=0
    LBL_HOLE   =LABEL/
                MOVE/ROTAB,V1,SHORTEST,FA_PLNROT
                IF/V1==180
                RECALL/ALIGNMENT,INTERNAL,A180
                END_IF/
                ELSE/
                RECALL/ALIGNMENT,INTERNAL,A0
                END_ELSE/
                ONERROR/EDGE_NOT_DETECTED,GOTO LBL_ERROR
    HOLE_TO_MEASURE=FEAT/VISION/CIRCLE/DEFAULT,CARTESIAN,IN,LEAST_SQR
                THEO/<0+0,ABS(1.595),0+0>,<0+0,0+0,ABS(1)>,0.033,0,0
                ACTL/<0,1.5941,-0.73>,<0,0,-1>,0.033,0,0
                TARG/<0+0,ABS(1.595),0+0>,<0+0,0+0,ABS(1)>
                ANGLE VEC=<(ABS(1)),0+0,0+0>
                SHOW FEATURE PARAMETERS=YES
                  SURFACE=THEO_THICKNESS,0
                  MEASURE MODE=NOMINALS
                  RMEAS=NONE,NONE,NONE
                  CIRCULAR MOVES=NO
                  CLEARPLANE=NO
                  PREPOSITION=NO
                  GRAPHICAL ANALYSIS=NO
                  DIAGNOSTICS=NO
                  FEATURE LOCATOR=NO,NO,""
                SHOW_VISION_PARAMETERS=YES
                  TYPE=AUTOMATIC HIT TARGET
                  COVERAGE=100%
                  COVERAGE ACTIVE TARGETS=4
                  MAGNIFICATION=1.5001
                  HIT TARGET COLOR=RED,NOMINAL COLOR=GREEN
                  HIT TARGET=EA1,0,1,NORMAL,0.0045
                  FILTER=NO,NO
                  EDGE=MATCHING EDGE,5,[?]->[?],1,1,1,NO,Backlight=<OFF,0,OFF>,Toplight=<OFF,55,ON>,Ringlight=<OFF,55.9,ON>
                  FOCUS=YES,FULL,0.15,YES,2.2,NO
                GOTO/LBL_CONTINUE
    LBL_ERROR  =LABEL/
                ASSIGN/V1=180
                GOTO/LBL_HOLE
    LBL_CONTINUE=LABEL/
                ONERROR/EDGE_NOT_DETECTED,OFF

    Comment


    • InspectorJester
      InspectorJester commented
      Editing a comment
      We switch to the camera probe and make a Z offset point to level to.
      This point is to give the hole a rough Z location to keep it in focus.
      I create an alignment flipped 180° and make a second Z point for the same reason, just 180° apart.
      This alignment is recalled when the part rotates.
      I take a measurement on the face of the part for the Y axis.

      When the hole is measured in LBL_HOLE, the rotab rotates to either 0° or 180°, depending on if the next measurement (the hole) failed.
      If it does fail, it sets a variable to 180 and retries.
      If it does not, it's supposed to continue, but either freezes or crashes without measuring the hole!
      Last edited by InspectorJester; 09-29-2017, 12:12 PM.

  • #3
    UPDATE:

    I have resolved the issue regarding OnError. I've basically determined it is not OnError causing the issue, but variable alignments. I will post findings when there are no more errors

    Comment

    Related Topics

    Collapse

    Working...
    X