move_base goal not reached
Hi,
I am trying to use movebase to move my robot to a particular point in the environment. While moving autonomously, the robot should build a map at the same time using the gmapping
node. I am running on a Powerbot platform with the rosaria
package to control and drive the robot. This is the movebase.launch file that I am using to set the parameters of the move_base
package. As you can see, I have disabled the recoverybehaviour and clearingrotation parameters. The local planner that I am using is the DWA planner.
move_base.launch:
<launch>
<arg name="no_static_map" default="false"/>
<arg name="base_global_planner" default="navfn/NavfnROS"/>
<arg name="base_local_planner" default="dwa_local_planner/DWAPlannerROS"/>
<!-- <arg name="base_local_planner" default="base_local_planner/TrajectoryPlannerROS"/> -->
<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
<param name="base_global_planner" value="$(arg base_global_planner)"/>
<param name="base_local_planner" value="$(arg base_local_planner)"/>
<rosparam file="$(find move_base)/config/planner.yaml" command="load"/>
<!-- observation sources located in costmap_common.yaml -->
<rosparam file="$(find move_base)/config/costmap_common.yaml" command="load" ns="global_costmap" />
<rosparam file="$(find move_base)/config/costmap_common.yaml" command="load" ns="local_costmap" />
<!-- local costmap, needs size -->
<rosparam file="$(find move_base)/config/costmap_local.yaml" command="load" ns="local_costmap" />
<param name="local_costmap/width" value="10.0"/>
<param name="local_costmap/height" value="10.0"/>
<param name="local_costmap/inflation/inflation_radius" value="0.2"/>
<!-- static global costmap, static map provides size -->
<rosparam file="$(find move_base)/config/costmap_global_static.yaml" command="load" ns="global_costmap" unless="$(arg no_static_map)"/>
<!-- global costmap with laser, for odom_navigation_demo -->
<rosparam file="$(find move_base)/config/costmap_global_laser.yaml" command="load" ns="global_costmap" if="$(arg no_static_map)"/>
<param name="global_costmap/width" value="100.0" if="$(arg no_static_map)"/>
<param name="global_costmap/height" value="100.0" if="$(arg no_static_map)"/>
<param name="global_costmap/inflation/inflation_radius" value="0.5" if="$(arg no_static_map)"/>
<!-- DWAPlannerROS parameters -->
<rosparam file="$(find move_base)/config/planner.yaml" command="load" ns="DWAPlannerROS"/>
<param name="DWAPlannerROS/acc_lim_x" value="0.5"/>
<param name="DWAPlannerROS/acc_lim_y" value="0.5"/>
<param name="DWAPlannerROS/acc_lim_th" value="1.0"/>
<param name="DWAPlannerROS/max_trans_vel" value="0.3"/>
<param name="DWAPlannerROS/max_vel_x" value="0.3"/>
<param name="DWAPlannerROS/max_vel_y" value="0.3"/>
<param name="DWAPlannerROS/min_rot_vel" value="0.2"/>
<param name="DWAPlannerROS/max_rot_vel" value="0.4"/>
<!-- Remap into namespace for cmd_vel_mux switching -->
<remap from="cmd_vel" to="/RosAria/cmd_vel" />
</node>
</launch>
Then, I am using this code to move the robot 30cm along the x-axis of the robot and 20cm along the y-axis of the robot. My robot can only move in a 2 dimensional environment. I need to set up move_base to be able to give the robot a goal location as an (x,y) coordinate and it must move to that location.
sendingsimplegoal.cpp:
#include <ros/ros.h>
#include <move_base_msgs/MoveBaseAction.h>
#include <actionlib/client/simple_action_client.h>
typedef actionlib::SimpleActionClient<move_base_msgs::MoveBaseAction> MoveBaseClient;
int main(int argc, char** argv){
ros::init(argc, argv, "simple_navigation_goals");
//tell the action client that we want to spin a thread by default
MoveBaseClient ac("move_base", true);
//wait for the action server to come up
while(!ac.waitForServer(ros::Duration(5.0)))
{
ROS_INFO("Waiting for the move_base action server to come up");
}
ROS_INFO("Connected to move_base action server!");
move_base_msgs::MoveBaseGoal goal;
//we'll send a goal to the robot to move 1 meter forward
goal.target_pose.header.frame_id = "base_link";
goal.target_pose.header.stamp = ros::Time::now();
double x;
double y;
double w;
double angle = 0;
x = 0.3;
y = 0.2;
w = 1; //cos(angle/2);
goal.target_pose.pose.position.x = x;
goal.target_pose.pose.position.y = y;
goal.target_pose.pose.orientation.w = w;
ROS_INFO("Sending goal");
ac.sendGoal(goal);
ROS_INFO("Goal has been sent. Now waiting for result.");
ac.waitForResult(ros::Duration(30.0));
ROS_INFO("Done waiting for result. Getting state now");
if(ac.getState() == actionlib::SimpleClientGoalState::SUCCEEDED)
ROS_INFO("Hooray, the base moved %.2f meter along the x and %.2f meter along the y", x,y);
else
ROS_INFO("The base failed to move %.2f meter along the x and %.2f meter along the y for some reason", x,y);
return 0;
}
My problem with my current code is that, if given a goal to move 30cm along the x-axis only and 0cm along the y-axis, the goal is reached successfully. But, if, as explained, I set the goal to x=0.3 and y=0.2, the goal is never reached and the robot keeps spinning and move in a random fashion. As a result, the resulting map is a total mess, as you can see from the attached image.! Result of move_base
Please can anyone help identify the problem? Also, can anyone help me understand how to use move_base to set an (x,y) coordinate in the map as a goal for the robot to reach?
Thanks in advance.
Asked by RND on 2015-03-25 08:48:38 UTC
Comments
Can you embed the launch, code, and image into the question?
Asked by lucasw on 2015-03-25 17:20:41 UTC
OK i embedded the launch and code but could not embed the image.
Asked by RND on 2015-03-26 04:09:31 UTC