I am using a UR3 Robot with OnRobot RG2 Gripper. I have successfully connected the robot to my computer via Ethernet and i am able to send move commands and receive data successfully with Python. But the commands for RG2 Gripper provided in the manual are not working. I can send commands to the gripper via teaching pendant (by command RG2) but not through my computer via Ethernet. Has anyone had a solution to this problem ? Thanks in advance.
I had the discussion with Robotiq about the same thing for their grippers when I started working with them, and as I understand it, the UR Caps commands are not installed as commands in the robot, but they are instead defined in each new program. If you read the .script files for a program created with a UR Caps command, the commands used will be defined before the robot program itself. I have yet to try it myself, but possibly you could define these functions yourself first and then send it?
But, for Robotiq there are more options available. For OnRobot I don't know.
Addition: I did some tests on the VM simulator, I just started a .script file from a program I previously did. Works like a charm. So for open and close scripts of the OnRobot, I guess it is fine.
import socket import time HOST = "10.0.2.15" # The remote host PORT = 30002 # The same port as used by the server s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) print("Starting Program") f=open("/home/ur/Desktop/TestScript.script", "r") s.send (f.read() + "/n") data = s.recv(1024) s.close() print ("Closed connection and received data")
Also got interested in how to send a value without having to open the script, like a width. I'm quite new to Python, but an example, adding all this instead of the f.open above:
width = 11 # 11 just and example, user input or something works as well.. with open("/home/ur/Desktop/TestScript.script", "r") as in_file: buf = in_file.readlines() i=0 with open("/home/ur/Desktop/TestScriptOut.script", "w+") as out_file: for line in buf: if i == 0: # Notice that this will add var_1 in the second line line = line + " global var_1 = %s\n" % width out_file.write(line) i=i+1 out_file.close() f = open("/home/ur/Desktop/TestScriptOut.script", "r")