ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Costmap2d parameters tuning: costmap overlap at the entrance of door

asked 2016-05-06 20:48:05 -0600

zkytony gravatar image

I'd like to upload an image to illustrate the situation, but I'm not allowed yet.

Here is the situation: I am trying to tune the costmap parameters, in order to make the robot able to go through a door. Right now, the costmap (the inflation of obstacles) at the door almost overlaps, leaving not enough room for the robot to go through, and thus the robot thinks it is impossible to go through the door.

I tried decreasing inflation_radius as well as robot_radius but no luck. It seems that the costmap inflation is not changed at all. I read the costmap_2d documentation, and think that if I can reduce the inscribed radius then the costmap would not overlap, but not sure where to set it.

What parameters are relevant here and how to tune them?

I really appreciate any help!

edit retag flag offensive close merge delete


Hi kaiyu, you could upload your picture to a photo host such as Imgur and then link to it if you want. How are you launching the "move_base" node? some examples of your code could help. The "inflation_radius" parameter in the costmap yaml file is supposed to work.

IanCol gravatar image IanCol  ( 2016-05-07 13:01:17 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted

answered 2016-05-18 23:56:47 -0600

janindu gravatar image

I faced the same problem and solved it just now.

So basically, you have to launch the move_base package and provide the parameters there.

For an example, let's take the amcl_demo.launch in your turtlebot_navigation package. In it, you can see move_baselaunched by including a move_base.launch.xml file.

 <include file="$(find turtlebot_navigation)/launch/includes/move_base.launch.xml">
    <arg name="custom_param_file" value="$(arg custom_param_file)"/>

Now let's inspect that launch file.

<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
    <rosparam file="$(find turtlebot_navigation)/param/costmap_common_params.yaml" command="load" ns="global_costmap" />
    <rosparam file="$(find turtlebot_navigation)/param/costmap_common_params.yaml" command="load" ns="local_costmap" />
    <rosparam file="$(find turtlebot_navigation)/param/local_costmap_params.yaml" command="load" />
    <rosparam file="$(find turtlebot_navigation)/param/global_costmap_params.yaml" command="load" />
    <rosparam file="$(find turtlebot_navigation)/param/dwa_local_planner_params.yaml" command="load" />
    <rosparam file="$(find turtlebot_navigation)/param/move_base_params.yaml" command="load" />
    <rosparam file="$(find turtlebot_navigation)/param/global_planner_params.yaml" command="load" />
    <rosparam file="$(find turtlebot_navigation)/param/navfn_global_planner_params.yaml" command="load" />

Multiple yaml files are loaded into the move base as parameters. The $(find turtlebot_navigation)/param/local_costmap_params.yaml file is one of them which contains the common parameters for both the global and local cost maps.

In it, you can see

#cost_scaling_factor and inflation_radius were now moved to the inflation_layer ns
    enabled:              true
    cost_scaling_factor:  5.0  # exponential rate at which the obstacle cost drops off (default: 10)
    inflation_radius:     0.3  # max. distance from an obstacle at which costs are incurred for planning paths. !!!Was 0.5 (Janindu)

When I was trying to move in a corridor, Turtlebot got stuck because the inflation_radius was set to 0.5m and the robot didn't have any space to move. When I changed it to 0.3m and relaunched my amcl_demo.launch, it worked like a baby.

Don't know what your setup is but if you follow along these lines, you should be able to fix it. If not, just let me know. Willing to help more.

edit flag offensive delete link more


Thanks! Yea, I am also importing parameters from outside files. I was just unaware that there were two launch files that use these parameters (but in different files), and one overrides the other.

zkytony gravatar image zkytony  ( 2016-05-19 20:54:05 -0600 )edit

answered 2016-05-19 20:50:17 -0600

zkytony gravatar image

Thanks everyone! Previously the parameters were override by the parameters in another config file, and I wasn't aware. But yes, I am able to decrease the size of the inflation zone by reducing inflation_radius, and possibly increase cost_scaling_factor.

The robot is able to go through the door 8/10 times. It still sometimes stucks when entering or leaving the door at an angle. No collision, but the robot won't take action. I'm investigating on this issue. If anybody have suggestion for it, please let me know!

edit flag offensive delete link more


Hi Kaiyu, since you have solved your problem, please accept your own answer so that it will be out of the unanswered questions list.

janindu gravatar image janindu  ( 2016-05-19 23:09:32 -0600 )edit

answered 2016-05-09 02:10:57 -0600

Sebastian Kasperski gravatar image

The parameter you are looking for is robot_radius (unless you are using a footprint). The inflation_radius can (and should be) larger then the robot_radius. The robot will avoid the inflated area if possible, but still move into it if necessary. I usually set the inflation_radius twice the robot_radius.

edit flag offensive delete link more


Thanks! I am using footprint that is actually wider than the robot. I think inscribed_radius and circumscribed_radius will be generated based on that, and they will influence the costmap.

zkytony gravatar image zkytony  ( 2016-05-19 20:52:03 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2016-05-06 20:48:05 -0600

Seen: 2,191 times

Last updated: May 19 '16