# UR+Robotiq Screwdrivering solution

**URL:** <https://forum.universal-robots.com/t/ur-robotiq-screwdrivering-solution/38495>\
**Category:** Technical Questions\
**Created:** [February 11, 2025, 5:44am UTC](https://forum.universal-robots.com/t/ur-robotiq-screwdrivering-solution/38495 "2025-02-11T05:44:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![1439626874](https://avatars.discourse-cdn.com/v4/letter/1/67e7ee/32.png) [@1439626874](https://forum.universal-robots.com/u/1439626874)\
**Post date:** [February 11, 2025, 5:44am UTC](https://forum.universal-robots.com/t/ur-robotiq-screwdrivering-solution/38495/1 "2025-02-11T05:44:40Z")

</div>

Hello, I am trying to control the screwdriver rotation in the UR+Robotiq Screwdrivering solution by sending scripts from my computer to the robot. This works on the teach pendant, but the program does not execute the rotation as expected. What could be the reason for this?

```auto
import socket

def RobotInterface(command: str):
    # initialize variables
    robotIP = "192.168.1.10"
    PORT = 30002
    # create socket
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect((robotIP, PORT)) # connect to UR port 30001
    s.send(command.encode()) # encode data and send through socket
    s.close() # close the socket
    print("Script Command Complete")

moves = ['def moves():',
         'set_digital_out(2,True)',
         # 'movel(pose_add(get_actual_tcp_pose(),p[0,0,-0.1,0,0,0]))',
         'rq_screw_activate()',
         'rq_screw_turn(3,1,0,100,False,9)',
         'set_digital_out(2,False)',
         'end']

cmd = ''
for line in moves:
    cmd += line + '\n'

RobotInterface(cmd)

```

 ![image](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/4/45f8a0ff77c6dcbfe44c4b12347654282fae1756.jpeg) ![image](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/2/2c31b59ae44350aeb0b86fc63fa06d5bef429bf1.png)

---

<div class="post-metadata">

**Author:** ![cg1](https://avatars.discourse-cdn.com/v4/letter/c/c77e96/32.png) [@cg1](https://forum.universal-robots.com/u/cg1)\
**Post date:** [February 11, 2025, 5:53pm UTC](https://forum.universal-robots.com/t/ur-robotiq-screwdrivering-solution/38495/2 "2025-02-11T17:53:34Z")

</div>

Answer a very similar question the other day.

> [@Unknown Function: findmodel](https://forum.universal-robots.com/t/unknown-function-findmodel/38297/4):
>
> Yeah that properly why then. one of the things a URCap does is basically to define a bunch of functions in the top of any script file created through the teach pendant to give you new functionality. while I have never used Robotiq I bet you will find the findmodel function you are looking here. But this also means that you cant just use external programs like what you are doing now, and as the guy in the post did. As these functions simply is not defined in the script file you create on you …

And your problem looks exactly the same.

By the way I do think you should switch to the primary interface instead of the secondary one  
[https://www.universal-robots.com/articles/ur/interface-communication/overview-of-client-interfaces/](https://www.universal-robots.com/articles/ur/interface-communication/overview-of-client-interfaces/)

Kind Regards
