Skip to content

Commit eee716e

Browse files
committed
make functions for open/close gripper
1 parent 2422344 commit eee716e

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

main.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,26 @@ def PickAndPlace():
4242
ur_control.move_joint_with_pose(list(map(add,p2_pick,p2_offset_approach)), a=1.4, v=1.05, t=0, r=0) # move to p2_pick with offset for approach
4343
ur_control.move_linear_pose(p2_pick, a=1.4, v=1.05, t=0, r=0) # move to p2_pick with linear motion
4444
# pick the piece - close gripper
45-
ur_control.set_digital_output(0, True)
46-
ur_control.set_digital_output(1, False)
45+
CloseGripper()
4746
##
4847
ur_control.move_joint_with_pose(list(map(add,p2_pick,p2_offset_leave)), a=1.4, v=1.05, t=0, r=0) # move to p2_pick with offset to leave
4948

5049
# Place
5150
ur_control.move_joint_with_pose(list(map(add,p3_place,p3_offset_approach)), a=1.4, v=1.05, t=0, r=0) # move to p3_place with offset for approach
5251
ur_control.move_linear_pose(p3_place, a=1.4, v=1.05, t=0, r=0) # move to p3_place with linear motion
5352
# place the piece - open gripper
54-
ur_control.set_digital_output(0, False)
55-
ur_control.set_digital_output(1, True)
53+
OpenGripper()
5654
##
5755
ur_control.move_joint_with_pose(list(map(add,p3_place,p3_offset_leave)), a=1.4, v=1.05, t=0, r=0) # move to p3_place with offset to leave
5856

57+
def OpenGripper():
58+
ur_control.set_digital_output(0, False)
59+
ur_control.set_digital_output(4, True)
60+
61+
def CloseGripper():
62+
ur_control.set_digital_output(0, True)
63+
ur_control.set_digital_output(4, False)
64+
5965

6066
if __name__ == '__main__':
6167
program()

0 commit comments

Comments
 (0)