Skip to content

Commit

Permalink
added publisher
Browse files Browse the repository at this point in the history
  • Loading branch information
TiaSinghania committed Oct 22, 2024
1 parent 79879a8 commit 1043ab8
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions rb_ws/src/buggy/scripts/simulator/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,31 @@
import sys
import time
import rclpy
from rclpy.node import Node
from std_msgs.msg import String

class Simulator(Node):
class Simulator():
# simulator constants:

def __init__(self):
self.test_publisher = self.create_publisher(String, 'test', 10)
if (self.get_namespace() == "SC"):
self.buggy_name = "SC"

if (self.get_namespace() == "NAND"):
self.buggy_name = "NAND"

if __name__ == "__main__":
rclpy.init()
sim = Simulator()
rclpy.spin(sim)
def loop(self):
print("hello")
self.test_publisher.publish(self.buggy_name)

if __name__ == "__main__":
rclpy.init()
sim = Simulator()

# publish initial position, then sleep
# so that auton stack has time to initialize
# before buggy moves
time.sleep(15.0)
sim.loop()
# publish initial position, then sleep
# so that auton stack has time to initialize
# before buggy moves
time.sleep(15.0)
sim.loop()


0 comments on commit 1043ab8

Please sign in to comment.