ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Local Costmap of move_base Package Does not Refresh when the Robot is Stationary.

asked 2017-12-21 19:21:39 -0600

sradmard gravatar image

updated 2017-12-27 19:27:31 -0600

Hi, I am encountering the issue that my local cost map does not refresh when the robot is stationary. This would create significant problems when there are moving obstacles around the robot. You can observe the behaviour here at 0:22 Local_costmap_issue Here is how I launch my move_base node in my robot launch file:

<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
<rosparam file="$(find turtlebot_vrep)/config/costmap_common_params.yaml" command="load" ns="global_costmap" />
<rosparam file="$(find turtlebot_vrep)/config/costmap_common_params.yaml" command="load" ns="local_costmap" />
<rosparam file="$(find turtlebot_vrep)/config/local_costmap_params.yaml" command="load" />
<rosparam file="$(find turtlebot_vrep)/config/global_costmap_params.yaml" command="load" />
<rosparam file="$(find turtlebot_vrep)/config/base_local_planner_params.yaml" command="load" />
<rosparam file="$(find turtlebot_vrep)/config/move_base_params.yaml" command="load" />
<remap from="cmd_vel" to="cmd_vel_mux/input/navi"/>

Relevant data are getting published on /map topic at about 16 Hz, on /scan topic at 20 Hz, on /odom topic at 20 Hz, and on /tf topic at about 300 Hz. However, the /move_base/local_costmap/costmap topic barely gets published on, and does not publish anything when the robot is stationary.

Also, here are my parameters:

controller_frequency: 20.0

  max_vel_x: 10.45
  min_vel_x: 0.1
  max_vel_theta: 10.0
  min_in_place_vel_theta: 0.4
  acc_lim_theta: 3.2
  acc_lim_x: 2.5
  acc_lim_y: 2.5
  holonomic_robot: true

  global_frame: map
  robot_base_frame: base_link
  update_frequency: 1.0
  static_map: true
  publish_frequency: 0.5
  transform_tolerance: 0.5

  global_frame: map
  robot_base_frame: base_link
  update_frequency: 5.0
  publish_frequency: 2.0
  static_map: false
  rolling_window: true
  width: 3.0
  height: 3.0
  resolution: 0.05

Move base node parameters.

shutdown_costmaps: false
controller_frequency: 5.0
controller_patience: 3.0
planner_frequency: 1.0
planner_patience: 5.0
oscillation_timeout: 10.0
oscillation_distance: 0.2

Costmap common psrsmeters:

transform_tolerance: 1
obstacle_range: 2.5
raytrace_range: 3.0
footprint: [[0.25, 0.2], [-0.25, 0.2], [-0.25, -0.2], [0.25, -0.2]]
inflation_radius: 0.35
observation_sources: laser_scan_sensor
laser_scan_sensor: {sensor_frame: Hokuyo_URG_04LX_UG01_ROS, data_type: LaserScan, topic: /scan, marking: true, clearing: true}

I get the same behaviour on the actual turtlebot as well, and I would really appreciate any help.

edit retag flag offensive close merge delete


by "not refresh" do you mean that the clearing does not happen? You should also show how you configured the sensors feeding the costmaps.

mgruhler gravatar image mgruhler  ( 2017-12-22 00:51:44 -0600 )edit

Sorry for the late response, and thank you for your comment. What I meant by no clearing actions is that OccupancyGrid info gets published on /move_base/local_costmap/costmap topic very rarely when the robot is stationary. You can see that in my recorded video on the ubuntu terminal.

sradmard gravatar image sradmard  ( 2017-12-27 19:21:41 -0600 )edit

Therefore, when a dynamic obstacle is recorded as an obstacle on the costmap, it takes a while for the occupancy grid to be refreshed into free when the robot is stationary. I have updated the post to include my sensor configuration feeding the costmaps.

sradmard gravatar image sradmard  ( 2017-12-27 19:24:06 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-01-02 13:13:09 -0600

AndyZe gravatar image

updated 2018-01-02 23:46:14 -0600

As far as I can tell, the costmap only updates when the robot is translating. However, /costmap_updates gets published when /costmap does not. So, you need to subscribe and use both of those topics. (This is probably a bandwidth-saving feature.)

Next question: so if you're coding, how do you update a costmap with a costmap_update? Here's a short little C++ callback function to do that. map_ can be a global variable or a member of a class.

void map_update_CB(map_msgs::OccupancyGridUpdateConstPtr msg)
{ = msg->data;

Note: I think this will only work if your update is the same size as the original map msg.

edit flag offensive delete link more


Thank you so much for your answer. There are two questions here: 1 I do not know how to check for true publishing rate of my /costmap topic. I just realised that the /costmap topic gets updated sometimes (based on rviz), while rostopic echo /costmap only returns one message. Check this video here:

sradmard gravatar image sradmard  ( 2018-01-02 17:54:55 -0600 )edit

The second question is, what do the "update_frequency", and "publish_frequency" params do in the local_costmap_params.yaml file? aren't they supposed to set the rate even when the robot is not translating?

sradmard gravatar image sradmard  ( 2018-01-02 17:59:21 -0600 )edit

Finally, it appears that, the /move_base node in fact adds new info to the costmap, but it does not execute clearing action unless the robot moves.

sradmard gravatar image sradmard  ( 2018-01-02 18:03:11 -0600 )edit

I can answer some of these Q's. You probably see a single costmap msg with rostopic echo because the message was 'latched.' So you are seeing the last available message. Rviz is probably updating more often, internally, because it subscribed to costmap_updates as well (like I talked about before).

AndyZe gravatar image AndyZe  ( 2018-01-02 23:32:47 -0600 )edit

Two commands that might help are:

rostopic hz /move_base/local_costmap/costmap


rostopic hz /move_base/local_costmap/costmap_updates
AndyZe gravatar image AndyZe  ( 2018-01-02 23:34:14 -0600 )edit

And I also think it's confusing that costmap only publishes when the robot translates, but I think the developers were trying to give an option to reduce data rates.

AndyZe gravatar image AndyZe  ( 2018-01-02 23:35:27 -0600 )edit

You are right, rviz seems to subscribe to both /costmap and /costmap_updates topics. However, I cannot find any documentation on that. The two topics are of different types, nav_msgs/OccupancyGrid & map_msgs/OccupancyGridUpdate, and rviz map feature claims to visualise nav_msgs/OccupancyGrid type.

sradmard gravatar image sradmard  ( 2018-01-04 17:45:55 -0600 )edit

The /costmap publishes the costmap values while the /costmap_updates returns the value of the updated area of the costmap and is claimed not to be necessary if source of map is always publishing full updates. That is probably why it only publishes /costmap_updates when the robot is stationary.

sradmard gravatar image sradmard  ( 2018-01-04 17:53:37 -0600 )edit

Question Tools

1 follower


Asked: 2017-12-21 19:21:39 -0600

Seen: 2,760 times

Last updated: Jan 02 '18