Discussion
How to control Robotiq product through port 30002 on universal robot. |
2.6K views
|
Answered | |
/ Most recent by FarahKamal
in General
|
15 comments |

Hello everyone,
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.
Enjoy!
Integration Coach
Integration Coach
Did you verify that the robot is accessible on the network? Try to ping the IP address to be sure you can communicate with the robot.
Also be sure that if you are on e-series, the remote mode is enabled, otherwise, it won't allow the script to be executed on the robot.
Best regards
Integration Coach
def Gripper():
can I use this script to controll the gripper at the same time as using the ur_robot_driver, which controlls the arm?
If I try it my way with the headless mode of the ur_robot_driver package, my ur_robot_driver loses connection.
Thanks!
Sorry, I have no idea. I haven't have the chance to play with it yet.
Regards
Integration Coach
then communicating with the gripper via a socket (127.0.0.1:63352). The scope
of the socket is at the program level."""
I am currently testing with your .script file and it is wonderful. But I am wonder can you explain or help me understand how to use the rq_is_object_detected() function. The reason is that I am trying to find a way to detect is there an object or not on the gripper via Python code. I can see that in the .script file this function will return a value but I do not know how to access the returned value.
And also may I ask what language is the .script file ? or maybe where did you learn to do use that to access to the gripper ? as I have tried to look for it for weeks now but no results return :<
Thank you!
Bob
The .script file is Universal Robot programming code.
I am not sure you can retreive the resultat of rq_is_object_detected() via the client interface.
Maybe you can send a script via client interface which send the result of rq_is_object_detected() via a socket ?
You could also make a script which save the result of rq_is_object_detected() in robot modbus register and then access robot modbus register via python.
his has made my entire program unusable so far, as the gripper has dropped valuable things on the floor for no apparent reason. Anyone else experience this? I have also experienced my robot crashing after sending a gripper command, where it will say 'no controller found'.
I think it may be elated to the processing speed of the robot.
If you send 100 actions to the robot, the robot have to receive those 100 actions. If they are send too quickly one after the other or if an action is requested while the last action is still on going this may lead to some interruption.
Maybe you could have the robot send some feedback to you when the action is complete before you send the next one.
You could send the script to open the gripper and at the end of it send a message back to your PC via a socket.
Yes, unfortunately the whole file has to be sent.
The reason is that even if the URCap is installed, these functions are unknown to the robot as they are loaded at the beginning of every program. So you need to send the whole file so the robot know what to do with theses commands. Otherwise it would receives commands but have no instruction on how to use them
Best regards
Integration Coach
since the primary interface sends the response in a form of a byte array with fixed size and types(clarified in photo attached) and there is no information about decoding the tool's state in the Primary Client Interface manual.