7 from locomotor_msgs.msg
import NavigateToPoseAction, NavigateToPoseGoal
10 pose = feedback.state.global_pose.pose
11 vel = feedback.state.current_velocity.velocity
12 print(
'%.2f %.2f %.2f | %.2f %.2f' % (pose.x, pose.y, pose.theta,
14 print(
'Global plan: %d poses' % len(feedback.state.global_plan.poses))
15 print(
'%.2f %.2f %.2f' % (feedback.percent_complete,
16 feedback.distance_traveled,
17 feedback.estimated_distance_remaining))
20 parser = argparse.ArgumentParser()
21 parser.add_argument(
'x', nargs=
'?', type=float, default=0.0)
22 parser.add_argument(
'y', nargs=
'?', type=float, default=0.0)
23 parser.add_argument(
'theta', nargs=
'?', type=float, default=0.0)
24 parser.add_argument(
'-f',
'--frame_id', default=
'map')
25 parser.add_argument(
'-n',
'--namespace', default=
'/locomotor/')
26 args = parser.parse_args()
28 rospy.init_node(
'send_action', anonymous=
True)
30 client.wait_for_server()
31 goal = NavigateToPoseGoal()
32 goal.goal.pose.x = args.x
33 goal.goal.pose.y = args.y
34 goal.goal.pose.theta = args.theta
35 goal.goal.header.frame_id = args.frame_id
36 client.send_goal(goal, feedback_cb = print_feedback)
37 client.wait_for_result()
38 print(client.get_result())
def print_feedback(feedback)