From 21b1bf7992942e2252f0e38f56bc29216a7bf335 Mon Sep 17 00:00:00 2001
From: BlueOceanWave <97416032+BlueOceanWave@users.noreply.github.com>
Date: Fri, 16 Feb 2024 20:36:43 -0600
Subject: [PATCH] Added system exit

---
 ur5_control.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/ur5_control.py b/ur5_control.py
index dcded4d..2030e60 100755
--- a/ur5_control.py
+++ b/ur5_control.py
@@ -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)