Added system exit
This commit is contained in:
		@@ -1,9 +1,8 @@
 | 
			
		||||
#!/usr/bin/env python3
 | 
			
		||||
 | 
			
		||||
import urx
 | 
			
		||||
import math3d as m3d
 | 
			
		||||
import math
 | 
			
		||||
import time
 | 
			
		||||
import os
 | 
			
		||||
import logging
 | 
			
		||||
from urx.robotiq_two_finger_gripper import Robotiq_Two_Finger_Gripper
 | 
			
		||||
import sys
 | 
			
		||||
@@ -36,7 +35,11 @@ def init(ip):
 | 
			
		||||
        except:
 | 
			
		||||
            time.sleep(1)
 | 
			
		||||
    robotiqgrip = Robotiq_Two_Finger_Gripper(rob)
 | 
			
		||||
 | 
			
		||||
    # Sets robot arm endpoint offset (x,y,z,rx,ry,rz)
 | 
			
		||||
    rob.set_tcp((0, 0, 0.15, 0, 0, 0))
 | 
			
		||||
 | 
			
		||||
    # Set weight
 | 
			
		||||
    rob.set_payload(2, (0, 0, 0.1))
 | 
			
		||||
    #rob.set_payload(2, (0, 0, 0.1))
 | 
			
		||||
    time.sleep(0.2)
 | 
			
		||||
@@ -57,7 +60,7 @@ def set_pos_abs(x, y, z, xb, yb, zb):
 | 
			
		||||
    new_trans.pos.y = y
 | 
			
		||||
    new_trans.pos.z = z
 | 
			
		||||
    #rob.speedj(0.2, 0.5, 99999)
 | 
			
		||||
    rob.set_pose(new_trans, acc=5.0, vel=5.0, command="movej")  # apply the new pose
 | 
			
		||||
    rob.set_pose(new_trans, acc=2, vel=2, command="movej")  # apply the new pose
 | 
			
		||||
 | 
			
		||||
def set_pos_rel_rot_abs(x, y, z, xb, yb, zb):
 | 
			
		||||
    global rob
 | 
			
		||||
@@ -92,6 +95,7 @@ if __name__ == "__main__":
 | 
			
		||||
    set_pos_abs(-0.5, -0.2, 0.4, math.pi, 0, -math.pi)
 | 
			
		||||
    #set_pos_rel_rot_abs(0, 0, 0, math.pi, 0, -math.pi)
 | 
			
		||||
    fprint("Current tool pose is: ",  rob.getl())
 | 
			
		||||
    sys.exit(0)
 | 
			
		||||
    rob.stop()
 | 
			
		||||
    os.kill(os.getpid(), 9) # dirty kill of self
 | 
			
		||||
    sys.exit(0)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user