Simulating down time in robots

Hey Guys

I am trying to achieve simulating when robots break down in my line. I am trying to use a python script
to wait for a certain amount of time (using a distribution property as the time variable)

after that time the robot should break. stop working. I got this functionality working with simple machines
but I can not get it to work with robots.

I have tried setting the vcHelpers.Robot2

#vcHelpers.Robot2.Executor.IsEnabled = False

but even after I set the IsEnabled property of the executor to false the robot keeps moving.

I don’t know maybe Im targeting the wrong property

help me please I am running out of ideas

Hi @CarlosPlazas,

After you set the robot executor IsEnabled property to False, the robot will execute the current statement and stop after that. After you set the IsEnabled property back to True, you also need to call a statement so that the robot starts moving again.

I tested stopping the robot and then re-enabling it with the following script:

from vcScript import *

comp = getComponent()

def OnRun():
  exe = comp.getBehaviour('Executor')
  prog = exe.Program
  routine = prog.MainRoutine
  statements = routine.Statements
  
  exe.IsEnabled = True
  exe.callStatement(statements[0])
  
  #Robot breaks after delay
  delay(1)
  current_statement = exe.CurrentStatement
  exe.IsEnabled = False
  #Robot is repaired after 10 seconds
  delay(10)
  exe.IsEnabled = True
  exe.callStatement(current_statement)
1 Like

Hi @Este First of all thank you for quick reply

that code seems pretty straight forward but it is not working in my layout

I should have mentioned something else though

My robots are running routines from a RunRobotRoutine “proccess” statement
and I also have the robot connected to a Process robot controller.

in you code you are running the robot program from the python code which is why I am assuming it is not working for me here is a picture of my set up

will I be able to get this fucntionality even though I am using a Process robot controller? or is there any way to achieve this through process modeling UI or is the best option to just rebuild the whole line through python scripting and get rid of the process modeling components in order to get this script to work.

thanks

Carlos Plazas

The robot transport controller overrides the robot controls, so my earlier example does not work in this case. There is probably a way to modify the transport controller, but I think that’s overkill.

Have you tried implementing this without code directly in the Process?
Here’s an example using the IF statement:

-Este