How can i arrange the execution of several python scripts in my system?
I have 3 python scripts, one in the robot and the other two are in two different sensors
How can i arrange the execution of several python scripts in my system?
I have 3 python scripts, one in the robot and the other two are in two different sensors
Hy,
maybe control it with condition or triggercondition?
Regards
Feature
@captain_feature I tried but the whole program stops and does not respond.
I have to reopen my file again.
I am using:
while app.Simulation.IsRunning== True:
when i remove it the problem doesn’t occur but my program doesn’t loop
Post your code the maybe the problem can be found…
Regards
Feature
@captain_feature signals 111 and 112 are used to switch between this and the other python script.
vcScript import *
from vcHelpers.Robot2 import *
def OnRun():
app = getApplication()
size=18
x,y,z=0,0,0
#getting the robot
robot_comp = app.findComponent("IRB 4600-45/2.05")
robot = getRobot(robot_comp)
robot.SignalMapOut.output(111, True)
while app.Simulation.IsRunning== True:
if robot.SignalMapOut.output(111, True):
#start by getting the part
comp = getComponent()
sensor_signal = comp.findBehaviour("SensorComponentSignal")
triggerCondition(lambda : sensor_signal.Value != None)
part = sensor_signal.Value
#Pick Part
robot.pick(part)
#Get the parent pallet
conveyorOut = app.findComponent("Conveyor 5")
pallet = conveyorOut.ComponentChildren[-3]
# Place pattern on pallet
robot.placeInPattern(pallet,x,y,z,3,3,2)
size -= 1
if x < 2:
x += 1
else:
x = 0
y += 1
if y > 2:
y = 0
z += 1
#nullifying the variables and allowing the pallet out to accept new one
if size == 0:
size=18
robot.SignalMapOut.output(110, True)
delay(5.0)
x,y,z=0,0,0
delay(0.5)
#motor on to accept new parts
robot.SignalMapOut.output(109, True)
robot.SignalMapOut.output(111, False)
robot.SignalMapOut.output(112, False)
#sensor_comp = app.findComponent("Sensor")
#sensor = sensor_comp.findBehaviour("PythonScript_2")`Preformatted text`
Hy,
is this one script you posted? -> If so please format the first part so as the second!
Regards
Feature
Just did it. I have also tried replacing the robot signals 111 and 222 with simple flags, but the program still break down.
The problem is in using flags with the while app,isSimulation.IsRunning statement I think
Try insert “delay(0.1)” in the while loop?
Regards
Feature
Luckily the program doesn’t stop anymore But, the if condition is never true to execute the task
I am not connecting signals 111 and 112 of the robot to anything.
Could this be the problem?