# 如何寫程式利用電腦連線並操作手臂

**URL:** <https://forum.universal-robots.com/t/topic/33462>\
**Category:** 其他\
**Created:** [March 28, 2024, 6:17am UTC](https://forum.universal-robots.com/t/topic/33462 "2024-03-28T06:17:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![LSH923](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/lsh923/32/5873_2.png) [@LSH923](https://forum.universal-robots.com/u/LSH923)\
**Post date:** [March 28, 2024, 6:17am UTC](https://forum.universal-robots.com/t/topic/33462/1 "2024-03-28T06:17:25Z")

</div>

我的手臂是UR5+CB。  
我想要利用網路練連上手臂後利用python檔連接手臂並執行命令。  
我有查看[Remote operation of robots](https://www.universal-robots.com/articles/ur/interface-communication/remote-operation-of-robots/)  
但需要的是更基礎的code，然後再自行研究。

---

<div class="post-metadata">

**Author:** ![tizh](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/tizh/32/4176_2.png) [@tizh](https://forum.universal-robots.com/u/tizh)\
**Post date:** [April 1, 2024, 2:44am UTC](https://forum.universal-robots.com/t/topic/33462/2 "2024-04-01T02:44:25Z")

</div>

Hi,

Here are some examples in the article: [Guide and example: UR Remote Control via TCPIP](https://forum.universal-robots.com/t/guide-and-example-ur-remote-control-via-tcpip/32973)

for example, use python:

import socket

mySocket = socket.socket(socket.AF\_INET, socket.SOCK\_STREAM)  
#change the robot IP address here  
host = ‘192.168.56.103’  
port = 30001

mySocket.connect((host, port))

script\_text=“def test\_move():\n”   
" global P\_start\_p=p[.6206, -.1497, .2609, 2.2919, -2.1463, -.0555]\n"   
" global P\_mid\_p=p[.6206, -.1497, .3721, 2.2919, -2.1463, -.0555]\n"   
" global P\_end\_p=p[.6206, -.1497, .4658, 2.2919, -2.1463, -.0555]\n"   
" while (True):\n"   
" movel(P\_start\_p, a=1.2, v=0.25)\n"   
" movel(P\_mid\_p, a=1.2, v=0.25)\n"   
" movel(P\_end\_p, a=1.2, v=0.25)\n"   
" end\n"   
“end\n”

mySocket.send((script\_text + “\n”).encode())  
mySocket.close()

---

<div class="post-metadata">

**Author:** ![LSH923](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/lsh923/32/5873_2.png) [@LSH923](https://forum.universal-robots.com/u/LSH923)\
**Post date:** [May 15, 2024, 6:08am UTC](https://forum.universal-robots.com/t/topic/33462/3 "2024-05-15T06:08:22Z")

</div>

我可以問一下p中的六個數值，對要的位置是哪裡？分別的單位又是？
