DoF - a Robotiq Community
Warning sign
The Dof Community was shut down in June 2023. This is a read-only archive.
If you have questions about Robotiq products please reach our support team.
matthewd92

@AZalmanov There is not a built in script per se that will do this, however, it's not that hard.  One way to do this is to place your sub-programs inside of a switch statement that uses an indexer to call each subsequent step in the process, then you can start your program from wherever you want.  The biggest change that this creates is that your program goes from being very linear, do A, then do B, then do C and execute all in one loop to a looping program where each loop executes one step in your switch case.  From a human's eye, you won't notice the change but you might have to make some minor modifications to make the code execute correctly without any invalid setpoint errors.

So here is basically how we program our robots so that the customer can resume operations from anywhere in the program

First we create an installation variable called currentStep and set it to 0, we will use this as our step function in the switch statement.  In the before start section of the program we will ask the user where they want to start the program, which step basically.  If they choose 0 then we know they want to start at the beginning and we will then proceed to reset the cell and start from the beginning.  If not, we have a homing routine to get the robot from its current location to the starting point for that section of code.  That way we can automatically recover from a crash and resume operation where we were.  Here's what the code in the body of the program looks like

switch currentStep:
  case 0:
    subprogram0
  case 1:
    subprogram1
  case 2:
    subprogram2
    if (needToRedo1):
      currentStep=currentStep-2
    else if (needToRedo2):
      currentStep=currentStep-1
    end
end
currentStep = currentStep +1
if currentStep > 2:
  currentStep = 0
end    

So lets say I am in step 2, I decide that for whatever reason I need to reperform step 1, I will simply deduct from currentStep 2 indexes so that instead of becoming zero at the end of the loop currentStep becomes 1, since I have now reset it to 0 and then added 1 at the end of the loop.  I could also jump forward from 0 to 2 by simply adding an index at the end of the subprogram0 before it returned to the main program.  What we have found using systems like this is that we can have very complex programs that are making a lot of decisions on how to run on the fly but write simpler code.  We simply include logic that allows us to set where the program is going next rather easily.


Hopefully this makes sense, if not let me know and I will try to explain better