Last active
December 6, 2021 08:04
-
-
Save Kanazawanaoaki/6c2f8af99d7290f2b412ae6f57d2f01c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python diagnos_ether_listener.py | |
EtherCAT Master Dropped Packets: 167983 | |
EtherCAT Master RX Late Packet: 4 | |
EtherCAT Device (br_caster_r_wheel_motor)Drops: 0 | |
EtherCAT Device (br_caster_l_wheel_motor)Drops: 0 | |
EtherCAT Device (br_caster_rotation_motor)Drops: 0 | |
EtherCAT Device (fl_caster_r_wheel_motor)Drops: 0 | |
EtherCAT Device (fl_caster_l_wheel_motor)Drops: 0 | |
EtherCAT Device (fl_caster_rotation_motor)Drops: 0 | |
EtherCAT Device (bl_caster_r_wheel_motor)Drops: 0 | |
EtherCAT Device (bl_caster_l_wheel_motor)Drops: 7215 | |
EtherCAT Device (bl_caster_rotation_motor)Drops: 7215 | |
EtherCAT Device (fr_caster_r_wheel_motor)Drops: 0 | |
EtherCAT Device (fr_caster_l_wheel_motor)Drops: 0 | |
EtherCAT Device (fr_caster_rotation_motor)Drops: 0 | |
EtherCAT Device (torso_lift_motor)Drops: 0 | |
EtherCAT Device (l_shoulder_pan_motor)Drops: 0 | |
EtherCAT Device (l_shoulder_lift_motor)Drops: 0 | |
EtherCAT Device (l_upper_arm_roll_motor)Drops: 0 | |
EtherCAT Device (l_elbow_flex_motor)Drops: 0 | |
EtherCAT Device (l_forearm_roll_motor)Drops: 0 | |
EtherCAT Device (l_wrist_l_motor)Drops: 0 | |
EtherCAT Device (l_wrist_r_motor)Drops: 0 | |
EtherCAT Device (l_gripper_motor)Drops: 0 | |
EtherCAT Device (head_pan_motor)Drops: 0 | |
EtherCAT Device (r_shoulder_pan_motor)Drops: 0 | |
EtherCAT Device (r_shoulder_lift_motor)Drops: 0 | |
EtherCAT Device (r_upper_arm_roll_motor)Drops: 0 | |
EtherCAT Device (r_elbow_flex_motor)Drops: 0 | |
EtherCAT Device (r_forearm_roll_motor)Drops: 0 | |
EtherCAT Device (r_wrist_l_motor)Drops: 0 | |
EtherCAT Device (r_wrist_r_motor)Drops: 0 | |
EtherCAT Device (r_gripper_motor)Drops: 0 | |
EtherCAT Device (head_tilt_motor)Drops: 0 | |
EtherCAT Device (laser_tilt_mount_motor)Drops: 0 | |
-------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import rospy | |
from diagnostic_msgs.msg import DiagnosticArray | |
hoge = None | |
def callback(data): | |
global hoge | |
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) | |
rospy.Subscriber('/diagnostics', DiagnosticArray, callback) | |
rospy.spin() | |
if __name__ == '__main__': | |
listener() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment