Vision System Error handling

I am running a Cognex Vision system on the pc interface that will be looking at our part held by the robot to determine offsets for machining location. I want to have an error safety built in so if the robot fails to pick a part from the loader and the camera has an error (from not identifying a part), the robot goes back through the pick up procedure again. I have an if statement to check the output from the camera and i can get the arm to go pick up the part again but then when it leaves the if statement it, it does not continue the program.  I need a way to basically start the PP to Main if it receives an error so it just restarts. What is the best way to do this? I want to run the machine lights off and want to make sure when i come in the next day it didn't miss a part and stop early in the cycle.

I have posted the a snip from my code but not sure the best way to post it here to review.


  • lemster68
    lemster68 United States ✭✭✭
    The command Exitcycle will move the program pointer to the main.  It is likely then you will need to start program execution.  I can also recommend that you write an ERROR handler.  in Checkstatus proc you can RAISE the error to GetVisionData.  You could then RAISE it again if you like.  Read up on Error handling.  You might even want to Long Jump error to a higher level.  You will find that one in the rapid kernel manual.
    Lee Justice