Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add diagnostics_ethercat_summarizer.py for packet drop confirmation #1417

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env python

import rospy
from diagnostic_msgs.msg import DiagnosticArray

Kanazawanaoaki marked this conversation as resolved.
Show resolved Hide resolved
def callback(data):
flag = False
for e in data.status:
#EtherCAT Device
for v in e.values:
if v.key =='Drops':
flag = True
print(e.name + "Drops: {}".format(v.value))
#EtherCAT Master
if e.name == 'EtherCAT Master':
for v in e.values:
if v.key =='Dropped Packets':
print(e.name + " Dropped Packets: {}".format(v.value))
if v.key =='RX Late Packet':
print(e.name + " RX Late Packet: {}".format(v.value))

if flag:
print("--------------------------------------------")


def listener():
rospy.init_node('diagnostics_listener', anonymous=True)
Kanazawanaoaki marked this conversation as resolved.
Show resolved Hide resolved
rospy.Subscriber('/diagnostics', DiagnosticArray, callback)
rospy.spin()

if __name__ == '__main__':
listener()