7 #include <move_base_msgs/MoveBaseAction.h>
8 #include <actionlib/client/simple_action_client.h>
10 typedef actionlib::SimpleActionClient<move_base_msgs::MoveBaseAction>
MoveBaseClient;
12 int main(
int argc,
char** argv){
13 ros::init(argc, argv,
"simple_navigation_goals");
19 while(!ac.waitForServer(ros::Duration(5.0))){
20 ROS_INFO(
"Waiting for the move_base action server to come up");
23 move_base_msgs::MoveBaseGoal goal;
26 goal.target_pose.header.frame_id =
"robot_0/map";
27 goal.target_pose.header.stamp = ros::Time::now();
29 goal.target_pose.pose.position.x = 0.5;
30 goal.target_pose.pose.orientation.w = 1.0;
32 ROS_INFO(
"Sending goal");
37 if(ac.getState() == actionlib::SimpleClientGoalState::SUCCEEDED)
38 ROS_INFO(
"Hooray, the base moved 1 meter forward");
40 ROS_INFO(
"The base failed to move forward 1 meter for some reason");