RoboDK Forum
UR5e - Realtime monitoring physical Input/Output- Printable Version

+- RoboDK Forum (//www.sinclairbody.com/forum)
+-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN)
+--- Forum: RoboDK API (//www.sinclairbody.com/forum/Forum-RoboDK-API)
+--- Thread: UR5e - Realtime monitoring physical Input/Output (/Thread-UR5e-Realtime-monitoring-physical-Input-Output)



UR5e - Realtime monitoring physical Input/Output-hieuvoquoc-09-10-2021

Hi RoboDK,

Currently I want to monitor the input/output status of UR5e robot in real time through RobotDK. Is there any way to do this?
I see in the library there is python codeUR_Monitoring_CSV.pywhich mentions this but I don't see the value change when I change the input/output value on UR5e.

Please advise, thank you so much!

Code:
UR_GET_INPUTS = (86-32)*8 + 252
UR_GET_OUTPUTS = (131-32)*8 + 252

def on_packet(packet, packet_id):

global ROBOT_JOINTS
# Retrieve desired information from a packet
rob_joints_RAD = packet_value(packet, UR_GET_JOINT_POSITIONS)
ROBOT_JOINTS = [ji * 180.0/pi for ji in rob_joints_RAD]
ROBOT_TCP_XYZUVW = packet_value(packet, UR_GET_TCP_POSITION)
ROBOT_TCP_SPEED = packet_value(packet, UR_GET_TCP_SPEED)
ROBOT_INPUTS = packet_value_bin(packet, UR_GET_INPUTS)
ROBOT_OUTPUTS = packet_value_bin(packet, UR_GET_OUTPUTS)
#print("Output:")
#print(ROBOT_OUTPUTS)

#ROBOT_SPEED = packet_value(packet, UR_GET_JOINT_SPEEDS)
#ROBOT_CURRENT = packet_value(packet, UR_GET_JOINT_CURRENTS)
#print(ROBOT_JOINTS)

# Monitor thread to retrieve information from the robot
def UR_Monitor():
while True:
print("Connecting to robot %s -> %s:%i" % (robotname, ROBOT_IP, ROBOT_PORT))
rt_socket = socket.create_connection((ROBOT_IP, ROBOT_PORT))
print("Connected")
buf = b''
packet_count = 0
packet_time_last = time.time()
while True:
more = rt_socket.recv(4096)
if more:
buf = buf + more
if packet_check(buf):
packet_len = packet_size(buf)
packet, buf = buf[:packet_len], buf[packet_len:]
on_packet(packet, packet_count)
packet_count += 1
if packet_count % 250 == 0:
t_now = time.time()
msg = "Monitoring %s at %.1f packets per second" % (robotname, packet_count/(t_now-packet_time_last))
print(msg)
RDK。ShowMessage(味精、假)
packet_count = 0
packet_time_last = t_now

rt_socket.close()



RE: UR5e - Realtime monitoring physical Input/Output-Albert-09-12-2021

This monitoring file and the mapping indexes (such as UR_GET_OUTPUTS) were developed for the UR series (not URe), it is likely that these mappings have changed.

Are you able to monitor robot joints properly?


RE: UR5e - Realtime monitoring physical Input/Output-hieuvoquoc-09-12-2021

Hi Albert,Albert
Just like you said, changed the mapping.
I updated the mapping again and it worked great.
Thank you for your advice.

The mapping change as attachment (V5.8) for those who are having problems like this.

Hieu,


RE: UR5e - Realtime monitoring physical Input/Output-Albert-09-13-2021

Excellent! Thank you for letting us know.