Home› Programming
Discussion
Back to discussions page
bcastets
Vacuum Beta tester Posts: 674 Expert
Control gripper via UR controller client interface |
1.5K views
|
Answered | |
/ Most recent by bcastets
in Programming
|
6 comments |

in Programming
Clients ask us form time to time how to control the gripper from a PC using UR controller client interface.
Here is an example of Python script made by my colleague to control the gripper remotely by the port 30002.
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 30003, 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.
If you look at the attached example where the python program sends a file called gripper.script, there is 650 line of function definitions to achieve a single activate and a move function of the gripper. These 650 includes all the gripper functions. At the end of the file, the desired commands are there.

The definition of gripper function is evolving with time. You can find the latest gripper function definition in the .script file save with your program on the controller. You can get it using UR backup magic file or using FTP.
For more information about client interface you can have a look to UR documentation:
https://www.universal-robots.com/how-tos-and-faqs/how-to/ur-how-tos/overview-of-client-interfaces-21744/
Here is an example of Python script made by my colleague to control the gripper remotely by the port 30002.
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 30003, 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.
If you look at the attached example where the python program sends a file called gripper.script, there is 650 line of function definitions to achieve a single activate and a move function of the gripper. These 650 includes all the gripper functions. At the end of the file, the desired commands are there.

The definition of gripper function is evolving with time. You can find the latest gripper function definition in the .script file save with your program on the controller. You can get it using UR backup magic file or using FTP.
For more information about client interface you can have a look to UR documentation:
https://www.universal-robots.com/how-tos-and-faqs/how-to/ur-how-tos/overview-of-client-interfaces-21744/
2/ You would also use robot modbus register. You can write in robot register the result of object detection and access this information from your PC.
It is exactly the same procedure.
A script with all functions and gripper commands is send through 30002 using a python program.
I attach the files to this post.
Vacuum actions are at the bottom of the file.
This will work only if the robot is in remote control mode.