Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 import roslib
00018 roslib.load_manifest('footstep_planner')
00019 import rospy
00020 import sys
00021 
00022 from humanoid_nav_msgs.srv import *
00023 from geometry_msgs.msg import Pose2D
00024 
00025 if __name__ == '__main__':
00026     if len(sys.argv) != 7:
00027         sys.exit('\nUSAGE: %s <start> <goal>\n  where <start> and <goal> consist of "x y theta" in world coordinates\n\n' %  sys.argv[0])
00028     
00029     rospy.init_node('plan_footsteps')
00030     planSrv = rospy.ServiceProxy("plan_footsteps", PlanFootsteps)
00031     start = Pose2D()
00032     goal = Pose2D()
00033     
00034     start.x=float(sys.argv[1])
00035     start.y=float(sys.argv[2])
00036     start.theta=float(sys.argv[3])
00037     
00038     goal.x=float(sys.argv[4])
00039     goal.y=float(sys.argv[5])
00040     goal.theta=float(sys.argv[6])
00041     
00042     rospy.loginfo("Calling footstep planner service from (%f %f %f) to (%f %f %f)...", 
00043                   start.x, start.y, start.theta, goal.x, goal.y, goal.theta)
00044     resp = planSrv(start, goal)
00045     
00046     if resp.result == True:
00047         rospy.loginfo("Planning succeeded with %d steps, path costs: %f" % (len(resp.footsteps), resp.costs))
00048     else:
00049         rospy.logerr("Service call failed")
00050     
00051     exit(0)