From c20e4e278c898eacd3fbb6bde43451d78dd2ccbc Mon Sep 17 00:00:00 2001 From: u3099811 Date: Fri, 20 Apr 2018 15:13:07 +1000 Subject: [PATCH 1/9] A function was added to urrobot to allow a user to control the RG2 gripper --- urx/urrobot.py | 161 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) diff --git a/urx/urrobot.py b/urx/urrobot.py index a46ea05..95e4edc 100644 --- a/urx/urrobot.py +++ b/urx/urrobot.py @@ -441,3 +441,164 @@ def down(self, z=0.05, acc=0.01, vel=0.01): Move down in csys z """ self.up(-z, acc, vel) + + def move_RG2gripper(self,width): + """ + + Created by David Hinwood, University of Canberra + This function opens and closes the RG2 gripper produced by on robot + This work was inspired by Mark Silliman who produced a class to control + a gripper made by robotiq and Sharath Jotawar who created a ROS package + used in moveit to control the RG2 gripper + """ + progrg2 = "" + try: + if width >= 0 and width <= 110: + progrg2 += ("def rg2grpCntrl():\n") + progrg2 += (" textmsg(\"inside RG2 function called\")\n") + progrg2 += (" target_width=" + str(width)) + "\n" + progrg2 += (" target_force=40\n") + progrg2 += (" payload=1.0\n") + progrg2 += (" set_payload1=False\n") + progrg2 += (" depth_compensation=False\n") + progrg2 += (" slave=False\n") + progrg2 += (" timeout = 0\n") + progrg2 += (" while get_digital_in(9) == False:\n") + progrg2 += (" textmsg(\"inside while\")\n") + progrg2 += (" if timeout > 400:\n") + progrg2 += (" break\n") + progrg2 += (" end\n") + progrg2 += (" timeout = timeout+1\n") + progrg2 += (" sync()\n") + progrg2 += (" end\n") + progrg2 += (" textmsg(\"outside while\")\n") + progrg2 += (" def bit(input):\n") + progrg2 += (" msb=65536\n") + progrg2 += (" local i=0\n") + progrg2 += (" local output=0\n") + progrg2 += (" while i<17:\n") + progrg2 += (" set_digital_out(8,True)\n") + progrg2 += (" if input>=msb:\n") + progrg2 += (" input=input-msb\n") + progrg2 += (" set_digital_out(9,False)\n") + progrg2 += (" else:\n") + progrg2 += (" set_digital_out(9,True)\n") + progrg2 += (" end\n") + progrg2 += (" if get_digital_in(8):\n") + progrg2 += (" out=1\n") + progrg2 += (" end\n") + progrg2 += (" sync()\n") + progrg2 += (" set_digital_out(8,False)\n") + progrg2 += (" sync()\n") + progrg2 += (" input=input*2\n") + progrg2 += (" output=output*2\n") + progrg2 += (" i=i+1\n") + progrg2 += (" end\n") + progrg2 += (" return output\n") + progrg2 += (" end\n") + progrg2 += (" textmsg(\"outside bit definition\")\n") + progrg2 += (" target_width=target_width+0.0\n") + progrg2 += (" if target_force>40:\n") + progrg2 += (" target_force=40\n") + progrg2 += (" end\n") + progrg2 += (" if target_force<4:\n") + progrg2 += (" target_force=4\n") + progrg2 += (" end\n") + progrg2 += (" if target_width>110:\n") + progrg2 += (" target_width=110\n") + progrg2 += (" end\n") + progrg2 += (" if target_width<0:\n") + progrg2 += (" target_width=0\n") + progrg2 += (" end\n") + progrg2 += (" rg_data=floor(target_width)*4\n") + progrg2 += (" rg_data=rg_data+floor(target_force/2)*4*111\n") + progrg2 += (" if slave:\n") + progrg2 += (" rg_data=rg_data+16384\n") + progrg2 += (" end\n") + progrg2 += (" textmsg(\"about to call bit\")\n") + progrg2 += (" bit(rg_data)\n") + progrg2 += (" textmsg(\"called bit\")\n") + progrg2 += (" if depth_compensation:\n") + progrg2 += (" finger_length = 55.0/1000\n") + progrg2 += (" finger_heigth_disp = 5.0/1000\n") + progrg2 += (" center_displacement = 7.5/1000\n") + progrg2 += (" start_pose = get_forward_kin()\n") + progrg2 += (" set_analog_inputrange(2, 1)\n") + progrg2 += (" zscale = (get_analog_in(2)-0.026)/2.976\n") + progrg2 += (" zangle = zscale*1.57079633-0.087266462\n") + progrg2 += (" zwidth = 5+110*sin(zangle)\n") + progrg2 += (" start_depth = cos(zangle)*finger_length\n") + progrg2 += (" sync()\n") + progrg2 += (" sync()\n") + progrg2 += (" timeout = 0\n") + progrg2 += (" while get_digital_in(9) == True:\n") + progrg2 += (" timeout=timeout+1\n") + progrg2 += (" sync()\n") + progrg2 += (" if timeout > 20:\n") + progrg2 += (" break\n") + progrg2 += (" end\n") + progrg2 += (" end\n") + progrg2 += (" timeout = 0\n") + progrg2 += (" while get_digital_in(9) == False:\n") + progrg2 += (" zscale = (get_analog_in(2)-0.026)/2.976\n") + progrg2 += (" zangle = zscale*1.57079633-0.087266462\n") + progrg2 += (" zwidth = 5+110*sin(zangle)\n") + progrg2 += (" measure_depth = cos(zangle)*finger_length\n") + progrg2 += (" compensation_depth = (measure_depth - start_depth)\n") + progrg2 += (" target_pose = pose_trans(start_pose,p[0,0,-compensation_depth,0,0,0])\n") + progrg2 += (" if timeout > 400:\n") + progrg2 += (" break\n") + progrg2 += (" end\n") + progrg2 += (" timeout=timeout+1\n") + progrg2 += (" servoj(get_inverse_kin(target_pose),0,0,0.008,0.033,1700)\n") + progrg2 += (" end\n") + progrg2 += (" nspeed = norm(get_actual_tcp_speed())\n") + progrg2 += (" while nspeed > 0.001:\n") + progrg2 += (" servoj(get_inverse_kin(target_pose),0,0,0.008,0.033,1700)\n") + progrg2 += (" nspeed = norm(get_actual_tcp_speed())\n") + progrg2 += (" end\n") + progrg2 += (" end\n") + progrg2 += (" if depth_compensation==False:\n") + progrg2 += (" timeout = 0\n") + progrg2 += (" while get_digital_in(9) == True:\n") + progrg2 += (" timeout = timeout+1\n") + progrg2 += (" sync()\n") + progrg2 += (" if timeout > 20:\n") + progrg2 += (" break\n") + progrg2 += (" end\n") + progrg2 += (" end\n") + progrg2 += (" timeout = 0\n") + progrg2 += (" while get_digital_in(9) == False:\n") + progrg2 += (" timeout = timeout+1\n") + progrg2 += (" sync()\n") + progrg2 += (" if timeout > 400:\n") + progrg2 += (" break\n") + progrg2 += (" end\n") + progrg2 += (" end\n") + progrg2 += (" end\n") + progrg2 += (" if set_payload1:\n") + progrg2 += (" if slave:\n") + progrg2 += (" if get_analog_in(3) < 2:\n") + progrg2 += (" zslam=0\n") + progrg2 += (" else:\n") + progrg2 += (" zslam=payload\n") + progrg2 += (" end\n") + progrg2 += (" else:\n") + progrg2 += (" if get_digital_in(8) == False:\n") + progrg2 += (" zmasm=0\n") + progrg2 += (" else:\n") + progrg2 += (" zmasm=payload\n") + progrg2 += (" end\n") + progrg2 += (" end\n") + progrg2 += (" zsysm=0.0\n") + progrg2 += (" zload=zmasm+zslam+zsysm\n") + progrg2 += (" set_payload(zload)\n") + progrg2 += (" end\n") + progrg2 += ("end\n") + self.send_program(progrg2) + else: + self.logger.debug("Width is required to be between 0 and 110") + raise RobotException("Please ensure the gripper width is between 0 and 110") + except: + raise RobotException("An unexpected error occured") + From f25b0f21f9d81ece4a273cd8ee626bae179c757d Mon Sep 17 00:00:00 2001 From: u3099811 Date: Thu, 16 Aug 2018 14:09:03 +1000 Subject: [PATCH 2/9] RG2 Gripper Class update, about to run final test --- README.md | 31 +++++- urx/RG2Gripper.py | 234 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 264 insertions(+), 1 deletion(-) create mode 100644 urx/RG2Gripper.py diff --git a/README.md b/README.md index f21fdc3..8be6bdd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ - urx is a python library to control the robots from 'Universal robot'. It is published under the LGPL license and comes with absolutely no guarantee. It is meant as an easy to use module for pick and place operations, although it has been used for welding and other sensor based applications that do not require high control frequency. @@ -114,3 +113,33 @@ if __name__ == '__main__': print "true" sys.exit() ``` + +#RG2 Gripper + +urx can also control an RG2 gripper attached to the UR robot. This class was primarily developed by [David Hinwood](https://github.com/u3099811) + +Additional Notes +Gripper will contiously try to close(stopped at the set force value in newtons) if set to zero and grasping an object. This is part of the design and not an error. The same functionality is embedded in the default program + +##Example use: + + import sys + import urx + #import the class + from urx import RG2Gripper as GripClass + #initialize robot + rob = urx.Robot("192.168.0.100") + #gripper object instantiation + gripperInstance = GripClass.RG2(rob) + #set to close, 0 being the gap between the pincers + gripperInstance.setWidth(0) + #set to open, 110 being the maximum, can set to any value lower + gripperInstance.setWidth(110) + #get current width + #possible uses of the width value can be used to determine if the robot is grasping and object + gripperInstance.getWidth() + #shutdown routine + rob.close() + sys.exit() + + diff --git a/urx/RG2Gripper.py b/urx/RG2Gripper.py new file mode 100644 index 0000000..d6da71e --- /dev/null +++ b/urx/RG2Gripper.py @@ -0,0 +1,234 @@ +#! /usr/bin/env python +from urx.robot import Robot +import threading +import logging +import time + +""" Created by David Hinwood, University of Canberra + This function opens and closes the RG2 gripper produced by on robot + This work was inspired by Mark Silliman who produced a class to control + a gripper made by robotiq in urx and Sharath Jotawar who created a ROS package + used in moveit to control the RG2 gripper + + Notes: + -Requires an Ethernet connection to your ur10, dynamically finds IP address + -While an object is grasped, the gripper is still going to 0 meaning if + you remove the object from the gripper while having set the width to zero + it will still go to zero + -Possible ways to determine grasping include setting the width to max for + non grasping movements and to evaluate pickup check the width + +""" + + +class RG2: + + '''Initialization of class, requires user to be connected to robot via ethernet''' + def __init__(self,RobotParameter): + import netifaces as ni + ni.ifaddresses('eth0') + self.ip = ni.ifaddresses('eth0')[ni.AF_INET][0]['addr'] + self.Robot = (RobotParameter) + self.GripperMonitorSocket=50002 + self.MonitorThreadRunning=False + self.currentwidth=0.0 + self.logger = logging.getLogger("urx") + + '''Gets the current width of the gripper''' + def getWidth(self): + + def StartBackgroundListenerService(): + data = float(-1) + while self.MonitorThreadRunning==True: + try: + import socket + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + server_address = (self.ip, 50002) + sock.bind(server_address) + sock.listen(1) + connection, client_address = sock.accept() + data = connection.recv(64) + data = float(data) + self.currentwidth = data + connection.close() + self.MonitorThreadRunning=False + except Exception as e: + print e + pass + return + + cmd_str = "def rg2GripDetect():\n" + cmd_str += " zscale = (get_analog_in(2)-0.026)/2.976\n" + cmd_str += " zangle = zscale*1.57079633-0.087266462\n" + cmd_str += " zwidth = 5+110*sin(zangle)\n" + cmd_str += " global measure_width = (floor(zwidth*10))/10-0.0\n" + cmd_str += " textmsg(\"width\",measure_width)\n" + cmd_str += " socket_open(\"" + self.ip + "\", " + "50002" + ")\n" + cmd_str += " socket_send_string(measure_width)\n" + cmd_str += " socket_close()\n" + cmd_str += "end\n" + thread = threading.Thread(target=StartBackgroundListenerService,args=()) + thread.daemon=True + self.MonitorThreadRunning=True + thread.start() + self.Robot.send_program(cmd_str) + return self.currentwidth + + '''Sets the width of the robot + width can be anywhere between 0 and 110, required parameter + force can be between 3 and 40, default is 20 + ''' + def setWidth(self,width,force=20): + try: + if width >= 0 and width <= 110 and force >= 3 and force <= 40: + progrg2 = ("def rg2grpCntrl():\n") + progrg2 += (" textmsg(\"inside RG2 function called\")\n") + progrg2 += (" target_width=" + str(width) + "\n") + progrg2 += (" target_force=" + str(force) + "\n") + progrg2 += (" timeoutLength=400\n") + progrg2 += (" timeoutLengthSecondary=20\n") + progrg2 += (" payload=1.0\n") + progrg2 += (" set_payload1=False\n") + progrg2 += (" depth_compensation=False\n") + progrg2 += (" slave=False\n") + progrg2 += (" timeout = 0\n") + progrg2 += (" while get_digital_in(9) == False:\n") + progrg2 += (" textmsg(\"inside while\")\n") + progrg2 += (" if timeout > timeoutLength:\n") + progrg2 += (" break\n") + progrg2 += (" end\n") + progrg2 += (" timeout = timeout+1\n") + progrg2 += (" sync()\n") + progrg2 += (" end\n") + progrg2 += (" textmsg(\"outside while\")\n") + progrg2 += (" def bit(input):\n") + progrg2 += (" msb=65536\n") + progrg2 += (" local i=0\n") + progrg2 += (" local output=0\n") + progrg2 += (" while i<17:\n") + progrg2 += (" set_digital_out(8,True)\n") + progrg2 += (" if input>=msb:\n") + progrg2 += (" input=input-msb\n") + progrg2 += (" set_digital_out(9,False)\n") + progrg2 += (" else:\n") + progrg2 += (" set_digital_out(9,True)\n") + progrg2 += (" end\n") + progrg2 += (" if get_digital_in(8):\n") + progrg2 += (" out=1\n") + progrg2 += (" end\n") + progrg2 += (" sync()\n") + progrg2 += (" set_digital_out(8,False)\n") + progrg2 += (" sync()\n") + progrg2 += (" input=input*2\n") + progrg2 += (" output=output*2\n") + progrg2 += (" i=i+1\n") + progrg2 += (" end\n") + progrg2 += (" return output\n") + progrg2 += (" end\n") + progrg2 += (" textmsg(\"outside bit definition\")\n") + progrg2 += (" target_width=target_width+0.0\n") + progrg2 += (" if target_force>40:\n") + progrg2 += (" target_force=40\n") + progrg2 += (" end\n") + progrg2 += (" if target_force<4:\n") + progrg2 += (" target_force=4\n") + progrg2 += (" end\n") + progrg2 += (" if target_width>110:\n") + progrg2 += (" target_width=110\n") + progrg2 += (" end\n") + progrg2 += (" if target_width<0:\n") + progrg2 += (" target_width=0\n") + progrg2 += (" end\n") + progrg2 += (" rg_data=floor(target_width)*4\n") + progrg2 += (" rg_data=rg_data+floor(target_force/2)*4*111\n") + progrg2 += (" if slave:\n") + progrg2 += (" rg_data=rg_data+16384\n") + progrg2 += (" end\n") + progrg2 += (" textmsg(\"about to call bit\")\n") + progrg2 += (" bit(rg_data)\n") + progrg2 += (" textmsg(\"called bit\")\n") + progrg2 += (" if depth_compensation:\n") + progrg2 += (" finger_length = 55.0/1000\n") + progrg2 += (" finger_heigth_disp = 5.0/1000\n") + progrg2 += (" center_displacement = 7.5/1000\n") + progrg2 += (" start_pose = get_forward_kin()\n") + progrg2 += (" set_analog_inputrange(2, 1)\n") + progrg2 += (" zscale = (get_analog_in(2)-0.026)/2.976\n") + progrg2 += (" zangle = zscale*1.57079633-0.087266462\n") + progrg2 += (" zwidth = 5+110*sin(zangle)\n") + progrg2 += (" start_depth = cos(zangle)*finger_length\n") + progrg2 += (" sync()\n") + progrg2 += (" sync()\n") + progrg2 += (" timeout = 0\n") + progrg2 += (" while get_digital_in(9) == True:\n") + progrg2 += (" timeout=timeout+1\n") + progrg2 += (" sync()\n") + progrg2 += (" if timeout > timeoutLengthSecondary:\n") + progrg2 += (" break\n") + progrg2 += (" end\n") + progrg2 += (" end\n") + progrg2 += (" timeout = 0\n") + progrg2 += (" while get_digital_in(9) == False:\n") + progrg2 += (" zscale = (get_analog_in(2)-0.026)/2.976\n") + progrg2 += (" zangle = zscale*1.57079633-0.087266462\n") + progrg2 += (" zwidth = 5+110*sin(zangle)\n") + progrg2 += (" measure_depth = cos(zangle)*finger_length\n") + progrg2 += (" compensation_depth = (measure_depth - start_depth)\n") + progrg2 += (" target_pose = pose_trans(start_pose,p[0,0,-compensation_depth,0,0,0])\n") + progrg2 += (" if timeout > timeoutLength:\n") + progrg2 += (" break\n") + progrg2 += (" end\n") + progrg2 += (" timeout=timeout+1\n") + progrg2 += (" servoj(get_inverse_kin(target_pose),0,0,0.008,0.033,1700)\n") + progrg2 += (" end\n") + progrg2 += (" nspeed = norm(get_actual_tcp_speed())\n") + progrg2 += (" while nspeed > 0.001:\n") + progrg2 += (" servoj(get_inverse_kin(target_pose),0,0,0.008,0.033,1700)\n") + progrg2 += (" nspeed = norm(get_actual_tcp_speed())\n") + progrg2 += (" end\n") + progrg2 += (" end\n") + progrg2 += (" if depth_compensation==False:\n") + progrg2 += (" timeout = 0\n") + progrg2 += (" while get_digital_in(9) == True:\n") + progrg2 += (" timeout = timeout+1\n") + progrg2 += (" sync()\n") + progrg2 += (" if timeout > timeoutLengthSecondary:\n") + progrg2 += (" break\n") + progrg2 += (" end\n") + progrg2 += (" end\n") + progrg2 += (" timeout = 0\n") + progrg2 += (" while get_digital_in(9) == False:\n") + progrg2 += (" timeout = timeout+1\n") + progrg2 += (" sync()\n") + progrg2 += (" if timeout > timeoutLength:\n") + progrg2 += (" break\n") + progrg2 += (" end\n") + progrg2 += (" end\n") + progrg2 += (" end\n") + progrg2 += (" if set_payload1:\n") + progrg2 += (" if slave:\n") + progrg2 += (" if get_analog_in(3) < 2:\n") + progrg2 += (" zslam=0\n") + progrg2 += (" else:\n") + progrg2 += (" zslam=payload\n") + progrg2 += (" end\n") + progrg2 += (" else:\n") + progrg2 += (" if get_digital_in(8) == False:\n") + progrg2 += (" zmasm=0\n") + progrg2 += (" else:\n") + progrg2 += (" zmasm=payload\n") + progrg2 += (" end\n") + progrg2 += (" end\n") + progrg2 += (" zsysm=0.0\n") + progrg2 += (" zload=zmasm+zslam+zsysm\n") + progrg2 += (" set_payload(zload)\n") + progrg2 += (" end\n") + progrg2 += ("end\n") + self.Robot.send_program(progrg2) + else: + self.logger.debug("Width is required to be between 0 and 110") + raise RobotException("Please ensure the gripper width is between 0 and 110 and the force is between 3 and 40") + except: + raise RobotException("An unexpected error occured") + return + From 7f31190a7049c3a9f2260a73531ec6298c6d33b7 Mon Sep 17 00:00:00 2001 From: u3099811 Date: Thu, 16 Aug 2018 15:41:59 +1000 Subject: [PATCH 3/9] Final Version, testing works, would like a secondary opinion if possible --- README.md | 4 +++- urx/RG2Gripper.py | 50 +++++++++++++++++++++++++++++++---------------- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 8be6bdd..380013e 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,9 @@ if __name__ == '__main__': urx can also control an RG2 gripper attached to the UR robot. This class was primarily developed by [David Hinwood](https://github.com/u3099811) Additional Notes -Gripper will contiously try to close(stopped at the set force value in newtons) if set to zero and grasping an object. This is part of the design and not an error. The same functionality is embedded in the default program + Gripper will contiously try to close(stopped at the set force value in newtons) if set to a width smaller than the current width while grasping an object. This is part of the design and not an error. The same functionality is embedded in the default program + + You require an ethernet connection to the robot ##Example use: diff --git a/urx/RG2Gripper.py b/urx/RG2Gripper.py index d6da71e..67e5d71 100644 --- a/urx/RG2Gripper.py +++ b/urx/RG2Gripper.py @@ -17,29 +17,40 @@ it will still go to zero -Possible ways to determine grasping include setting the width to max for non grasping movements and to evaluate pickup check the width - + + + Future feautes + While it is possible to currently infer whether the robot is currently holding + something it would be a beneficial feature to read the force being applied and + return to user grasp success would be a prefered implementation. Unfortunatly + this was unfeasible during the first round at development. It is on the + horizon but on an unknown timeframe. + + License: LGPL-3.0 """ class RG2: - '''Initialization of class, requires user to be connected to robot via ethernet''' - def __init__(self,RobotParameter): + + def __init__(self, RobotParameter): import netifaces as ni ni.ifaddresses('eth0') self.ip = ni.ifaddresses('eth0')[ni.AF_INET][0]['addr'] self.Robot = (RobotParameter) - self.GripperMonitorSocket=50002 - self.MonitorThreadRunning=False - self.currentwidth=0.0 + self.GripperMonitorSocket = 50002 + self.MonitorThreadRunning = False + self.currentwidth = 0.0 self.logger = logging.getLogger("urx") - '''Gets the current width of the gripper''' + '''Gets the current width between the gripper fingers in mm''' + def getWidth(self): + '''opens a thread in the background to listen to a message from the gripper''' def StartBackgroundListenerService(): data = float(-1) - while self.MonitorThreadRunning==True: + while self.MonitorThreadRunning == True: try: import socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) @@ -51,7 +62,7 @@ def StartBackgroundListenerService(): data = float(data) self.currentwidth = data connection.close() - self.MonitorThreadRunning=False + self.MonitorThreadRunning = False except Exception as e: print e pass @@ -67,18 +78,23 @@ def StartBackgroundListenerService(): cmd_str += " socket_send_string(measure_width)\n" cmd_str += " socket_close()\n" cmd_str += "end\n" - thread = threading.Thread(target=StartBackgroundListenerService,args=()) - thread.daemon=True - self.MonitorThreadRunning=True + thread = threading.Thread(target=StartBackgroundListenerService, args=()) + thread.daemon = True + self.MonitorThreadRunning = True thread.start() self.Robot.send_program(cmd_str) + #small delay to wait for the thread + time.sleep(0.2) return self.currentwidth + '''Sets the width of the robot - width can be anywhere between 0 and 110, required parameter + width can be anywhere between 0 and 110, required parameter force can be between 3 and 40, default is 20 ''' - def setWidth(self,width,force=20): + + + def setWidth(self, width, force=20): try: if width >= 0 and width <= 110 and force >= 3 and force <= 40: progrg2 = ("def rg2grpCntrl():\n") @@ -226,9 +242,9 @@ def setWidth(self,width,force=20): progrg2 += ("end\n") self.Robot.send_program(progrg2) else: - self.logger.debug("Width is required to be between 0 and 110") - raise RobotException("Please ensure the gripper width is between 0 and 110 and the force is between 3 and 40") + self.logger.debug("Width is required to be between 0 and 110 and force is required to be 3 and 40") + raise RobotException( + "Please ensure the gripper width is between 0 and 110 and the force is between 3 and 40") except: raise RobotException("An unexpected error occured") return - From d6e7d361be1b7245918b8de8d97a19305e4326f6 Mon Sep 17 00:00:00 2001 From: u3099811 Date: Thu, 16 Aug 2018 15:51:32 +1000 Subject: [PATCH 4/9] updated description spelling error --- README.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 380013e..9dac93d 100644 --- a/README.md +++ b/README.md @@ -119,29 +119,29 @@ if __name__ == '__main__': urx can also control an RG2 gripper attached to the UR robot. This class was primarily developed by [David Hinwood](https://github.com/u3099811) Additional Notes - Gripper will contiously try to close(stopped at the set force value in newtons) if set to a width smaller than the current width while grasping an object. This is part of the design and not an error. The same functionality is embedded in the default program + Gripper will contiously try to close(stopped at the set force value in newtons) if set to a width smaller than the current width while grasping an object. This is part of the design and not an error. The same functionality is embedded in the default program You require an ethernet connection to the robot ##Example use: - import sys - import urx - #import the class - from urx import RG2Gripper as GripClass - #initialize robot - rob = urx.Robot("192.168.0.100") - #gripper object instantiation - gripperInstance = GripClass.RG2(rob) - #set to close, 0 being the gap between the pincers - gripperInstance.setWidth(0) - #set to open, 110 being the maximum, can set to any value lower - gripperInstance.setWidth(110) - #get current width - #possible uses of the width value can be used to determine if the robot is grasping and object - gripperInstance.getWidth() - #shutdown routine - rob.close() - sys.exit() +import sys +import urx +import time +#import file +from urx import RG2Gripper as GripClass +rob = urx.Robot("10.0.0.157") +#instantiate object +gripperInstance = GripClass.RG2(rob) +#basic delay for script(to complete action, RG2 approximatly takes 1.3 seconds to close from completely open) +time.sleep(2) +#set distance between pincers apart, in this case closing +gripperInstance.setWidth(0) +time.sleep(2) +#open the gripper completly +gripperInstance.setWidth(110) +time.sleep(2) +#returns the current width of the robot +gripperInstance.getWidth() From 3f1450f9f64b174747fdf501e6fc10c98f714a41 Mon Sep 17 00:00:00 2001 From: u3099811 Date: Thu, 16 Aug 2018 15:53:37 +1000 Subject: [PATCH 5/9] updated spelling error --- urx/RG2Gripper.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/urx/RG2Gripper.py b/urx/RG2Gripper.py index 67e5d71..8da797a 100644 --- a/urx/RG2Gripper.py +++ b/urx/RG2Gripper.py @@ -22,9 +22,8 @@ Future feautes While it is possible to currently infer whether the robot is currently holding something it would be a beneficial feature to read the force being applied and - return to user grasp success would be a prefered implementation. Unfortunatly - this was unfeasible during the first round at development. It is on the - horizon but on an unknown timeframe. + return to user grasp success. Unfortunatly this was unfeasible during the first + round at development. It is on the horizon but on an unknown timeframe. License: LGPL-3.0 """ From f6f4d9529d9c453cf0825a3c71d4496df2e21316 Mon Sep 17 00:00:00 2001 From: u3099811 Date: Thu, 16 Aug 2018 16:07:03 +1000 Subject: [PATCH 6/9] updated readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9dac93d..6e07252 100644 --- a/README.md +++ b/README.md @@ -117,12 +117,12 @@ if __name__ == '__main__': #RG2 Gripper urx can also control an RG2 gripper attached to the UR robot. This class was primarily developed by [David Hinwood](https://github.com/u3099811) - +''' Additional Notes Gripper will contiously try to close(stopped at the set force value in newtons) if set to a width smaller than the current width while grasping an object. This is part of the design and not an error. The same functionality is embedded in the default program You require an ethernet connection to the robot - +''' ##Example use: import sys From dc5696c8fead7b8a401e6bc233cd8379e1f68ef4 Mon Sep 17 00:00:00 2001 From: u3099811 Date: Thu, 16 Aug 2018 16:08:36 +1000 Subject: [PATCH 7/9] updated readme --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6e07252..ff29ace 100644 --- a/README.md +++ b/README.md @@ -117,11 +117,10 @@ if __name__ == '__main__': #RG2 Gripper urx can also control an RG2 gripper attached to the UR robot. This class was primarily developed by [David Hinwood](https://github.com/u3099811) -''' -Additional Notes - Gripper will contiously try to close(stopped at the set force value in newtons) if set to a width smaller than the current width while grasping an object. This is part of the design and not an error. The same functionality is embedded in the default program - You require an ethernet connection to the robot +-Gripper will contiously try to close(stopped at the set force value in newtons) if set to a width smaller than the current width while grasping an object. This is part of the design and not an error. The same functionality is embedded in the default program + +-You require an ethernet connection to the robot ''' ##Example use: From 879418bba840e561094e5838642142b848950bfe Mon Sep 17 00:00:00 2001 From: u3099811 Date: Thu, 16 Aug 2018 16:09:32 +1000 Subject: [PATCH 8/9] updated readme --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ff29ace..39208f1 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ urx can also control an RG2 gripper attached to the UR robot. This class was pri -You require an ethernet connection to the robot ''' ##Example use: - +```python import sys import urx import time @@ -142,5 +142,6 @@ gripperInstance.setWidth(110) time.sleep(2) #returns the current width of the robot gripperInstance.getWidth() +``` From cfd1ff272b6ae3385d294fec1195bc55d3912a65 Mon Sep 17 00:00:00 2001 From: u3099811 Date: Thu, 16 Aug 2018 16:10:14 +1000 Subject: [PATCH 9/9] updated readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 39208f1..4cbdedd 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ urx can also control an RG2 gripper attached to the UR robot. This class was pri -Gripper will contiously try to close(stopped at the set force value in newtons) if set to a width smaller than the current width while grasping an object. This is part of the design and not an error. The same functionality is embedded in the default program -You require an ethernet connection to the robot -''' + ##Example use: ```python import sys