0
$\begingroup$

Rosanswers logo

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


Originally posted by procyon on ROS Answers with karma: 26 on 2017-07-23

Post score: 1


Original comments

Comment by jayess on 2017-08-15:
Can you post your tf tree?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by jayess with karma: 6155 on 2017-08-15

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by procyon on 2017-08-16:
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.

Comment by jayess on 2017-08-16:
Great. If that worked then you should make it an answer and mark it as correct.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.