RobotStudio event

Error Handling with custom error

I am trying to create an error handler using my Vision system. I am running a camera thru pc interface and I want to run an error routine if my gripper is not holding a part. I have the custom error set up with a RAISE command and get into the error handler just fine. My issue is getting out where i want it to. 

In my Error handler i run my pick up routine which presents to the camera but then I need to trigger the camera and check for error again. I would like to leave the error handler and go up to the proccall again but RETRY just returns me to the RAISE instruction. If I put the routine to get vision data again in the error handler i have to keep adding loops in there to check for the corrected pick up values I need to continue. Does anyone have a good idea for how to handle this?

Perhaps the error handler isn't the correct tool, but it seemed like the best option so i don't run into limit errors from constantly recalling a routine through nested if statements.

Comments

  • I just went back to an old post I made similar to this but with far less knowledge and saw that some advice was to use a RAISE in the error handler to jump to my getvisionData proc.

    So by doing this am i correct that I would be leaving the error handler and moving the pp up to the point that i want before my initial raise into the error handler?
  • You can RAISE to the calling routine, yes.  In that routine, you need an error handler, check for the same error, RETRY or RAISE again, if necessary, then RETRY, as needed at the appropriate call level.  You are pretty much on the right track.
    Lee Justice
  • Ok that makes sense. As I was reading the rapid kernel manual i came across using goto and a label. Would this be a good option as well? If i put the label before the rgetvisiondata and goto in the error handler that should work the correct way right? At least that was my understanding from reading it.
  • Well....some purists consider those things a bit hackneyed or lazy.  I only use those when absolutely necessary.  I will look for some code that is very similar to what you have proposed.
    Lee Justice
  • I PM'd you some code.
    Lee Justice