# URScript control of Onrobot RG2 Robot Gripper

**URL:** <https://forum.universal-robots.com/t/urscript-control-of-onrobot-rg2-robot-gripper/8498>\
**Category:** URScript\
**Created:** [August 18, 2020, 1:09pm UTC](https://forum.universal-robots.com/t/urscript-control-of-onrobot-rg2-robot-gripper/8498 "2020-08-18T13:09:03Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon59108369](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@anon59108369](https://forum.universal-robots.com/u/anon59108369)\
**Post date:** [August 18, 2020, 1:09pm UTC](https://forum.universal-robots.com/t/urscript-control-of-onrobot-rg2-robot-gripper/8498/1 "2020-08-18T13:09:04Z")

</div>

Hi everyone,  
Does anyone have some discovered resources, or maybe someone wrote a code to communicate with the Onrobot RG2 gripper for the UR robot in real-time using RTDE?

---

<div class="post-metadata">

**Author:** ![Ebbe](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/ebbe/32/1413_2.png) [@Ebbe](https://forum.universal-robots.com/u/Ebbe)\
**Post date:** [August 21, 2020, 6:41am UTC](https://forum.universal-robots.com/t/urscript-control-of-onrobot-rg2-robot-gripper/8498/2 "2020-08-21T06:41:15Z")

</div>

Hi @anon59108369,

Your options are highly dependent if it is the first or second generation of the gripper. Maybe @asbjorn.oland, @marius.gheorghe or another OnRobot employee can assist you getting the information you need.

---

<div class="post-metadata">

**Author:** ![anon59108369](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@anon59108369](https://forum.universal-robots.com/u/anon59108369)\
**Post date:** [August 21, 2020, 7:19am UTC](https://forum.universal-robots.com/t/urscript-control-of-onrobot-rg2-robot-gripper/8498/3 "2020-08-21T07:19:09Z")

</div>

It would be great if someone with the experience in OnRobot could help out.  
The gripper: ([RG2 Gripper - Flexible 2 Finger Robot Gripper | OnRobot](https://onrobot.com/en/products/rg2-gripper)) called RG2 Onrobot gripper, is a newly ordered one, so I assume its a 2nd generation version, though no information can be seen in the manual I have recieved.

I have used the console to run the program and then analyzed the obtained script, attached below:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/d/d00c8d07e160f7759940103ab0c61ebe5de89efe.png)

I have tried using the Script command from the manual, to see if I can operate it in the low speeds (Not RTDE) but even that doesn’t seem to work.  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/8/8275009f28f14e75fbb24158de931d4a0bc4f45c.png)

After fixing the issue in slowly commanding the robot, I will try to do RTDE. Though any advice would be appriciated at this stage as well.  
Would appriciate any help on this topic. @asbjorn.oland, @marius.gheorghe

---

<div class="post-metadata">

**Author:** ![Ebbe](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/ebbe/32/1413_2.png) [@Ebbe](https://forum.universal-robots.com/u/Ebbe)\
**Post date:** [August 21, 2020, 12:05pm UTC](https://forum.universal-robots.com/t/urscript-control-of-onrobot-rg2-robot-gripper/8498/4 "2020-08-21T12:05:53Z")

</div>

Those functions are defined in the preamble by the OnRobot URCap. If you are going to use it from remote, you must copy those definitions.  
If you make a small program on the robot, you can take a look at the generated URScript for the program.

---

<div class="post-metadata">

**Author:** ![anon59108369](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@anon59108369](https://forum.universal-robots.com/u/anon59108369)\
**Post date:** [August 23, 2020, 12:09pm UTC](https://forum.universal-robots.com/t/urscript-control-of-onrobot-rg2-robot-gripper/8498/5 "2020-08-23T12:09:17Z")

</div>

I did copy those definitions and tried to use them, but they are not being run…  
This is the problem I am having, and I think its been a problem for all the OnRobot users for a while now from what I have seen on a few different forums.  
I was hoping it has been fixed

---

<div class="post-metadata">

**Author:** ![anon12747666](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@anon12747666](https://forum.universal-robots.com/u/anon12747666)\
**Post date:** [February 10, 2021, 6:50pm UTC](https://forum.universal-robots.com/t/urscript-control-of-onrobot-rg2-robot-gripper/8498/6 "2021-02-10T18:50:07Z")

</div>

Hi,  
Did you found a solution ?  
I have the same problem.

---

<div class="post-metadata">

**Author:** ![anon59108369](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@anon59108369](https://forum.universal-robots.com/u/anon59108369)\
**Post date:** [February 25, 2021, 10:39am UTC](https://forum.universal-robots.com/t/urscript-control-of-onrobot-rg2-robot-gripper/8498/7 "2021-02-25T10:39:51Z")

</div>

> [@OnRobot Gripper - SOLVED](https://forum.universal-robots.com/t/onrobot-gripper-solved/8784):
>
> Hi everyone, For a month or so I was trying to operate the OnRobot RG2 gripper using URScript via python. The issue I was faced with was that the command which is used to open/ close the gripper works only if it is sent from a primary program coded on the teaching pendant. It doesn’t work if sent via a TCP/IP connection between robot and PC. SOLUTION For those of you who want to operate remotely via PC only here is the solution that we found: Use WebLogic which is a platform provided with …

Thats my solution

---

<div class="post-metadata">

**Author:** ![ryan.mckenna](https://avatars.discourse-cdn.com/v4/letter/r/bc8723/32.png) [@ryan.mckenna](https://forum.universal-robots.com/u/ryan.mckenna)\
**Post date:** [November 24, 2023, 8:03pm UTC](https://forum.universal-robots.com/t/urscript-control-of-onrobot-rg2-robot-gripper/8498/8 "2023-11-24T20:03:07Z")

</div>

> [@anon59108369](#):
>
> ing the Script command from the manual, to see if I can operate it in the low speeds (Not RTDE) but even tha

Hi please can you provide a link to this documentation?

---

<div class="post-metadata">

**Author:** ![Roberto.Ancona](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/roberto.ancona/32/5620_2.png) [@Roberto.Ancona](https://forum.universal-robots.com/u/Roberto.Ancona)\
**Post date:** [November 26, 2023, 4:38pm UTC](https://forum.universal-robots.com/t/urscript-control-of-onrobot-rg2-robot-gripper/8498/9 "2023-11-26T16:38:00Z")

</div>

Hi @anon12747666,  
to control the OnRobot RG2 I use this simple script code:

 ![immagine](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/c/c65f46cf27db0ff690b010cb8b057245f1b00f78.png)

---

<div class="post-metadata">

**Author:** ![kacpern30](https://avatars.discourse-cdn.com/v4/letter/k/e480ec/32.png) [@kacpern30](https://forum.universal-robots.com/u/kacpern30)\
**Post date:** [December 1, 2023, 1:01pm UTC](https://forum.universal-robots.com/t/urscript-control-of-onrobot-rg2-robot-gripper/8498/10 "2023-12-01T13:01:13Z")

</div>

Hi, I succeded in operating RG2 gripper on ur3e from ROS2. Here is my solution:

> <https://github.com/Now4czyk/arws/blob/main/src/gripper_control/gripper_control/gripper_control_node.py>
