#!/usr/bin/env python2.7 # -*- coding: utf-8 -*- import rospy import time from common_msgs.msg import alarminfo def talker(): rospy.init_node('NetWorking', anonymous=True) networking_monitor = rospy.Publisher('bp_alarm',alarminfo, queue_size=10) rospy.Rate(10) # 10hz info = alarminfo() info.code = '20004' info.level = 1 info.msg = "The robot attitude abnormal" time.sleep(3.5) networking_monitor.publish(info) time.sleep(3.5) rospy.signal_shutdown("closed!") if __name__ == '__main__': try: talker() except rospy.ROSInterruptException: pass