Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config file #15

Merged
merged 19 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ docker-compose.yml~

# BAGS
rb_ws/bags
rb_ws/src/buggy/bags/*
rb_ws/src/buggy/bags/
*.bag
rb_ws/rosbag2/

Expand Down
34 changes: 34 additions & 0 deletions rb_ws/src/buggy/config/sim_double.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**: # Global Params
ros__parameters:
traj_name: "buggycourse_safe.json"

NAND:
NAND_sim_single:
ros__parameters:
velocity: 10
pose: "Hill1_NAND"

NAND_controller:
ros__parameters:
dist: 0.0
# traj_name: "buggycourse_safe.json"
controller: "stanley"

SC:
SC_sim_single:
ros__parameters:
velocity: 12
pose: "Hill1_SC"

SC:
SC_controller:
ros__parameters:
dist: 0.0
# traj_name: "buggycourse_safe.json"
controller: "stanley"

SC:
SC_path_planner:
ros__parameters:
traj_name: "buggycourse_safe.json"
curb_name: "buggycourse_curb.json"
mehulgoel873 marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 10 additions & 0 deletions rb_ws/src/buggy/config/sim_single_sc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
SC:
SC_sim_single:
ros__parameters:
velocity: 12
pose: "Hill1_SC"
SC_controller:
ros__parameters:
dist: 0.0
traj_name: "buggycourse_safe.json"
controller: "stanley"
19 changes: 7 additions & 12 deletions rb_ws/src/buggy/launch/sim_2d_double.xml
Original file line number Diff line number Diff line change
@@ -1,31 +1,26 @@
<launch>

<arg name="config_file" default="src/buggy/config/sim_double.yaml"/>

<node pkg="foxglove_bridge" exec="foxglove_bridge" name="foxglove" output = "screen" namespace="SC"/>

<node pkg="buggy" exec="buggy_state_converter.py" name="NAND_state_converter" output = "screen" namespace="NAND"/>
<node pkg="buggy" exec="controller_node.py" name="NAND_controller" output = "screen" namespace="NAND">
<param name="dist" value="0.0"/>
<param name="traj_name" value="buggycourse_safe.json"/>
<param name="controller" value="stanley"/>
<param from="$(var config_file)"/>
</node>
<node pkg="buggy" exec="engine.py" name="NAND_sim_single" output = "screen" namespace="NAND">
<param name="velocity" value="8"/>
<param name="pose" value="Hill1_NAND"/>
<param from="$(var config_file)"/>
</node>

<node pkg="buggy" exec="buggy_state_converter.py" name="SC_state_converter" output = "screen" namespace="SC"/>
<node pkg="buggy" exec="controller_node.py" name="SC_controller" output = "screen" namespace="SC">
<param name="dist" value="0.0"/>
<param name="traj_name" value="buggycourse_safe.json"/>
<param name="controller" value="stanley"/>
<param from="$(var config_file)"/>
</node>
<node pkg="buggy" exec="engine.py" name="SC_sim_single" output = "screen" namespace="SC">
<param name="velocity" value="12"/>
<param name="pose" value="Hill1_SC"/>
<param from="$(var config_file)"/>
</node>
<node pkg="buggy" exec="path_planner.py" name="SC_path_planner" namespace="SC" output = "screen">
<param name="traj_name" value="buggycourse_safe.json"/>
<remap from="other/state" to="/NAND/self/state"/>
<param from="$(var config_file)"/>
</node>

</launch>
9 changes: 4 additions & 5 deletions rb_ws/src/buggy/launch/sim_2d_single.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<launch>

<arg name="config_file" default="src/buggy/config/sim_single_sc.yaml"/>

<node pkg="foxglove_bridge" exec="foxglove_bridge" name="foxglove" namespace="SC"/>

<node pkg="buggy" exec="engine.py" name="SC_sim_single" namespace="SC">
<param name="velocity" value="12"/>
<param name="pose" value="Hill1_SC"/>
<param from="$(var config_file)"/>
</node>
<node pkg="buggy" exec="buggy_state_converter.py" name="SC_state_converter" namespace="SC"/>
<node pkg="buggy" exec="controller_node.py" name="SC_controller" namespace="SC">
<param name="dist" value="0.0"/>
<param name="traj_name" value="buggycourse_safe.json"/>
<param name="controller" value="stanley"/>
<param from="$(var config_file)"/>
</node>
</launch>
1 change: 1 addition & 0 deletions rb_ws/src/buggy/scripts/buggy_state_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
class BuggyStateConverter(Node):
def __init__(self):
super().__init__("buggy_state_converter")
self.get_logger().info('INITIALIZED.')
mehulgoel873 marked this conversation as resolved.
Show resolved Hide resolved

namespace = self.get_namespace()
if namespace == "/SC":
Expand Down
4 changes: 2 additions & 2 deletions rb_ws/src/buggy/scripts/controller/controller_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ def __init__(self):

start_index = self.cur_traj.get_index_from_distance(start_dist)

self.declare_parameter("controller_name", "stanley")
self.declare_parameter("controller", "stanley")

controller_name = self.get_parameter("controller_name").value
controller_name = self.get_parameter("controller").value
print(controller_name.lower)
if (controller_name.lower() == "stanley"):
self.controller = StanleyController(start_index = start_index, namespace = self.get_namespace(), node=self) #IMPORT STANLEY
Expand Down
2 changes: 1 addition & 1 deletion rb_ws/src/buggy/scripts/controller/stanley_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def compute_control(self, state_msg : Odometry, trajectory : Trajectory):
float (desired steering angle)
"""
if self.current_traj_index >= trajectory.get_num_points() - 1:
self.node.get_logger.error("[Stanley]: Ran out of path to follow!")
self.node.get_logger().error("[Stanley]: Ran out of path to follow!")
raise Exception("[Stanley]: Ran out of path to follow!")

current_rospose = state_msg.pose.pose
Expand Down
1 change: 0 additions & 1 deletion rb_ws/src/buggy/scripts/serial/ros_to_bnyahaj.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ def set_steering(self, msg):
self.steer_angle = msg.data
self.fresh_steer = True


def writer_thread(self):
"""
Sends ROS Topics to bnayhaj serial, only sends a steering angle when we receive a fresh one
Expand Down
Loading