Home› Programming
Discussion
Back to discussions page
RoboticsUser
Unconfirmed Posts: 3 Apprentice
Connect I/0 UR5e with Python via Socket |
607 views
|
Answered | |
/ Most recent by RoboticsUser
in Programming
|
3 comments |

in Programming
Hi all,
I've been looking on the posts how to change Output Signals of a UR5e via Socket and a pyhton script on the PC. I found the following solution:
I've been looking on the posts how to change Output Signals of a UR5e via Socket and a pyhton script on the PC. I found the following solution:
import socket
HOST = "15.83.19.20"
PORT2 = 30002
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s2:
s2.connect((HOST,PORT2))
cmd = "set_digital_out(1,True)"
s2.send(cmd.encode('utf-8'))
data2 = s2.recv(1024)
s2.close()
print("Recived ", repr(data2))
I don't know if I am doing something wrong but in I can't see the digital output change. I've been trying several modifications and I know that I can recive data from the robot because I tried to see the Hand-E finger position and the value changed in real time.
I would appreciate some help to soleve my problem.
Thanks in advance.
I don't know if I am doing something wrong but in I can't see the digital output change. I've been trying several modifications and I know that I can recive data from the robot because I tried to see the Hand-E finger position and the value changed in real time.
I would appreciate some help to soleve my problem.
Thanks in advance.
I've found another way to control the output signals of the UR5e that is teh following:
rtde_io_.setStandardDigitalOut(7, True)
Using thiese package I can read and write the signals but only in Remote Mode, not in Local Mode. There is another way to do it?
Thanks
Thanks for the comment. I read on the Universal Robots site these comment: "In e-Series, there are remote and local modes. When the robot is in the local mode, it is not allowed to receive URScript commands and the connection to the ports 30001, 30002, and 30003 will be lost. If you need to monitor the robot state both in remote and local modes, you should use the ports 30004, 30011, 30012, and 30013.". I understand that using the port 30004, the RTDE, I would be possible to read the variables and the Ouputs signals.
I've tried the same script as my first comment, changing the Port to 30004 but I still have no data recived.
Thanks