# Python-urx- Help controlling robot iq 2 finger gripper

**URL:** <https://forum.universal-robots.com/t/python-urx-help-controlling-robot-iq-2-finger-gripper/36786>\
**Category:** Robot Communication\
**Created:** [October 31, 2024, 4:19pm UTC](https://forum.universal-robots.com/t/python-urx-help-controlling-robot-iq-2-finger-gripper/36786 "2024-10-31T16:19:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![paul.varkey](https://avatars.discourse-cdn.com/v4/letter/p/eb8c5e/32.png) [@paul.varkey](https://forum.universal-robots.com/u/paul.varkey)\
**Post date:** [October 31, 2024, 4:19pm UTC](https://forum.universal-robots.com/t/python-urx-help-controlling-robot-iq-2-finger-gripper/36786/1 "2024-10-31T16:19:28Z")

</div>

Hi, I have a ur5e on polyscope 5.17 connected to a robotiq 2F gripper. I am trying to control this entire robot in python using [GitHub - SintefManufacturing/python-urx: Python library to control a robot from 'Universal Robots' http://www.universal-robots.com/](https://github.com/SintefManufacturing/python-urx) . The controller is my pc and it is linked up via an ethernet cable. However, I have been really struggling to get the gripper to work. It is linked up fine and works fine in manual mode but not been able to control it with the code as shown below,

robot = urx.Robot(" ip adress of robot")  
gripper = Robotiq\_Two\_Finger\_Gripper(robot)  
position = robot.get\_pose()  
position.pos.z += 0.1  
robot.movel(position, acc=0.5, vel=0.2, wait=True)  
gripper.close\_gripper

can anyone help?

---

<div class="post-metadata">

**Author:** ![juan.rubio](https://avatars.discourse-cdn.com/v4/letter/j/c68b51/32.png) [@juan.rubio](https://forum.universal-robots.com/u/juan.rubio)\
**Post date:** [November 8, 2024, 1:09pm UTC](https://forum.universal-robots.com/t/python-urx-help-controlling-robot-iq-2-finger-gripper/36786/2 "2024-11-08T13:09:27Z")

</div>

Hello

I control the robotiq 2F gripper with python through the USB port of the PC, which is where I connect the gripper.  
The library I use is the one in the following code:

#from pyRobotiqGripper import RobotiqGripper as gripper

import pyRobotiqGripper

import time

gripper = pyRobotiqGripper.RobotiqGripper()

gripper.activate()

time.sleep (0.2)

gripper.close()

time.sleep (0.25)

gripper.open()

time.sleep (0.22)

gripper.goTo(150)

time.sleep (0.2)

gripper.goTo(100)

time.sleep (0.2)

gripper.goTo(50)

position\_in\_bit = gripper.getPosition()

print(position\_in\_bit)

gripper.printInfo()
