Timed Out Error when initializing Costmap2DROS
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
Can you post your tf tree?