Skip to content

Commit

Permalink
added try-except when converting nand pos (#71)
Browse files Browse the repository at this point in the history
* added try-except when converting nand pos

* added logging
  • Loading branch information
Jackack authored Apr 3, 2024
1 parent c7760dd commit c35e3b2
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions rb_ws/src/buggy/scripts/serial/ros_to_bnyahaj.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,14 @@ def reader_thread(self):
#Publish to odom topic x and y coord
odom = ROSOdom()
# convert to long lat
lat, long = World.utm_to_gps(packet.y, packet.x)
odom.pose.pose.position.x = long
odom.pose.pose.position.y = lat
try:
lat, long = World.utm_to_gps(packet.y, packet.x)
odom.pose.pose.position.x = long
odom.pose.pose.position.y = lat
self.odom_publisher.publish(odom)
except Exception as e:
rospy.logwarn("Unable to convert other buggy position to lon lat" + e)

self.odom_publisher.publish(odom)
elif isinstance(packet, tuple): #Are there any other packet that is a tuple
# print(packet)
self.rc_steering_angle_publisher.publish(Float64(packet[0]))
Expand All @@ -87,8 +90,6 @@ def reader_thread(self):

self.read_rate.sleep()



def loop(self):
p1 = threading.Thread(target=self.writer_thread)
p2 = threading.Thread(target=self.reader_thread)
Expand Down

0 comments on commit c35e3b2

Please sign in to comment.