I want to attach a diameter variable to my 3 finger gripper, so that it’ll be easy to simply change the diameter value on the variable screen rather than digging through the code and finding the line that calls for grip diameter, is there a way I can attach the diameter section with preset variables?
Not sure if this answers your question, but here’s a script function we use with these grippers (not sure why this editor bolds some of the text)
We adjust the target diameter based on the OD or ID values of the part, which has been entered by the operator in the setup:
grip_force = 50
global internal_diameter = (ID_inches * 25.4) + 5
global external_diameter = (OD_inches * 25.4) - 5
release targets:
internal_reldia = (ID_inches *25.4) - 18
external_reldia = (OD_inches *25.4) + 18
if internal_reldia < 18:
internal_reldia = 18
end
if num == 0 or num == "internal":
tfg_flexible_grip(internal_diameter, grip_force, external_grip = False, stop_if_no_force=True)
elif num == 1 or num == "external":
tfg_flexible_grip(external_diameter, grip_force, external_grip = True, stop_if_no_force=True)
elif num == 2 or num == "internal_rel":
tfg_release(internal_reldia)
elif num == 3 or num == "external_rel":
tfg_release(external_reldia)
else:
popup("Invalid gripper command", title="Error", error = True,blocking=True)
halt
end