Home Programming


Left ArrowBack to discussions page
RoboticsUserRoboticsUser Unconfirmed Posts: 3 Apprentice
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:

import socket

HOST = ""
PORT2 = 30002

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s2:
    cmd = "set_digital_out(1,True)"
    data2 = s2.recv(1024)
    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.


  • RoboticsUserRoboticsUser Unconfirmed Posts: 3 Apprentice

    I've found another way to control the output signals of the UR5e that is teh following:

    from rtde_control import RTDEControlInterface as RTDEControl
    import rtde_receive
    import rtde_io

    rtde_control = RTDEControl("",RTDEControl.FLAG_NO_WAIT,30004)
    rtde_io_ = rtde_io.RTDEIOInterface("")
    rtde_r = rtde_receive.RTDEReceiveInterface("")

    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?

  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,249 Handy
    If you are working with an e-series robot the only way to do any control off of the controller is to be in remote mode, whether it’s RTDE or via secondary/primary programs over socket communication.
  • RoboticsUserRoboticsUser Unconfirmed Posts: 3 Apprentice
    Hi Matthew,

    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.

Sign In or Register to comment.
Left ArrowBack to discussions page