From 7d27ff3ebae22d9a61859f262b83b99a4b56457a Mon Sep 17 00:00:00 2001 From: Christopher Herr Date: Mon, 8 May 2023 19:50:06 +0200 Subject: [PATCH] Update 'src/pubsub/pubsub/pubsub_library_v4.py' Added the possibility to input a certain amount of allowed overflows until watchdog is triggered and reset overflow to false every time its called to reevaluate. --- src/pubsub/pubsub/pubsub_library_v4.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pubsub/pubsub/pubsub_library_v4.py b/src/pubsub/pubsub/pubsub_library_v4.py index f7b32e0..85a61cf 100644 --- a/src/pubsub/pubsub/pubsub_library_v4.py +++ b/src/pubsub/pubsub/pubsub_library_v4.py @@ -123,15 +123,16 @@ class MinimalSubscriber(Node): def return_msg(self): return self.msg - def timer_overflow(self, time_limit=0): + def timer_overflow(self, time_limit=0, numer_of_timer_overflows=10): """Watchdog for Topic Publisher Messages\n ture = timer_overflow >> error false = no timer_overflow >> no error""" + self.overflow = False if time_limit > 0: if time.time() > self.last_msg_time + time_limit: self.watchdog += 1 self.get_logger().warn(f"Message-Watchdog triggered {self.watchdog} times") - if self.watchdog > 10: + if self.watchdog > numer_of_timer_overflows: self.overflow = True return self.overflow