Skip to content

Commit

Permalink
Merge branch 'noetic' of github.com:rolker/project11 into noetic
Browse files Browse the repository at this point in the history
  • Loading branch information
rolker committed May 28, 2024
2 parents 6ae010e + aea0b70 commit d4e860a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/project11/nav.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,11 @@ def __init__(self, tfBuffer = None):
EarthTransforms.__init__(self, tfBuffer)
self.odometry = None

self.base_frame = None
self.odom_sub = rospy.Subscriber('odom', Odometry, self.odometryCallback, queue_size = 1)


def odometryCallback(self, msg):
def odometryCallback(self, msg: Odometry):
""" Stores navigation Odometry as class attribute.
Args:
Expand All @@ -254,6 +255,8 @@ def odometryCallback(self, msg):
self.odometry = msg
if self.map_frame is None:
self.map_frame = msg.header.frame_id
if self.base_frame is None:
self.base_frame = msg.child_frame_id

def positionLatLon(self):
""" Return last known position lat/lon of the vehicle.
Expand All @@ -270,7 +273,7 @@ def positionLatLon(self):
Lat/Long in radians and altitude in meters.
"""
if self.odometry is None:
rospy.logwarn_throttle(2, "There is no current odomentry, "
rospy.logwarn_throttle(2, "There is no current odometry, "
"so can't determine position!")
return None

Expand Down

0 comments on commit d4e860a

Please sign in to comment.