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

Timed Out Error when initializing Costmap2DROS

asked 2017-07-23 10:19:04 -0500

procyon gravatar image

updated 2017-08-16 05:43:22 -0500

I have multiple turtlebots on Gazebo simulator and try to get the positions of the obstacles.

tf::TransformListener listener(ros::Duration(10))
costmap_2d::Costmap2DROS costmap_ros_("my_costmap", listener);
costmap_2d::Costmap2D* costmap = costmap_ros_.getCostmap();

This initialization works when I do it with a single turtlebot by using turtlebot_world & amcl provided by the turtlebot_gazebo package. However, when I try it on the multiple turtlebots I launch, it doesn't work. The error I get is:

"Timed out waiting for transform from base_link to map to become available before running costmap, tf error: . canTransform returned after 0.1 timeout was 0.1."

Here are the params:

global_costmap_params.yaml

global_costmap:
  global_frame: map
  robot_base_frame: base_link
  update_frequency: 5.0
  static_map: true

local_costmap_params.yaml

local_costmap:
   global_frame: odom
   robot_base_frame: base_link
   publish_frequency: 2.0
   static_map: false
   rolling_window: true
   width: 6.0
   height: 6.0
   resolution: 0.05

Could it be because my frames are not like /map /base_link, but with the prefixes for each robot like /robot1_tf/map and /robot1_tf/base_link since I have multiple robots?

Any help will be appreciated.

My tf tree: http://docdro.id/YugFJ9C

edit retag flag offensive close merge delete

Comments

Can you post your tf tree?

jayess gravatar image jayess  ( 2017-08-15 14:22:24 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-08-15 14:32:09 -0500

jayess gravatar image

Maybe this is a copy-paste issue but your local_costmap_params.yaml looks odd. The one from the wiki looks like this:

local_costmap:
  global_frame: odom
  robot_base_frame: base_link
  update_frequency: 5.0
  publish_frequency: 2.0
  static_map: false
  rolling_window: true
  width: 6.0
  height: 6.0
  resolution: 0.05

There's two things to notice here: everything is indented under local_costmap and the lack of a leading /. That leading / will push your frames to a global namespace, which is something that you may not want. I suggest reading @Jakub's excellent answer on how to setup a simulation of multiple robots for navigation.

Despite the answer being old (August of 2012) it's still mostly relevant. You will have to change some of the node names in use (Hydro?), but this is what I used to get my multi-robot simulation up and running and I'm using Indigo.

Without your tf tree this is just a guess.

edit flag offensive delete link more

Comments

Thank you for your answer! Yes, it was a copy paste issue, I've just edited it to the final version I used and added the tf tree. So, I had read about the leading / and removed it afterwards. However, I still couldn't make it work and ended up creating my own subscriber for the OccupancyGrid.

procyon gravatar image procyon  ( 2017-08-16 05:49:00 -0500 )edit

Great. If that worked then you should make it an answer and mark it as correct.

jayess gravatar image jayess  ( 2017-08-16 05:54:42 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2017-07-23 10:19:04 -0500

Seen: 360 times

Last updated: Aug 16 '17