Skip to content

Commit

Permalink
Sign convention
Browse files Browse the repository at this point in the history
  • Loading branch information
mehulgoel873 committed Apr 6, 2024
1 parent 7a169c1 commit aa3b046
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions rb_ws/src/buggy/scripts/serial/ros_to_bnyahaj.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

from world import World
from pose import Pose
import numpy as np

class Translator:
def __init__(self, self_name, other_name, teensy_name):
Expand Down Expand Up @@ -80,7 +81,7 @@ def reader_thread(self):
while True:
packet = self.comms.read_packet()
# print("trying to read odom")
if isinstance(packet, Odometry):
if isinstance(packet, Odometry) and self_name == "SC":
rospy.logdebug("packet", packet)
#Publish to odom topic x and y coord
odom = ROSOdom()
Expand All @@ -93,15 +94,15 @@ def reader_thread(self):
except Exception as e:
rospy.logwarn("Unable to convert other buggy position to lon lat" + e)

elif isinstance(packet, BnyaTelemetry):
elif isinstance(packet, BnyaTelemetry) and self_name == "NAND":
rospy.logdebug("packet", packet)
odom = ROSOdom()
try:
lat, long = World.utm_to_gps(packet.y, packet.x)
odom.pose.pose.position.x = long
odom.pose.pose.position.y = lat
odom.twist.twist.angular.z = packet.heading_rate
odom.pose.pose.orientation = Pose.heading_to_quaternion(packet.heading)
odom.pose.pose.orientation = Pose.heading_to_quaternion(packet.heading + np.pi/2)

self.odom_publisher.publish(odom)
except Exception as e:
Expand Down

0 comments on commit aa3b046

Please sign in to comment.