Skip to content

Commit

Permalink
basic node setup
Browse files Browse the repository at this point in the history
  • Loading branch information
TiaSinghania committed Oct 21, 2024
1 parent 7ebbd5c commit 79879a8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rb_ws/src/buggy/launch/sim_2d_single.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<launch>
<node pkg="foxglove_bridge" exec="foxglove_bridge" name="foxglove" namespace="SC"/>
<node pkg="buggy" exec="hello_world" name="hello_world" namespace="SC"/>
<node pkg="buggy" exec="sim-single" name="SC-sim-single" namespace="SC"/>
<node pkg="buggy" exec="sim-single" name="NAND-sim-single" namespace="NAND"/>

<!-- <node name="foxglove" pkg="foxglove_bridge" type="foxglove_bridge" /> -->
<!-- <node name="hello_world" pkg="buggy" type="hello_world" /> -->
</launch>
27 changes: 27 additions & 0 deletions rb_ws/src/buggy/scripts/simulator/engine.py
Original file line number Diff line number Diff line change
@@ -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()


2 changes: 2 additions & 0 deletions rb_ws/src/buggy/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
entry_points={
'console_scripts': [
'hello_world = buggy.hello_world:main'
'sim-single = buggy.engine:main'

],
},
)

0 comments on commit 79879a8

Please sign in to comment.