Position is out of reach of the robot

Hi there,

i want to simulate robots picking glass plates from a conveyor line, fed by an advanced feeder with random starting positions.

so far so good, glass with specific ProdIDs runs from the feeder onto the line and gets picked by the robot. But as soon as a plate runs through the sensor and is not in reach of the robot connected to the sensor the simulation stops. I want the robot to ignore the plate and wait for the next one in reach.

 

My code so far looks like this:
`from vcScript import *
from vcHelpers.Robot2 import *
import sys
from vcSimulation import *

def OnRun():
app = getApplication()
robot_comp = app.findComponent(“KR 210 R3100 ultra”)
robot = getRobot(robot_comp)
gestell = app.findComponent(“2016-09-05_Glasgestell_1800x1200_leer”)
comp = getComponent()
sensor_signal = comp.findBehaviour(“SensorSignal”)
stack_size = 20
while app.Simulation.IsRunning:
robot.callSubRoutine(“MoveToIdle”)
triggerCondition(lambda: sensor_signal.Value != None)
part = sensor_signal.Value
ID = part.getProperty(“ProdID”)

if ID.Value == “111”:
robot.pickMovingPart(part,0,0,0,378,0,0,0)
robot.callSubRoutine(“MoveToGestell”)
robot.callSubRoutine(“MoveToDrop”)
robot.releaseComponent(gestell, part)
robot.delay(1)
robot.callSubRoutine(“MoveToIdle”)

i tried:
try:
robot.pick[…]
except:
pass

but the simulation stops when the robot realizes the plate is not in reach, so it won’t even try to pass.

Is there a variable i can put into the if statement wether the plate is in reach or not?

I guess that you are modelling your own conveyor to call the robot to do a specific handeling task and the parts won’t be stopped on the conveyor.

I’m not too sure where the issue comes from. Possible reasons are:

  • Part is already on the edge to being out of range due to the position of the sensor.
  • Conveyor speed is too fast so that the robot cannot get it at all.
  • Robot is being called too late to be able to reach the part
I actually do guess that in your case it's something of the first two.

I would change that programming to rely on a list of components which may be picked. You would need to add a second path sensor to detect when a part leaves the point where the robot would still reach the part when being called. Your existing path sensor acts more or less like a detector that a part has entered the reach of the robot.

Therefore you can use a list of components to check which components are in reach. You would need to add the “def OnSignal( signal ):” method to the script which gets triggered when a signal gets updated. I guess that you are already using a component sensor for the triggerCondition so you will need to add a second component sensor for the second path sensor and add the python script to its connection property. Then you need to define the adding and removing of components in the OnSignal method depending on the component signal.

After that change you will also need to change the triggerCondition to see if there is a product in the list:

condition( lambda: queue ) #Where queue is your list of available components

You will also need to always call the first component which should be the first of the list

part = queue.pop(0) #You get the first part and remove it from the list so that the robot doesn’t try to get the part in the next loop.

I hope that gives you an idea!

Greetings, Felix

Hi Felix,

Thanks for your answer. I’m actually using a standard sensor conveyor and the part to pick is mechanically out of reach e.g. the part comes on the other side of the conveyor for another robot to pick later on. I want the robot 1 to ignore it since it is out of reach, despite the sensor telling the robot to pick the part. Something like an if-statement to check if the part is in reach or not. But i can’t get useful Error, since it’s a method from vcHelpers.Robot2

BR

Dubsepp

I don’t think that this is possible with the method from vcHelpers.Robot2. If you would want to check for the reach you could calculate the distance between the part and the robot root node. Should be pretty easy to program. However you will need to specify the distance yourself to determine a part is in reach.

Good luck & keep us updated :slight_smile: