I have a sensor and motor connected to a conveyor. When the sensor sense a box, the conveyor stops as i want. But the robot picks random boxes from the conveyor.
How can I make it pick the box that triggered the sensor ?
my code is:
app = getApplication()
conveyorIn= app.findComponent(“Conveyor”)
print(len(conveyorIn.ComponentChildren))
box = conveyorIn.ComponentChildren[1]
Robot.pick(box)
I think the problem is in line 4 as the index chosen from the Component Children list changes everytime
I am supposed to program the robot to work for different speed of feeders and conveyors. How can I make the picking of the box i want independant of the number of boxes on the conveyor?
You could make a subroutine in the program tab for the robot where you manually set it to pick the box from the sensor and then you can call that subroutine in python when needed.