def __init__(self):
State.__init__(self, outcomes=['success'], input_keys=['waypoints'], output_keys=['waypoints'])
# Create publsher to publish waypoints as pose array so that you can see them in rviz, etc.
self.poseArray_publisher = rospy.Publisher('/waypoints', PoseArray, queue_size=1)
# Start thread to listen for reset messages to clear the waypoint queue
def wait_for_path_reset():
"""thread worker function"""
global waypoints
while not rospy.is_shutdown():
data = rospy.wait_for_message('/path_reset', Empty)
rospy.loginfo('Recieved path RESET message')
self.initialize_path_queue()
rospy.sleep(3) # Wait 3 seconds because `rostopic echo` latches
# for three seconds and wait_for_message() in a
# loop will see it again.
reset_thread = threading.Thread(target=wait_for_path_reset)
reset_thread.start()
评论列表
文章目录