From 79879a8d696c7143b78cda12e106659c8829418e Mon Sep 17 00:00:00 2001 From: TiaSinghania Date: Mon, 21 Oct 2024 15:37:39 -0400 Subject: [PATCH] basic node setup --- rb_ws/src/buggy/launch/sim_2d_single.xml | 3 +++ rb_ws/src/buggy/scripts/simulator/engine.py | 27 +++++++++++++++++++++ rb_ws/src/buggy/setup.py | 2 ++ 3 files changed, 32 insertions(+) create mode 100644 rb_ws/src/buggy/scripts/simulator/engine.py diff --git a/rb_ws/src/buggy/launch/sim_2d_single.xml b/rb_ws/src/buggy/launch/sim_2d_single.xml index e0b5846..0aed958 100755 --- a/rb_ws/src/buggy/launch/sim_2d_single.xml +++ b/rb_ws/src/buggy/launch/sim_2d_single.xml @@ -1,6 +1,9 @@ + + + \ No newline at end of file diff --git a/rb_ws/src/buggy/scripts/simulator/engine.py b/rb_ws/src/buggy/scripts/simulator/engine.py new file mode 100644 index 0000000..f91efda --- /dev/null +++ b/rb_ws/src/buggy/scripts/simulator/engine.py @@ -0,0 +1,27 @@ +#! /usr/bin/env python3 +import sys +import time +import rclpy +from rclpy.node import Node + +class Simulator(Node): + # simulator constants: + + def __init__(self): + 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) + + # publish initial position, then sleep + # so that auton stack has time to initialize + # before buggy moves + time.sleep(15.0) + sim.loop() + + diff --git a/rb_ws/src/buggy/setup.py b/rb_ws/src/buggy/setup.py index 4373639..b8edf92 100644 --- a/rb_ws/src/buggy/setup.py +++ b/rb_ws/src/buggy/setup.py @@ -25,6 +25,8 @@ entry_points={ 'console_scripts': [ 'hello_world = buggy.hello_world:main' + 'sim-single = buggy.engine:main' + ], }, )