How to use StepBwdPath to pause the program with a backwards movment.

Dear All,

Here is my problem. The robot is executing a certain path in a task T_ROB1. No matter the position, by receiving a digital input let’s say “DI1” I need the robot to stop as soon as possible keeping the path. (I am using Stop/quick) to next move backwards, let’s say 2mm on the path to finally stop and wait for DI1 to be off again (0) and then restart the robot on the same path. In other words, I need a program pause with a backwards movement rather than a simple stop and restart.

The way I see it seems obvious using the instruction StepBwdPath. I tried to implement it by monitoring the signal DI1 in a TRAP routine but it fails receiving the error stating that StepBwdPath needs to be in a handler routine.  Unfortunately, the manual gives a simplistic example(below) which do not contextualize the routine.

         StepBwdPath 30, 1;

         StepBwdPath 30, 1;

         The first instruction moves backwards 30 mm. The second instruction moves backwards 30 mm further.

Can someone give me a simple example on how to solve my problem?  Thank you All. Cheers, Sergio.

Best Answer

  • xerim
    Accepted Answer
    You need to define an event routine for your Restart_Routine() procedure. In your image you shared, in the top left corner, right click "Controller" under the configuration dropdown, then click configuration editor. You will now be presented with the configuration editor for the controller where you can select "event routine." Once you select it you may right click anywhere to create a new event routine. You must define it so it calls your routine "Restart_Routine()." Let me know if you can't get it to work.    


  • graemepaulin
    graemepaulin New Zealand mod
    I have never used the StepBwdPath command - looking in the manual is says the command must be used in a Restart event routine.
    This means you configure the the system parameter 'event routine' (in the controller topic) to run your user created routine (which would have the StepBwdPath command and any other logic required in it) on restart. 

    The restart could be initiated by the system input start for example.
  • SergioTAlmeida
    SergioTAlmeida Melbourne AU
    Hi, tks for the attention. However, I am still not able to compile the sequence you explained. Can you please elaborate a bit more? certainly, a  simple code example would clarify lots of questions.

  • You can define an event routine to be a RESTART event in the sys.cfg file like this:

     -Routine "MyRoutine" -Shelf "RESTART"
  • SergioTAlmeida
    SergioTAlmeida Melbourne AU
    Hi. Tks on the example of RESTART routine. I tried to adapt it but I am still receiving errors when the command StepBwdPath is included.  Can you contextualise in StepBwdPath, please?
  • What errors are you receiving? Post your code in the thread and I'll take a look
  • SergioTAlmeida
    SergioTAlmeida Melbourne AU
    Hi Xerin. Below is the current code. Note: Removing the instruction StepBwdPath it works for pause and restart of the movement. Any suggestions will be very welcome. Tks

  • SergioTAlmeida
    SergioTAlmeida Melbourne AU
    Hi Xerin. Thanks to your guidance, I was able to set up the event RESTART routine with StepBwdPath with no errors. However, by randomly testing the interruption along the path, most of the time, the program moves back not following the path but seems to restart the program from the beginning. I've been reading the manual (Rapid instructions) and found the following:

    "It is up to the user to introduce a restart process flag so StepBwdPath in the RESTART event routine is only executed at process restart and not at all program restarts."

    Any suggestions on how to introduce a restart process flag? Your help is very much appreciated. Kind regards.