def __init__(self, timeout=2.0): self.timeout = rospy.Duration(timeout) self.last_time = rospy.Time.now() self.last_msg = '' self.sub = rospy.Subscriber('/keep_alive', String, self.got_network_msg, queue_size=1) self.alarm_broadcaster, self.alarm = single_alarm('kill', severity=3, problem_description="Network loss") rospy.Timer(rospy.Duration(0.1), self.check)
def __init__(self, timeout=5.0): self.timeout = rospy.Duration(timeout) self.last_time = rospy.Time.now() self.sub = rospy.Subscriber('/keep_alive', String, self.got_keepalive, queue_size=1) self.alarm_broadcaster, self.alarm = single_alarm('network-timeout', severity=1) rospy.Timer(rospy.Duration(0.01), self.check)