2 from threading
import Lock
3 from clearpath_navigation_msgs.msg
import DistanceToGoal
4 from clearpath_navigation_msgs.msg
import MotionState
5 from geometry_msgs.msg
import PoseArray
6 from clearpath_navigation_msgs.msg
import Progress
7 from clearpath_navigation_msgs.msg
import NavigationState
8 from geometry_msgs.msg
import Twist
12 DISTANCE_TO_GOAL_TOPIC_NAME =
"/navigation/distance_to_goal"
14 MOTION_STATE_TOPIC_NAME =
"/navigation/motion_state"
16 NAV_PATH_TOPIC_NAME =
"/navigation/path"
18 NAV_PROGRESS_TOPIC_NAME =
"/navigation/progress"
20 NAV_CMD_VEL_TOPIC_NAME =
"/navigation/cmd_vel"
22 PLATFORM_VEL_TOPIC_NAME =
"/platform/cmd_vel"
26 """Create ROS subscribers for navigation status topics and save the results."""
28 def __init__(self, store_data=False, msg_warn_period=10.0):
29 """Subscribes for updates to the various navigation topics"""
36 PLATFORM_VEL_TOPIC_NAME,
41 NAV_CMD_VEL_TOPIC_NAME,
46 DISTANCE_TO_GOAL_TOPIC_NAME,
52 MOTION_STATE_TOPIC_NAME,
65 NAV_PROGRESS_TOPIC_NAME,
75 self.
_timer = rospy.Timer(period=rospy.Duration(0.2), callback=self.
_msgChecker, oneshot=
False)
92 """Updates the platform velocity.
96 msg : geometry_msgs.msg.Twist
97 The updated platform velocity
105 """Updates the navigation commanded velocity.
109 msg : geometry_msgs.msg.Twist
110 The updated navigation commanded velocity
117 self.
_time.append(rospy.get_time())
124 """Updates the distance to goal state.
128 msg : clearpath_navigation_msgs.msg.DistanceToGoal
129 The updated distance to goal state
137 """Updates the motion state.
141 msg : clearpath_navigation_msgs.msg.MotionState
142 The updated motion state
150 """Updates the planned path state.
154 msg : geometry_msgs.msg.PoseArray
155 The updated planned path state
167 """Updates the progress state.
171 msg : clearpath_navigation_msgs.msg.Progress
172 The updated progress state
180 """Check to see if messages have not been received within a certain amount of time"""
182 now = rospy.get_time()
195 """Logs all localization information."""
198 rospy.loginfo(
" Navigation:")
199 rospy.loginfo(
" Distance to Goal: Euclidean: %f, Path: %f" % (
202 rospy.loginfo(
" Motion State: Motion: %d, Indicator: %d, Direction: %d" % (
207 rospy.loginfo(
" Planned Path:")
209 rospy.loginfo(
" (%f, %f)" % (
210 pose.position.x, pose.position.y))
212 rospy.loginfo(
" Progress: Path: %f, Goal: %f, Mission: %f" % (