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

我的手臂是UR5+CB。
我想要利用網路練連上手臂後利用python檔連接手臂並執行命令。
我有查看Remote operation of robots
但需要的是更基礎的code,然後再自行研究。

Hi,

Here are some examples in the article: Guide and example: UR Remote Control via TCPIP

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()