Skip to content

Commit

Permalink
added subscriber and fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mehulgoel873 committed Oct 24, 2024
1 parent f009cce commit 98e5912
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
15 changes: 12 additions & 3 deletions rb_ws/src/buggy/buggy/watchdog/watchdog_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down
4 changes: 2 additions & 2 deletions rb_ws/src/buggy/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -28,4 +28,4 @@
'watchdog = buggy.watchdog.watchdog_node:main'
],
},
)
)

0 comments on commit 98e5912

Please sign in to comment.