From a6b9c7c8d3679d1bd9eaea7151f3ae0eef4df267 Mon Sep 17 00:00:00 2001 From: Mehul Goel <mehulgoel873@gmail.com> Date: Wed, 3 Apr 2024 17:40:02 -0400 Subject: [PATCH] Fixed change --- rb_ws/src/buggy/launch/nand-system.launch | 2 +- rb_ws/src/buggy/scripts/serial/ros_to_bnyahaj.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/rb_ws/src/buggy/launch/nand-system.launch b/rb_ws/src/buggy/launch/nand-system.launch index f6726a3d..cac7d2d2 100644 --- a/rb_ws/src/buggy/launch/nand-system.launch +++ b/rb_ws/src/buggy/launch/nand-system.launch @@ -2,7 +2,7 @@ <launch> - <node name="bnyahaj" pkg="buggy" type="ros_to_bnyahaj.py" output="screen" args="--self_name NAND --other_name SC --teensy_name nand-teensy"/> + <node name="bnyahaj" pkg="buggy" type="ros_to_bnyahaj.py" output="screen" args="--self_name NAND --teensy_name nand-teensy"/> <node name="foxglove" pkg="foxglove_bridge" type="foxglove_bridge" /> <node name="telematics" pkg="buggy" type="telematics.py" /> diff --git a/rb_ws/src/buggy/scripts/serial/ros_to_bnyahaj.py b/rb_ws/src/buggy/scripts/serial/ros_to_bnyahaj.py index b7a77c10..18a54003 100755 --- a/rb_ws/src/buggy/scripts/serial/ros_to_bnyahaj.py +++ b/rb_ws/src/buggy/scripts/serial/ros_to_bnyahaj.py @@ -28,7 +28,11 @@ def __init__(self, self_name, other_name, teensy_name): rospy.Subscriber(self_name + "/buggy/input/steering", Float64, self.set_steering) rospy.Subscriber(self_name + "/debug/sanity_warning", Int8, self.set_alarm) - self.odom_publisher = rospy.Publisher(other_name + "/nav/odom", ROSOdom, queue_size=1) + + if other_name is None: + self.odom_publisher = rospy.Publisher(self_name + "/nav/odom", ROSOdom, queue_size=1) + else: + self.odom_publisher = rospy.Publisher(other_name + "/nav/odom", ROSOdom, queue_size=1) # upper bound of steering update rate, make sure auton sends slower than this self.steer_send_rate = rospy.Rate(500) self.read_rate = rospy.Rate(1000) @@ -114,7 +118,7 @@ def loop(self): if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("--self_name", type=str, help="name of ego-buggy", required=True) - parser.add_argument("--other_name", type=str, help="name of other buggy", required=True) + parser.add_argument("--other_name", type=str, help="name of other buggy", required=False, default=None) parser.add_argument("--teensy_name", type=str, help="name of teensy port", required=True) args, _ = parser.parse_known_args() self_name = args.self_name