How to get out of an IF or ElseIF path

Good morning together,

I´m not that familiar with programming a Robot. I have a simple pick and place routine.

The PLC will send a 0 or 1 on an Input register of the Robot.
If the INT=0 (Auftragsnummer) the robot has no active job and will return to its “waiting position”.
If the INT= 1 (Auftragsnummer) the robot will work in its pick and place routine.

Now i also want to implement a “abort” command from the PLC. when that signal comes, i want the robot (depending on its actual position) to go back to its waiting position.

Once the Robot gets its INT=1 it will start his process. For each step of the Program i created a program Tracker that indicates where the robot is.

Now my problem. If the Robot is already in Line 28-41, and now the Abort (Abbruch) signal is coming, how can i get out of this and make the Robot to contine from Line 188 (where i have my abort (Abbruch) routine?

Do you guys have any idea/ suggestion?

Kind regards from Luxembourg!

image

Enable Check expression continuously and the robot will exit the If-command, if the expression becomes false during execution. :slight_smile:

You should add a script-function with stopj(xx) or stopl(xx) (joint or linear movement) (read script manual for more information), if the abortion can happen during a movement of the robot arm. This allows the robot arm to decelerate instead of stopping abrubtly, which will introduce unnecessary wear in the joints.

Hi @efn,

thank you for your answer. Now i have an additional question:

At moment i only check the expression continously at L217.
Do i have to check ALL IF/ElseIF continously?

What i tried now too (and i don´t know if i did it now twice) is to send 0 To the “Auftragsnummer”. And then at the IF part of Auftragsnummer=0 i check the program tracker. Depending on the program tracker i will have different routes/actions to move the robot to its waiting position.

Cause basically same i do in Line 217. if my abort signal (Abbruch) = True i also check the program tracker. depending on where the robot is i will use different routes/ actions to move the robot to its waiting position.

Maybe I´m thinking to complicated? :smile:

Yes, you would want to check all Ifs continuously. I’m pretty sure doing this creates a thread in the background, and you are limited to 50 threads, so just be careful if you have more than 50 if statements.

What you’re describing in your second part sounds fine. You will likely need different paths to get the robot home depending on where it was when it received the abort signal. Creating recovery routines like this is very tedious and exhaustive. What if the robot is in this position AND it has a part? What if it doesn’t have a part?

You may find it easier to only allow the robot to abort at the end of any given step. This way you have a few fixed positions the robot would be in to get home from. Otherwise you essentially need to ensure that the robot has a path home from literally anywhere that it travels through its operation.