import rclpy
from rclpy.node import Node

class TopicLister(Node):
    def __init__(self):
        super().__init__('topic_lister')
        self.timer = self.create_timer(1.0, self.list_topics)

    def list_topics(self):
        topic_list = self.get_topic_names_and_types()
        self.get_logger().info("Available Topics:")
        for topic, msg_type in topic_list:
            self.get_logger().info(f"{topic}: {msg_type}")

def main():
    rclpy.init()
    node = TopicLister()
    rclpy.spin(node)
    node.destroy_node()
    rclpy.shutdown()

if __name__ == '__main__':
    main()
