Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

UR5e - Realtime monitoring physical Input/Output

#1
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 code UR_Monitoring_CSV.py which 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(msg, False)
                       packet_count = 0
                       packet_time_last = t_now
                       
       rt_socket.close()


Attached Files Thumbnail(s)
       
#2
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?
#3
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,


Attached Files
.pdf   Client_Interface_V5.8.pdf (Size: 157.21 KB / Downloads: 763)
#4
Excellent! Thank you for letting us know.
  




Users browsing this thread:
1 Guest(s)