# OnRobot RG2 Gripper on UR3 with TCP communication

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")
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: