Hello,
I want to get the alarms/logs from the UR robot, to have something similar to the log_history.txt, but in real time. In the RTDE communication I haven’t found something related to this events, so I have started using 30001 port. My version is URSoftware 5.11.1.108318.
In some other posts, I have read that the interesting subpackages of this communication are SafetyModeMessage (subpackage = 5, RobotCommMessage (subpackage = 6) and RuntimeExceptionMessage (subpackage = 10) from Robot Message (message_type = 20).
I am trying to decode this messages, but I don’t get to decode correctly. These are some examples about what I am receiving in message_type = 20:
I am using this Python code sample:
#!/usr/bin/env python
# encoding: utf=8
""" 
#UR Controller Client Interface Datastream Reader
# For software version 3.x
#
# Datastream info found here: https://s3-eu-west-1.amazonaws.com/ur-support-site/16496/Client_Interface.xlsx
# Struct library used to extract data, info found here: https://docs.python.org/2/library/struct.html
"""
import socket, struct
def main():
	#Establish connection to controller
	HOST = '192.168.1.10'
	PORT = 30001
	s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
	s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
	s.connect((HOST, PORT))
	while 1:
		#Loop forever, receive 4096 bytes of data (enough to store any packet)
		data = s.recv(4096)
		#initialise i to keep track of position in packet
		i = 0
		if data:
			#Print title to screen
			#extract packet length, timestamp and packet type from start of packet and print to screen
			packlen =  (struct.unpack('!i', data[0:4]))[0]
			print 'packet length: ' + str(packlen)
			packtype = (struct.unpack('!b', data[4]))[0]
			print 'packet type: ' + str(packtype)
			if packlen < 20:
				continue
			timestamp = (struct.unpack('!Q', data[10:18]))[0]
			print 'timestamp: ' + str(timestamp)
			if packtype == 20:
				print(data)
if    __name__ == '__main__':
	import sys
	main()
Can someone help me?
Thanks!





