From b9c8231614f9f4153e7d00908260bf192c69b6c4 Mon Sep 17 00:00:00 2001 From: TiaSinghania Date: Tue, 22 Oct 2024 21:17:26 -0400 Subject: [PATCH] publish/subscriber base code --- rb_ws/src/buggy/buggy/simulator/engine.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/rb_ws/src/buggy/buggy/simulator/engine.py b/rb_ws/src/buggy/buggy/simulator/engine.py index 346ae3a..4873035 100644 --- a/rb_ws/src/buggy/buggy/simulator/engine.py +++ b/rb_ws/src/buggy/buggy/simulator/engine.py @@ -4,20 +4,17 @@ import rclpy from rclpy.node import Node -from std_msgs.msg import String, Float64 +from std_msgs.msg import Float64 class Simulator(Node): # simulator constants: def __init__(self): - super().__init__('SC_sim_single') - self.get_logger().info("INITIALIZING") + super().__init__('sim_single') self.number_publisher = self.create_publisher(Float64, 'numbers', 1) - self.test_publisher = self.create_publisher(String, 'test', 1) self.i = 0 self.buggy_name = "NONE" - if (self.get_namespace() == "/SC"): self.buggy_name = "SC" @@ -29,12 +26,6 @@ def __init__(self): self.timer = self.create_timer(timer_period, self.loop) def loop(self): - - self.get_logger().info("LOOPING") - - msg = String() - msg.data = self.buggy_name - self.test_publisher.publish(msg) msg2 = Float64() msg2.data = float(self.i) self.number_publisher.publish(msg2) @@ -43,7 +34,8 @@ def loop(self): def main(args=None): rclpy.init(args=args) sim = Simulator() - sim.get_logger().info("CREATED NODE") rclpy.spin(sim) + rclpy.shutdown() - +if __name__ == "__main__": + main() \ No newline at end of file