Hello dear community. I have a problem and hope that you can help me:
I have created a robot program (.urp) on a UR5e, which starts a program for quality control of components. I would like to be able to start this test sequence later via a Python GUI. To do this, however, I need to be able to call the program via Python. The robot and the PC I am working on (Ubuntu 20.04, Python 3.8) are connected via Ethernet and the connection works. I verify this with a quick script that outputs the current joint positions:
import rtde_receive
rtde_r = rtde_receive.RTDEReceiveInterface("IP")
actual_q = rtde_r.getActualQ()
print(actual_q)
I have already tried several things with the RDTE library and have not yet managed to start the program remotely (via my PC) on the UR. I can only send individual commands via rdte_control (like moveJ, moveL, …).
Is there a possibility? Possibly without rtde?
I would be very happy about helpful answers!
Best regards
Leon
1 Like
Hello,
you can just use the Dashboard Server which is listening on port 29999
dashboard = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
dashboard.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
dashboard.connect((robot_ip, 29999))
def send_dashboard(command: str):
command += '\n'
dashboard.sendall(command.encode())
try:
re = dashboard.recv(4096).decode()
except Exception as e:
re = f'No Response {e}'
logging.debug(re)
return re
send_dashboard(f'load {program}') # to call program which must be in storage of the robot.
send_dashboard('get loaded program') # check which program is loaded.
send_dashboard('running') # check if program is running.
send_dashboard('play') # to start a program
send_dashboard('stop') # to stop the program
send_dashboard('pause') # to pause the program.
there many more commands.
You can also use my Robot Controller which can be downloaded on GitHub.
This will start a Robot Object which handle RTDE, Control, InterpreterMode and Dashboard.
GitHub
Hello Benjamin.
Thank you for your reply.
I tried to work with your robot controller. I just wanted to try the sampl.py and unfortunately that doesn’t work for me.
I get the following error:
Me:~/UR_Robot_Control$ python sample.py
/usr/lib/python3/dist-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (2.2.0) or chardet (3.0.4) does not match a supported version!
warnings.warn("urllib3 ({}) or chardet ({}) does not match a supported "
Traceback (last call):
File "sample.py", line 17, in <module>
info = rc.RTDE(robot_ip) # init Info Level connection to Robot
AttributeError: Module 'robot_control' has no attribute 'RTDE'
I am sorry. The sample.py ist outdated.
But in robot_controller.py at the end of file you can see how to use the system.
Let me know if I need to explain more detailed.
By end of this week I will also update the rtde lib. Because there is one issue that require non blocking scripts.