heartbeat_responser.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 import rospy
00003 from jsk_network_tools.msg import Heartbeat, HeartbeatResponse
00004 
00005 class Responser():
00006     def __init__(self):
00007         rospy.init_node('heartbeat_responser')
00008         self.pub_response = rospy.Publisher("heartbeat/response", HeartbeatResponse)
00009         rospy.Subscriber("heartbeat/request", Heartbeat, self.callback)
00010         rospy.spin()
00011 
00012     def callback(self, heartbeat):
00013         res = HeartbeatResponse()
00014         res.header.stamp = rospy.Time.now()
00015         res.heartbeat = heartbeat
00016         self.pub_response.publish(res)
00017         rospy.loginfo("respond to msg published %s.%s" % (heartbeat.header.stamp.secs, heartbeat.header.stamp.nsecs))
00018 
00019 
00020 if __name__ == '__main__':
00021     Responser()


jsk_network_tools
Author(s): Yusuke Furuta
autogenerated on Sun Jan 25 2015 12:38:31