2 from threading
import Lock
3 from nav_msgs.msg
import Odometry
4 from clearpath_localization_msgs.msg
import LocalizationStatus
8 ODOM_TOPIC_NAME =
"/localization/odom"
10 STATUS_TOPIC_NAME =
"/localization/status"
14 """Create ROS subscribers for localization status topics and save the results."""
16 def __init__(self, store_data=False, msg_warn_period=10.0):
17 """Subscribes for updates to the various localization topics"""
37 self.
_timer = rospy.Timer(period=rospy.Duration(0.2), callback=self.
_msgChecker, oneshot=
False)
45 """Updates the odom state.
49 msg : nav_msgs.msg.Odometry
50 The updated odom state
61 """Updates the GPS status state.
65 msg : clearpath_localization_msgs.msg.LocalizationStatus
66 The updated GPS status state
74 """Check to see if messages have not been received within a certain amount of time"""
76 now = rospy.get_time()
83 """Logs all localization information."""
86 rospy.loginfo(
" Localization:")
87 rospy.loginfo(
" Odom: Pose (%f, %f, %f) Orientation (%f, %f, %f, %f) " % (
88 self.
_odom.pose.pose.position.x,
89 self.
_odom.pose.pose.position.y,
90 self.
_odom.pose.pose.position.z,
91 self.
_odom.pose.pose.orientation.x,
92 self.
_odom.pose.pose.orientation.y,
93 self.
_odom.pose.pose.orientation.z,
94 self.
_odom.pose.pose.orientation.w))
95 rospy.loginfo(
" Status:")
96 rospy.loginfo(
" Accuracy: %f" % self.
_status.accuracy)
97 rospy.loginfo(
" GPS Position Num Connected Sats: %d" %
98 self.
_status.position_gnss.num_connected_sats)
99 rospy.loginfo(
" GPS Heading Num Connected Sats: %d" %
100 self.
_status.heading_gnss.num_connected_sats)
101 rospy.loginfo(
" GPS Base Station Num Connected Sats: %d" %
102 self.
_status.base_station_gnss.num_connected_sats)
103 rospy.loginfo(
" GPS Dead Reckoning: %d" %