The following describes the procedure If you are looking to remotely control a Robotiq Gripper through port 30002 on universal robot.
Native UR command like moveL or servoJ can be sent directly to port 30002. All functions implemented by a URCap like the Robotiq Gripper function are unknown even if the URCap is installed. When a program is written on the teach pendant, all URCap function definitions are implemented in this program each time it is compiled and executed by the UR controller. This means if you try to send the command line rq_move_and_wait(58) function to the controller by the port 30002, it will never work because it's unknown to the controller. To achieve a gripper function, the definition of this function must also be sent.
In the compressed file included below, you’ll find a file named gripper.script. The file contains the definition of all the available Robotiq gripper functions. At the bottom of the file, you’ll see a list of all the functions ready to be used. If the file is sent as is to the controller, the connected gripper will open and close based on lines 2364 and 2366, assuming the gripper is already activated.
Simply insert an “#” sign in front of the function you want to be ignored and remove the “#” sign in front of the functions you want to be executed.
The file can then be sent to the controller and be executed. To do so, we’ll use python program which can be downloaded here. In the compressed file, you’ll also find a small python program called socket UR send file.py used to send the gripper.script file to the UR controller through port 30002. You’ll need to change the IP address of the robot in the socket UR send file.py to match your robot IP address.
Be sure to have both the socket UR send file.py and gripper.script file in the same folder and execute socket UR send file.py. The action(s) enabled in the gripper.script file will then be executed.