3 from jsk_network_tools.msg
import Heartbeat, HeartbeatResponse
7 rospy.init_node(
'heartbeat_responser')
8 self.
pub_response = rospy.Publisher(
"heartbeat/response", HeartbeatResponse)
9 rospy.Subscriber(
"heartbeat/request", Heartbeat, self.
callback)
13 res = HeartbeatResponse()
14 res.header.stamp = rospy.Time.now()
15 res.heartbeat = heartbeat
16 self.pub_response.publish(res)
17 rospy.loginfo(
"respond to msg published %s.%s" % (heartbeat.header.stamp.secs, heartbeat.header.stamp.nsecs))
20 if __name__ ==
'__main__':
def callback(self, heartbeat)