Apera.ai and setting gripper based on pick_point value

Hello,

I have a 2f85 gripper on a UR10e and we’re trying to program it to set finger distance based on the pick_point variable that is commanded to the robot from Apera.ai vision system. I have a total 160 possible pick points that the vision system selects based on the orientation of the part in a bin. The parts are rings that are 25mm width, 100mm OD x 75mm ID.

Pick_point is stored as the gripper orientation in the robot program. Pick_point variable is a value from 0-159.

The gripper fingers need to open /close to the following positions prior to moving to the part to avoid fingers colliding with the bin walls or other parts

0-39 , the gripper should be set to open to 28mm
40-79 , gripper should be set to open to 21mm
80-99, gripper set to 0mm(closed)
100-139, grippers set to 21mm
140-159, gripper set to 0mm(closed)

Our first attempt was to use an IF command : 0<=PICK_POINT<=39 , then set gripper_pos 28mm.

After the IF command, we tried using ELSEIF for the other cases. When the program is executed, the gripper only sets to 28mm regardless of the pick_point value. ie: ’ PICK_POINT=147 ’

dane.brahler,
Using an if statement is definitely the way to go.
I’d write it in a script file and call it from the main program when required.

Set_gripper()

something like
def Set_gripper():
if Pick_point >=0 and Pick_point <=39:
gripper_open_to = 28
elif (Pick_point >39 and Pick_point <=79) or (Pick_point >99 and (Pick_point <=139):
gripper_open_to = 21
elif (Pick_point >79 and Pick_point <=99) or (Pick_point >139 and Pick_point <=159):
gripper_open_to = 0
end
end