시뮬레이션에서 IntelliGuide s23D(듀얼) 그리퍼를포함한 Brooks PreciseFlex IntelliGuide 그리퍼를제어하려면이섹션에설명된단계를따르세요.
1.프로그램을마우스오른쪽버튼으로클릭하고프로그램호출명령을추가합니다.
2."Gripper(gripper ID, gripper value)"를입력합니다. 예를들어, 듀얼그리퍼의 2번그리퍼를 50mm로이동하려면 "Gripper(2, 50)"을입력합니다.
a.단일그리퍼의경우호출을 "Gripper(gripper value)"로단축할수있습니다.
b.로봇이두개이상있는경우 "Gripper(gripper ID, gripper value, item.ptr)"를사용합니다. 예를들어 "Gripper(2, 50, item.ptr)"는듀얼그리퍼의 2번그리퍼를 50mm로이동하며, 부모로봇이프로그램에연결되도록합니다.
3.모든하위프로그램의첫번째명령으로, 그리고모든하위프로그램호출뒤에 Gripper() 명령을추가합니다. 이는포스트프로세서와의호환성을보장하기위한것입니다. Gripper() 명령이중복되는것은정상입니다.
4.Python 스크립트를추가하고이름을 "Gripper"로변경합니다.
5."Gripper" Python 스크립트를편집하고다음을붙여넣습니다:
from robodk import robolink
import sys
if len(sys.argv) < 2:
quit()
def get_item(ptr_item, RDK):
item = robolink.Item(RDK, str(ptr_item), robolink.ITEM_TYPE_PROGRAM)
if not item.Valid(True):
return None
return item
RDK = robolink.Robolink()
gripper_id = -1
gripper_value = 0
prog_item = None
# Get the gripper ID, value, possibly the caller
if len(sys.argv) == 2:
gripper_value = float(sys.argv[1])
elif len(sys.argv) >= 4:
gripper_id = int(sys.argv[1])
gripper_value = float(sys.argv[2])
prog_item = get_item(int(sys.argv[3]), RDK)
elif len(sys.argv) == 3:
prog_item = get_item(int(sys.argv[2]), RDK)
if prog_item:
gripper_value = float(sys.argv[1])
else:
gripper_id = int(sys.argv[1])
gripper_value = float(sys.argv[2])
# Get candidates
grippers = [x for x in RDK.ItemList(robolink.ITEM_TYPE_ROBOT_AXES) if 'intelliguide' in x.Name().lower() and len(x.Joints().tolist()) == 1]
if len(grippers) > 1 and prog_item:
robot_item = prog_item.getLink(robolink.ITEM_TYPE_ROBOT)
if not robot_item.Valid():
robot_item = RDK.ItemUserPick("Select the linked robot", robolink.ITEM_TYPE_ROBOT)
prog_item.setRobot(robot_item)
def get_flat_childs(item):
childs = item.Childs()
for child in item.Childs():
childs.extend(get_flat_childs(child))
return childs
childs = get_flat_childs(robot_item)
grippers = [x for x in childs if x.Type() == robolink.ITEM_TYPE_ROBOT and len(x.Joints().tolist()) == 1]
if not grippers:
RDK.ShowMessage('Unable to find a gripper!', False)
# Try to find the right gripper id (i.e. Dual Gripper 1)
gripper = grippers[0]
if gripper_id > 0:
gripper_ids = [g for g in grippers if g.Name().endswith(str(gripper_id))]
if gripper_ids:
gripper = gripper_ids[0]
gripper.MoveJ([gripper_value])
이방법은 Brooks 포스트프로세서와도호환됩니다.