Skip to content

Commit

Permalink
added velocity launch file and edited setup.py, launch file need to b…
Browse files Browse the repository at this point in the history
…e debug
  • Loading branch information
JoyceZhu2486 committed Nov 20, 2024
1 parent ca11c95 commit b0f8c26
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 17 deletions.
12 changes: 4 additions & 8 deletions rb_ws/src/buggy/buggy/simulator/velocity_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,11 @@ def main(args=None):
init_vel = float(sys.argv[1])
buggy_name = sys.argv[2]

vel_ui = VelocityUI(init_vel, buggy_name)
velocity_ui = VelocityUI(init_vel, buggy_name)

try:
rclpy.spin(vel_ui)
except KeyboardInterrupt:
print("Shutting down velocity UI")
finally:
vel_ui.destroy_node()
rclpy.shutdown()
rclpy.spin(velocity_ui)
velocity_ui.destroy_node()
rclpy.shutdown()

if __name__ == "__main__":
main()
14 changes: 5 additions & 9 deletions rb_ws/src/buggy/buggy/simulator/velocity_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class VelocityUpdater(Node):
# 'list[tuple[float,float,float,float]]'
# need further update such as more data or import data from certain files
CHECKPOINTS = [
(589701, 4477160, 20, 0.5)
(589701, 4477160, 20, 5)
]

def __init__(self, init_vel: float, buggy_name: str):
Expand Down Expand Up @@ -76,15 +76,11 @@ def main(args=None):
init_vel = float(sys.argv[1])
buggy_name = sys.argv[2]

vel_updater = VelocityUpdater(init_vel, buggy_name)
velocity_updater = VelocityUpdater(init_vel, buggy_name)

try:
rclpy.spin(vel_updater)
except KeyboardInterrupt:
print("Shutting down velocity updater")
finally:
vel_updater.destroy_node()
rclpy.shutdown()
rclpy.spin(velocity_updater)
velocity_updater.destroy_node()
rclpy.shutdown()

if __name__ == "__main__":
main()
26 changes: 26 additions & 0 deletions rb_ws/src/buggy/launch/sim_2d_single_velocity.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<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">
<param name="velocity" value="12"/>
<param name="pose" value="Hill1_SC"/>
</node>
<node pkg="buggy" exec="sim_single" name="NAND_sim_single" namespace="NAND">
<param name="velocity" value="12"/>
<param name="pose" value="Hill1_NAND"/>
</node>

<!-- velocity ui and updater nodes -->
<node pkg="buggy" exec="velocity_ui" name="velocity_ui" namespace="SC">
<param name="initial_vel" value="12"/>
<param name="buggy_name" value="SC"/>
</node>
<node pkg="buggy" exec="VelocityUpdater" name="velocity_updater" namespace="SC">
<param name="initial_vel" value="12"/>
<param name="buggy_name" value="SC"/>
</node>

<!-- <node name="foxglove" pkg="foxglove_bridge" type="foxglove_bridge" />
<node name="hello_world" pkg="buggy" type="hello_world" /> -->
</launch>
2 changes: 2 additions & 0 deletions rb_ws/src/buggy/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
'console_scripts': [
'hello_world = buggy.hello_world:main',
'sim_single = buggy.simulator.engine:main',
'sim_velocity_ui = buggy.similator.velocity_ui:main',
'sim_velocity_updater = buggy.similator.velocity_updater:main',
'watchdog = buggy.watchdog.watchdog_node:main'
],
},
Expand Down

0 comments on commit b0f8c26

Please sign in to comment.