Sending map co-ordinates as goal to move_base
I have an occupancy grid map and an exploration algorithm that provides me with 2 dimensional co-ordinates to travel to. The mapping and goal generation are working perfectly. Unfortunately, an error arises when I send the goal to move_base. The robot does not move and I get the following error:
The robot's start position is off the global costmap. Planning will always fail, are you sure the robot has been properly localized?
This is the part of the code that sends the goal:
MoveBaseClient ac("move_base", true);
move_base_msgs::MoveBaseGoal goal;
goal.target_pose.header.frame_id = "base_link";
goal.target_pose.header.stamp = ros::Time::now();
goal.target_pose.pose.position.x = goalx;
goal.target_pose.pose.position.y = goaly;
goal.target_pose.pose.orientation.w = 1.0; //Edit made based on David Lu's answer
ac.sendGoal(goal);
where goalx and goaly are integers that contain the map co-ordinates of the goal. MoveBaseClient has been defined earlier, as given in this link.
Also, if someone has links/documentation on move_base, quaternions in ROS or examples of sending goals to move_base apart from this tutorial link, please post them as well, I would be extremely grateful. I haven't perfectly understood how to programmatically send goals to move_base.
Thank You!
goalx and goaly are map-coordinates. according to that you have to define the right
frame_id
:hello @Ashwin27 , can I ask you about the goal generation algorithm that you used here? I had problems to find such algorithm for my experimental project. it would be very nice of you if u help me with it, thanks mate.