Urscript for onrobot is not work

hi everyone
recently I’m working on controling the robot via socket on remote mode, and I also need to control the VG10 and RG6 gripper. I use the urscript commands to control the robot, it worked very well.(like movel(), movej()). However, when I try to control the VG10 or RG6 gripper, it just have response!
The urscripts are from the official document of the VG10 and RG6, and the commands are:
1): rg_grip(rg_width, force, tool_index=0, blocking=True,
depth_compensation=False, popupmsg=True)
2) VG10_grip (channel, vacuum, timeout, alert)
Is there anyone meet the same problem?
Im very appreciate it if anyone give me a guidance.
Thanks!

The commands for the gripper (like rg_grip) are not saved on the robot itself.
They are saved in the beginning of each robot program.
If you open the script file of a robot program (access it via ftp) that has a gripper command you will see a large section that implements the gripping functions.
If you send a program without this “boilerplate” code your calls to these functions cause errors.

What you need to do is send the boilerplate code as well.
You can see the solution for the onrobot rg2 grippers in this thread, however you will most likely need to adjust them for the RG6
gripper.

If you can send me the .script file of a program with gripper commands from the pendant I can tell you which parts of the code you need to extract and send with the rest of your program.

Hi there, thank you very much for your reply!
I’m sorry, I’m just a biginner.
Is the .script file of a program with gripper commands from the pendant means I need to creat a program in the pendant which just contain the gripper’s action? if it’s right, please check the file I uploaded. Thanks!

And I have runned your example code but I meet an error, here is:

Traceback (most recent call last):
File “/home/yu/control_robot/RTDE/rg2.py”, line 1, in
import urx
File “/home/yu/anaconda3/envs/urworks/lib/python3.8/site-packages/urx/init.py”, line 4, in
from urx.urrobot import RobotException, URRobot # noqa
File “/home/yu/anaconda3/envs/urworks/lib/python3.8/site-packages/urx/urrobot.py”, line 9, in
from urx import urrtmon
File “/home/yu/anaconda3/envs/urworks/lib/python3.8/site-packages/urx/urrtmon.py”, line 16, in
import math3d as m3d
File “/home/yu/anaconda3/envs/urworks/lib/python3.8/site-packages/math3d/init.py”, line 21, in
from .transform import Transform, PoseVector
File “/home/yu/anaconda3/envs/urworks/lib/python3.8/site-packages/math3d/transform.py”, line 156, in
class Transform(object):
File “/home/yu/anaconda3/envs/urworks/lib/python3.8/site-packages/math3d/transform.py”, line 528, in Transform
ApTs: typing.Union[np.ndarray, tuple[PositionVector]],
TypeError: ‘type’ object is not subscriptable

I just copied your code and didn’t change anything. So do you know how to solve this error?

Thank you very much! Have a nice day!
vg10.script (47.3 KB)

rg6.script (49.7 KB)