Go to the documentation of this file.00001
00002
00003 import roslib; roslib.load_manifest('purepursuit_planner')
00004 import rospy
00005 import time
00006
00007 import actionlib
00008 from geometry_msgs.msg import Pose2D
00009 from purepursuit_planner.msg import goal, GoToGoal
00010
00011
00012
00013 import purepursuit_planner.msg
00014
00015 def purepursuit_client():
00016
00017
00018 client = actionlib.SimpleActionClient('purepursuit_planner', purepursuit_planner.msg.GoToAction)
00019
00020
00021
00022 client.wait_for_server()
00023
00024 g = GoToGoal(target = [goal(pose = Pose2D(-2.0, 0.86, 0.0), speed = 0.2), goal(pose = Pose2D(-1.0, 0.46, 0.0), speed = 0.2),
00025 goal(pose = Pose2D(0.0, 0.0, 0.0), speed = 0.2), goal(pose = Pose2D(1.0, 0.0, 0.0), speed = 0.2), goal(pose = Pose2D(2.54, 1.0, 0.0), speed = 0.2),
00026 goal(pose = Pose2D(4.96, 2.18, 0.0), speed = 0.2), goal(pose = Pose2D(8.54, 2.22, 0.0), speed = 0.2)])
00027
00028
00029 print 'Sending goal'
00030
00031 client.send_goal(g)
00032
00033
00034
00035
00036
00037 client.wait_for_result()
00038
00039
00040 return client.get_result()
00041
00042 if __name__ == '__main__':
00043 try:
00044
00045
00046 rospy.init_node('purepursuit_client_py')
00047 result = purepursuit_client()
00048 print 'Result: %d'%(result.route_result)
00049 except rospy.ROSInterruptException:
00050 print "program interrupted before completion"