diff --git a/rb_ws/src/buggy/buggy/watchdog/watchdog_node.py b/rb_ws/src/buggy/buggy/watchdog/watchdog_node.py index 2e536cb..6f238da 100644 --- a/rb_ws/src/buggy/buggy/watchdog/watchdog_node.py +++ b/rb_ws/src/buggy/buggy/watchdog/watchdog_node.py @@ -25,18 +25,27 @@ def loop(self): msg.data = True self.heartbeat_publisher.publish(msg) + def heartbeat_listener(self, msg : Node): + """ + Subscriber Function that checks if Heartbeat is ever alse + It never actually is false, this is just a demonstration of a subscriber + If it ever actually is false, something cursed has happened + """ + if msg.data == False: + self.get_logger().error("Hearbeat Failed!") + def main(args=None): rclpy.init(args=args) - minimal_publisher = Watchdog() + watchdog = Watchdog() - rclpy.spin(minimal_publisher) + rclpy.spin(watchdog) # Destroy the node explicitly # (optional - otherwise it will be done automatically # when the garbage collector destroys the node object) - minimal_publisher.destroy_node() + watchdog.destroy_node() rclpy.shutdown() diff --git a/rb_ws/src/buggy/setup.py b/rb_ws/src/buggy/setup.py index 5ecef4e..0a9e40b 100644 --- a/rb_ws/src/buggy/setup.py +++ b/rb_ws/src/buggy/setup.py @@ -13,7 +13,7 @@ ('share/ament_index/resource_index/packages', ['resource/' + package_name]), ('share/' + package_name, ['package.xml']), - (os.path.join("share", package_name), glob("launch/*.xml")), + (os.path.join("share", package_name), glob("launch/*.xml")) ], install_requires=['setuptools'], zip_safe=True, @@ -28,4 +28,4 @@ 'watchdog = buggy.watchdog.watchdog_node:main' ], }, -) +) \ No newline at end of file