planner_test_client.py
Go to the documentation of this file.
00001 #! /usr/bin/env python
00002 
00003 import roslib; roslib.load_manifest('planner_msgs')
00004 import rospy
00005 import time
00006 # Brings in the SimpleActionClient
00007 import actionlib
00008 from geometry_msgs.msg import Pose2D
00009 from planner_msgs.msg import goal, GoToGoal, GoToAction
00010 
00011 
00012 
00013 def purepursuit_client():
00014         # Creates the SimpleActionClient, passing the type of the action
00015         # (GoTo) to the constructor.
00016         client = actionlib.SimpleActionClient('purepursuit_planner', GoToAction)
00017 
00018         # Waits until the action server has started up and started listening for goals.
00019         client.wait_for_server()
00020         
00021         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), 
00022         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),
00023         goal(pose = Pose2D(4.96, 2.18, 0.0), speed = 0.2), goal(pose = Pose2D(8.54, 2.22, 0.0), speed = 0.2)])
00024         
00025         rospy.loginfo('Sending goal')
00026         # Sends the goal to the action server.
00027         client.send_goal(g)
00028         #print 'Sleeping'
00029         #time.sleep(4)
00030         #print 'Canceling goal'
00031         #client.cancel_goal()
00032         # Waits for the server to finish performing the action.
00033         client.wait_for_result()
00034 
00035         # Prints out the result of executing the action
00036         return client.get_result() 
00037 
00038 if __name__ == '__main__':
00039         try:
00040                 # Initializes a rospy node so that the SimpleActionClient can
00041                 # publish and subscribe over ROS.
00042                 rospy.init_node('planner_test_client')
00043                 result = purepursuit_client()
00044                 rospy.loginfo( 'Result: %d'%(result.route_result))
00045         except rospy.ROSInterruptException:
00046                 print "program interrupted before completion"


purepursuit_planner
Author(s): Román Navarro
autogenerated on Thu Aug 27 2015 12:08:42