0
$\begingroup$

Rosanswers logo

###How to launch multiple robots in gazebo simulator and how to setup navigation stacks for such a simulation?###

There were already some questions and answers for the subject, like: here, and here, and here. This is my question and answer to summarize the discussion in one place.


Originally posted by Jakub on ROS Answers with karma: 1821 on 2012-08-14

Post score: 43


Original comments

Comment by PrasadNR on 2016-11-02:
Hi @Jacub, thanks for this extraordinary contributions on forum. There is a similar problem (extended version) which can probably be solved only by you (given your expertise).( Multiple robots in ROS Gazebo SITL with separate MAVlink/MAVproxy codes )

Comment by huang_y on 2017-05-16:
Hi @Jacub,thank you for give us a so wonderful tutorial about Multiple robots simulation and navigation, but I still have some trouble about this. I could do single-robot navigation in gazebo, but when i add the the namespace in the launch file,there may be a error in the amcl.

  • List item

Comment by jayess on 2017-07-26:
@PrasadNR and @huang_y you should make your own questions because, although related, they appear to be different than this question.

Comment by Anas Kanhouch on 2021-04-06:
I was able to run multiple TB3 simulation and navigation on ROS Melodic. I noticed that the robots are not aware of each other and they collide with each other. What is needed to make the robots avoid collisions with each other?

Comment by jayess on 2021-04-06:
@Anas Kanhouch please don't use an answer to ask a question as this isn't a forum. Please create a new question and reference this one instead so that you get more visibility and have a better chance of getting your question answered (this question is almost 9 years old at this point).

Comment by Anas Kanhouch on 2022-02-03:
sure noted @jayess

Comment by Arshad on 2023-05-21:
Check out this article for multi robot in ROS2 with nav2 stack: https://medium.com/@arshad.mehmood/a-guide-to-multi-robot-navigation-utilizing-turtlebot3-and-nav2-cd24f96d19c6

$\endgroup$

4 Answers 4

0
$\begingroup$

Rosanswers logo

The answer is based on the turtlebot robot, but of course it can be used with any robot(s).

For multiple robots the key point is to manage the namespaces and tf_prefixes. Although usually we will set them to the same value for each robot in this example I will you different for purpose.

In setting up the navigation stack(s) each robot must operate in it's own namespace, but they do have to share the map (and usually robot_description). So the effect we want to achieve is:

                                  /map
       /robot1/robot_state_publisher    /robot2/robot_state_publisher
       /robot1/robot_pose_ekf           /robot2/robot_pose_ekf
       /robot1/amcl                     /robot2/amcl
       /robot1/move_base                /robot2/move_base

Simulation

First of all we have to launch the simulation, in our case gazebo. To make things more readable I split launch files in few files.

Launch file for one robot. We name it one_robot.launch:

<launch>
    <arg name="robot_name"/>
    <arg name="init_pose"/>

    <node name="spawn_minibot_model" pkg="gazebo" type="spawn_model"
     args="$(arg init_pose) -urdf -param /robot_description -model $(arg robot_name)"
     respawn="false" output="screen" />
    
    <node pkg="robot_state_publisher" type="state_publisher" 
          name="robot_state_publisher" output="screen"/>

    <!-- The odometry estimator, throttling, fake laser etc. go here -->
    <!-- All the stuff as from usual robot launch file -->
</launch>

Two things to mention for above launch file:

  • create two arguments to pass for robot initialization: name and position
  • notice that -param /robot_description is with the slash i.e. fully-qualified, as it will be shared.

Having the robot declaration we can now play with the namespaces. Your main launch file for multiple robots should look like (robots.launch):

<launch>
  <!-- No namespace here as we will share this description. 
       Access with slash at the beginning -->
  <param name="robot_description"
    command="$(find xacro)/xacro.py $(find turtlebot_description)/urdf/turtlebot.urdf.xacro" />

  <!-- BEGIN ROBOT 1-->
  <group ns="robot1">
    <param name="tf_prefix" value="robot1_tf" />
    <include file="$(find your_pkg)/launch/one_robot.launch" >
      <arg name="init_pose" value="-x 1 -y 1 -z 0" />
      <arg name="robot_name"  value="Robot1" />
    </include>
  </group>

  <!-- BEGIN ROBOT 2-->
  <group ns="robot2">
    <param name="tf_prefix" value="robot2_tf" />
    <include file="$(find your_pkg)/launch/one_robot.launch" >
      <arg name="init_pose" value="-x -1 -y 1 -z 0" />
      <arg name="robot_name"  value="Robot2" />
    </include>
  </group>
</launch>

Last thing of course is to include it in your simulation launch file:

<launch>
  <param name="/use_sim_time" value="true" />

  <!-- start world -->
  <node name="gazebo" pkg="gazebo" type="gazebo" 
   args="$(find your_pkg)/worlds/your.world" respawn="false" output="screen" />

  <!-- start gui -->
  <node name="gazebo_gui" pkg="gazebo" type="gui" respawn="false" output="screen"/>

  <!-- include our robots -->
  <include file="$(find your_pkg)/launch/robots.launch"/>
</launch>

Navigation

For setting up the navigation stack we follow the tutorial RobotSetup, but we have to add the namespace tricks for it.

We use the same approach of splitting files. First the move_base.launch for one robot, as from tutorial:

<launch>    
  <!--- Run AMCL -->
  <include file="$(find amcl)/examples/amcl_diff.launch" />
  
  <!-- Define your move_base node -->
  <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
    <rosparam file="$(find your_pkg)/costmap_common_params.yaml" command="load" ns="global_costmap"/>
    <rosparam file="$(find your_pkg)/costmap_common_params.yaml" command="load" ns="local_costmap" />
    <rosparam file="$(find your_pkg)/local_costmap_params.yaml"  command="load" />
    <rosparam file="$(find your_pkg)/global_costmap_params.yaml" command="load" />
    <rosparam file="$(find your_pkg)/base_local_planner_params.yaml" command="load" />

    <remap from="map" to="/map" />
  </node>
</launch>

The important note is to notice this remapping at the end. This file will be wrapped with namespace so we have to remove namespace from all appearances of map (there is only one map).

Now we can launch our multiple navigation file:

<launch>
  <param name="/use_sim_time" value="true"/>

  <!-- Run the map server -->
  <node name="map_server" pkg="map_server" type="map_server" args="$(find your_pkg)/map/map.yaml" >
    <param name="frame_id" value="/map" />
  </node>

  <group ns="robot1">
    <param name="tf_prefix" value="robot1_tf" />
    <param name="amcl/initial_pose_x" value="1" />
    <param name="amcl/initial_pose_y" value="1" />
    <include file="$(find your_pkg)/launch/move_base.launch" />
  </group>

  <group ns="robot2">
    <param name="tf_prefix" value="robot2_tf" />
    <param name="amcl/initial_pose_x" value="-1" />
    <param name="amcl/initial_pose_y" value="1" />
    <include file="$(find your_pkg)/launch/move_base.launch" />
  </group>

  <node pkg="rviz" type="rviz" name="rviz" args="-d $(find your_pkg)/config/multi.vcg"
   output="screen" />

</launch>

Two points to mention here.

  • Notice the param frame_id in map_server node. By default frame_id is set to map, and as map is shared for all robots we need only one map and therefore we have to force the frame_id to fully-qualified name /map.
  • Localization made by amcl need some help in providing the initial position on the map. For this purpose we introduce params carrying those values. Amcl node is in the robot namespace and those the whole path should be like /robot1/amcl/initial_pose_x, etc.

Hacking

Last thing to do is to correct some plugins for gazebo.

  1. gazebo_ros_laser.cpp in gazebo_plugins package - patch for tf_prefix resolving. Already done in fuerte, for electric see the ticket: https://code.ros.org/trac/ros-pkg/ticket/5511
  2. gazebo_ros_create.cpp in turtlebot_gazebo_plugins - two corrections needed
  • remove initial slashes from topics: cmd_vel, odom, joint_states (staring from line 157),
  • and replace line 36 to node_namespaceP_ = new ParamTstd::string("robotNamespace","",0);

Visualization

Now it's time to play around. We can send your messages to /robot1/move_base_simple/goal or via actionlib to /robot2/move_base/goal.

In rviz we can add several Robot models, but we have to remember to put a correct tf_prefix for each robot_description:

Robot Description: robot_description
TF Prefix:         robot1_tf

In rviz configuration file we have to modify the topic for actions connected to tool buttons (your local vcg file):

Tool\ 2D\ Nav\ GoalTopic=/robot1/move_base_simple/goal
Tool\ 2D\ Pose\ EstimateTopic=/robot1/initialpose

If we want to control all robots from rviz we need to add more tool buttons as described here

Have fun.


Originally posted by Jakub with karma: 1821 on 2012-08-14

This answer was ACCEPTED on the original site

Post score: 62


Original comments

Comment by Brioche on 2012-08-20:
Wonderful! exactly what I was looking for my simulation, but if I want to move the different joints of my robots, which topic should I use? because I run "rostopic echo /robot1/joint_states" I got "WARNING: no messages received and simulated time is active.Is /clock being published?" Thanks a lot

Comment by Jakub on 2012-08-22:
This tutorial is base on TurtleBot, for which joint_state_publisher is included in gazebo_ros_create pluging (see the Hacking section). For your robot of course you have add joint_state_publisher in one_robot.launch (definition of your robot).

Comment by harsha on 2013-01-10:
Thank you, @Jakub, for sharing this! :)

Comment by Xittx on 2013-02-22:
can this b useful in global mapping and global localization for multipl robots?

Comment by Joao Luis on 2014-08-12:
Very Cool, but I'm trying with ROS Hydro and I cannot achive to have separete nodes for camera plugins. What should I do? Thks

Comment by AmateurHour on 2018-07-17:
Now if only there was something like this for use in a real environment instead of Gazebo.

Comment by raequin on 2018-07-27:
Thanks for your explanation. I'm going to refer to it for my project of using multiple robot arms with MoveIt! (my question on that). Question: what do I do after hacking the cpp file? Rebuild?

Comment by shubham-shahh on 2021-08-12:
Hi, thanks for this solution but it's not working with ROS noetic, can someone post an updated answer?

Comment by jayess on 2021-08-13:
@shubham-shahh you should create a new question and reference this one for greater visibility

Comment by bashrc on 2021-08-16:
Hi, I am having some problems with the implementation, I have posted the question here

Comment by rbtcs1101 on 2021-09-01:
Thanks for the answer and it works for me! But I would not suggest using the "init_pose" to change the robot position. Because it simply changes the robot position in Gazebo and doesn't actually change the transformation between robot frame and world frame in tf tree. Maybe passing a parameter from launch file to change the origin of the joint between the world frame and base frame in the urdf file could be a better solution.

Comment by bashrc on 2021-09-02:
@rbtcs1101, you are using ros noetic?

Comment by rbtcs1101 on 2021-09-02:
@bashrc, no I am using melodic.

Comment by ThreeForElvenKings on 2023-05-24:
How would this work, if I just want to use two instances of move_base, but just on the same robot. In this case, I presume they will share the amcl pose as well, but I'm not sure how I can set it up

$\endgroup$
0
$\begingroup$

Rosanswers logo

WRT your notes, I got stuck since I didn't get neither /Robot1/joint_states nor /Robot2/joint_states, I had to add the option -unpause like the following:

 <node name="spawn_minibot_model" pkg="gazebo" type="spawn_model"
     args="$(arg init_pose) -urdf -unpause -param /robot_description -model $(arg robot_name)"
     respawn="false" output="screen" />

I am almost done, but I have a problem with the map, following your notes I have. I guess there is still a problem with namespace, in particular It asks for /base/link but it shouldn't,

[ WARN] [1345042406.057976802, 32.122000000]: You have set map parameters, but also requested to use the static map. Your parameters will be overwritten by those given by the map server
[ INFO] [1345042406.058039834, 32.122000000]: Received a 640 X 544 map at 0.050000 m/pix

[ WARN] [1345042411.112545628, 37.177000000]: Waiting on transform from /base_link to /map to become available before running costmap, tf error: 
[ WARN] [1345042416.151239313, 42.215000000]: Waiting on transform from /base_link to /map to become available before running costmap, tf error: 
[ WARN] [1345042421.160855380, 47.224000000]: Waiting on transform from /base_link to /map to become available before running costmap, tf error: 
[ WARN] [1345042426.241246711, 52.305000000]: Waiting on transform from /base_link to /map to become available before running costmap, tf error: 

THE AMCL FILE IS LIKE THIS (I have tried both setting use_map_topic either to true or false but doesn't work. If true, I have also tried to add the line but nothing):

<launch>

  <arg name="use_map_topic" default="true"/>
  <arg name="scan_topic" default="narrow_scan" />

  <node pkg="amcl" type="amcl" name="amcl">
    <param name="use_map_topic" value="$(arg use_map_topic)"/>
    <!-- Publish scans from best pose at a max of 10 Hz -->
    <param name="odom_model_type" value="diff"/>
    <param name="odom_alpha5" value="0.1"/>
    <param name="gui_publish_rate" value="10.0"/>
    <param name="laser_max_beams" value="60"/>
    <param name="laser_max_range" value="12.0"/>
    <param name="min_particles" value="500"/>
    <param name="max_particles" value="2000"/>
    <param name="kld_err" value="0.05"/>
    <param name="kld_z" value="0.99"/>
    <param name="odom_alpha1" value="0.2"/>
    <param name="odom_alpha2" value="0.2"/>
    <!-- translation std dev, m -->
    <param name="odom_alpha3" value="0.2"/>
    <param name="odom_alpha4" value="0.2"/>
    <param name="laser_z_hit" value="0.5"/>
    <param name="laser_z_short" value="0.05"/>
    <param name="laser_z_max" value="0.05"/>
    <param name="laser_z_rand" value="0.5"/>
    <param name="laser_sigma_hit" value="0.2"/>
    <param name="laser_lambda_short" value="0.1"/>
    <param name="laser_model_type" value="likelihood_field"/>
    <!-- <param name="laser_model_type" value="beam"/> -->
    <param name="laser_likelihood_max_dist" value="2.0"/>
    <param name="update_min_d" value="0.25"/>
    <param name="update_min_a" value="0.2"/>
    <param name="odom_frame_id" value="odom"/>
    <param name="resample_interval" value="1"/>
    <!-- Increase tolerance because the computer can get quite busy -->
    <param name="transform_tolerance" value="1.0"/>
    <param name="recovery_alpha_slow" value="0.0"/>
    <param name="recovery_alpha_fast" value="0.0"/>
    <remap from="scan" to="$(arg scan_topic)"/>    
  </node>

</launch>

THIS IS POSE_ROBOT_EKF

 <node  pkg="robot_pose_ekf" type="robot_pose_ekf" name="robot_pose_ekf" >
    <param name="freq" value="30.0"/>
    <param name="sensor_timeout" value="1.0"/>
    <param name="publish_tf" value="true"/>
    <param name="odom_used" value="true"/>
    <param name="imu_used" value="false"/>
    <param name="vo_used" value="false"/>
    <param name="output_frame" value="odom"/>
    <param name="output_frame" value="odom" />
  </node>

move_base.cpp lines related to global_map:

Added lines related to global (starting from line 63):

std::string global_planner, local_planner; private_nh.param("base_global_planner", global_planner, std::string("navfn/NavfnROS")); private_nh.param("base_local_planner", local_planner, std::string("base_local_planner/TrajectoryPlannerROS")); private_nh.param("global_costmap/robot_base_frame", robot_base_frame_, std::string("base_link")); private_nh.param("global_costmap/global_frame", global_frame_, std::string("/map")); private_nh.param("planner_frequency", planner_frequency_, 0.0); private_nh.param("controller_frequency", controller_frequency_, 20.0); private_nh.param("planner_patience", planner_patience_, 5.0); private_nh.param("controller_patience", controller_patience_, 15.0);

local_map.yaml FILE:

local_costmap:
   global_frame: /odom
   robot_base_frame: /base_link
   update_frequency: 5.0
   publish_frequency: 5.0
   static_map: false
   rolling_window: true
   width: 4.0
   height: 4.0
   resolution: 0.1
   transform_tolerance: 0.5

ROBOT_POSE_EKF EXCERPT FROM RXGRAPH:

Node [/robot1/robot_pose_ekf]
Publications: 
 * /tf [tf/tfMessage]
 * /rosout [rosgraph_msgs/Log]
 * /robot1/robot_pose_ekf/odom_combined [geometry_msgs/PoseWithCovarianceStamped]

Subscriptions: 
 * /tf [tf/tfMessage]
 * /robot1/odom [nav_msgs/Odometry]
     * /clock [rosgraph_msgs/Clock]

======================================================================= AMCL

<launch>

  <arg name="use_map_topic" default="true"/>
  <arg name="scan_topic" default="narrow_scan" />

  <node pkg="amcl" type="amcl" name="amcl">
    <param name="use_map_topic" value="$(arg use_map_topic)"/>
    <!-- Publish scans from best pose at a max of 10 Hz -->
    <param name="odom_model_type" value="diff"/>
    <param name="odom_alpha5" value="0.1"/>
    <param name="gui_publish_rate" value="10.0"/>
    <param name="laser_max_beams" value="60"/>
    <param name="laser_max_range" value="12.0"/>
    <param name="min_particles" value="500"/>
    <param name="max_particles" value="2000"/>
    <param name="kld_err" value="0.05"/>
    <param name="kld_z" value="0.99"/>
    <param name="odom_alpha1" value="0.2"/>
    <param name="odom_alpha2" value="0.2"/>
    <!-- translation std dev, m -->
    <param name="odom_alpha3" value="0.2"/>
    <param name="odom_alpha4" value="0.2"/>
    <param name="laser_z_hit" value="0.5"/>
    <param name="laser_z_short" value="0.05"/>
    <param name="laser_z_max" value="0.05"/>
    <param name="laser_z_rand" value="0.5"/>
    <param name="laser_sigma_hit" value="0.2"/>
    <param name="laser_lambda_short" value="0.1"/>
    <param name="laser_model_type" value="likelihood_field"/>
    <!-- <param name="laser_model_type" value="beam"/> -->
    <param name="laser_likelihood_max_dist" value="2.0"/>
    <param name="update_min_d" value="0.25"/>
    <param name="update_min_a" value="0.2"/>
<param name="base_frame_id" value="base_footprint"/> 
<param name="odom_frame_id" value="odom_combined"/> 
<param name="global_frame_id" value="/map" />
    <param name="resample_interval" value="1"/>
    <!-- Increase tolerance because the computer can get quite busy -->
    <param name="transform_tolerance" value="1.0"/>
    <param name="recovery_alpha_slow" value="0.0"/>
    <param name="recovery_alpha_fast" value="0.0"/>
    <remap from="scan" to="$(arg scan_topic)"/>    
<remap from="static_map" to="/static_map" /> 
<remap from="map" to="/map" />

  </node>

</launch>

=======================================================================

======================================================================= LOCAL_COSTMAP_PARAMS.YAML

local_costmap:
   global_frame: odom_combined
   robot_base_frame: base_link
   update_frequency: 5.0
   publish_frequency: 5.0
   static_map: false
   rolling_window: true
   width: 4.0
   height: 4.0
   resolution: 0.1
   transform_tolerance: 0.5

=======================================================================

======================================================================= GLOBAL_COSTMAP_PARAMS.YAML

global_costmap:
   global_frame: /map
   robot_base_frame: base_link
   update_frequency: 3.0
   publish_frequency: 0.0
   static_map: true
   transform_tolerance: 0.5

=======================================================================

======================================================================= COSTMAP_COMMON_PARAMS.YAML

obstacle_range: 2.5
raytrace_range: 3.0
footprint: [[-0.16, -0.16], [-0.16, 0.16], [0.19, 0.16], [0.24, 0.0], [0.19, -0.16]]
footprint_padding: 0.01
inflation_radius: 0.50
observation_sources: scan
scan: {data_type: LaserScan, topic: scan, marking: true, clearing: true}

===========================================================================

=============================================================================

NEW VERSIONE OF AMCL

<launch>

  <arg name="use_map_topic" default="false"/>
  <arg name="scan_topic" default="scan" />

  <node pkg="amcl" type="amcl" name="amcl">
    <param name="use_map_topic" value="$(arg use_map_topic)"/>
    <!-- Publish scans from best pose at a max of 10 Hz -->
    <param name="odom_model_type" value="diff"/>
    <param name="odom_alpha5" value="0.1"/>
    <param name="gui_publish_rate" value="10.0"/>
    <param name="laser_max_beams" value="60"/>
    <param name="laser_max_range" value="12.0"/>
    <param name="min_particles" value="500"/>
    <param name="max_particles" value="2000"/>
    <param name="kld_err" value="0.05"/>
    <param name="kld_z" value="0.99"/>
    <param name="odom_alpha1" value="0.2"/>
    <param name="odom_alpha2" value="0.2"/>
        <!-- translation std dev, m -->
    <param name="odom_alpha3" value="0.2"/>
    <param name="odom_alpha4" value="0.2"/>
    <param name="laser_z_hit" value="0.5"/>
    <param name="laser_z_short" value="0.05"/>
    <param name="laser_z_max" value="0.05"/>
    <param name="laser_z_rand" value="0.5"/>
    <param name="laser_sigma_hit" value="0.2"/>
    <param name="laser_lambda_short" value="0.1"/>
    <param name="laser_model_type" value="likelihood_field"/>
    <!-- <param name="laser_model_type" value="beam"/> -->
    <param name="laser_likelihood_max_dist" value="2.0"/>
    <param name="update_min_d" value="0.25"/>
    <param name="update_min_a" value="0.2"/>
<param name="base_frame_id" value="base_footprint"/> 
<param name="odom_frame_id" value="odom_combined"/> 
<param name="global_frame_id" value="/map" />
    <param name="resample_interval" value="1"/>
    <!-- Increase tolerance because the computer can get quite busy -->
    <param name="transform_tolerance" value="1.0"/>
    <param name="recovery_alpha_slow" value="0.0"/>
    <param name="recovery_alpha_fast" value="0.0"/>
    <remap from="scan" to="$(arg scan_topic)"/>    
<remap from="static_map" to="/static_map" /> 
<remap from="map" to="/map" />

  </node>

</launch>

================================================================


Originally posted by maurizio with karma: 76 on 2012-08-15

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by Jakub on 2012-08-15:
If you use robot_pose_efk in your turtlebot then you should connect to odom_combined. Try to add:

Comment by maurizio on 2012-08-15:
do I have to set it in the robot_pose_ekf part or wherever in the file? I tried in the robot_pose_ekf, in the amcl file but nothing works... I am posting the portion of robot_pose_ekf in my answer

Comment by Jakub on 2012-08-15:
No. You should add it to your amcl node. Instead of previous odom_frame_id=odom

Comment by maurizio on 2012-08-15:
Done: it says "Waiting on transform from /base_link to /map to become available before running costmap, tf err"

Comment by Jakub on 2012-08-15:
Once again in amcl.launch try with adding those two remappings:

Comment by maurizio on 2012-08-15:
It is always asking for: "Waiting on transform from /base_link to /map to become available". I don't understand why it says /base_link... why?

Comment by Jakub on 2012-08-15:
Yes, that's the point. Most probably in your global or local costmap parameters you have /base_link instead of simply base_link without the slash. So global should have: /map and base_link, and local should have odom_combined and base_link.

Comment by maurizio on 2012-08-15:
do I have to ckeck the code of the nodes? In particular do you know the files?

Comment by maurizio on 2012-08-15:
I copy the local_map.yaml file above, as far as I understand I should remove '/' from baselink right?

Comment by Jakub on 2012-08-15:
As in example http://ros.org/wiki/navigation/Tutorials/RobotSetup for move_base node you have to supply the configuration files: costmap_common_params.yaml, global_costmap_params.yaml, base_local_planner_params.yaml. Those are yaml files with data definitions only. No code to hack.

Comment by maurizio on 2012-08-15:
I have modified /base_link to base_link in both local and global files, now I get: [ WARN] [1345046788.939094049, 66.801000000]: Waiting on transform from /robot1_tf/base_link to /map to become available before running costmap, tf error

Comment by Jakub on 2012-08-15:
Did you change /odom to odom_combined (without the slash) in local costmap?

Comment by maurizio on 2012-08-15:
yes, but it doesn't work. I have done it while having and the other param that u suggested in the amcl file. Furthermore I tried to put in robot_pose_ekf, but nothing...

Comment by maurizio on 2012-08-15:
do you know who is responsible for making this link between /robot1/base_link and /map ? Is amcl?

Comment by Jakub on 2012-08-15:
In the file local_map.yaml that you have published I can see: global_frame: /odom, should be: global_frame: odom_combined

Comment by Jakub on 2012-08-15:
Remove the output_frame params from your robot_pose_ekf. It seems you remapping odom_combined back to odom.

Comment by maurizio on 2012-08-15:
Above you find topics related to robot_pose_ekf, do you think it is responsible for the problem? Otherwise, which node do you think is problematic? I also notice in common_params.yaml file the following "scan: {data_type: LaserScan, topic: /scan, marking: true, clearing: true}".

Comment by Jakub on 2012-08-15:
Yes. By default robot_pose_efk produce odom_combined topic, but you change it to odom. Secondly of course you have to remove the slash from /scan in your common_params.yaml.

Comment by maurizio on 2012-08-15:
from /robot1/pose_ekf the following topic is published: "/robot1/robot_pose_ekf/odom_combined". But it is not exploited by anyone... The topic is published, I can see an output.. but then it doesn't seem to be reflected in the tf tree.. tried what u said but doesn't work...

Comment by maurizio on 2012-08-15:
Sorry, I copied a previous print, now I have edited the topics accordingly... It doesn't work even with odom_combined

Comment by Jakub on 2012-08-15:
Pls, do update amcl.launch after chagnes, and common_params, local_map, global_map

Comment by Jakub on 2012-08-15:
The only thing I can notice is that in amcl node you use narrow_scan for scan topic, and in common_params it's still scan. Try to change scan to scann_narrow in common_params.

Comment by maurizio on 2012-08-15:
Discovered another thing: amcl subscribes to narrow_scan topic that is not actually published by no one. I am trying to remap this in the amcl file but it doesn't seem to work

Comment by Jakub on 2012-08-15:
In turtlebot_descripton the simulated laser publish on topic scan not scan_narrow. Change it in your amcl.

Comment by maurizio on 2012-08-15:
Actually now, modifying like this the amcl file, , I can see the particles of the amcl. When I try to visualize the robot model, the transform between /robot1_tf/* to /map is ok, but then complains for "No transform from [base_footprint] to [/map]" and so on

Comment by maurizio on 2012-08-15:
In order to visualize the data properly, I have to run the following command "rosrun nodelet nodelet manager __name:=openni_manager". The problem related to the robot model is solved, it was the default empty tf_prefix that caused those error messages, removing and adding another robot_model solves

Comment by Xittx on 2013-02-22:
can this b useful in global mapping and global localization for multipl robots

Comment by khansondev on 2018-03-05:
I hope this helps anyone who was looking for an answer.

Check the log output of the gazebo_ros spawn_model node. When trying to load four turtlebots, I found that two would timeout and fail silently.

Comment by Kishore Kumar on 2018-03-10:
I am using amcl for localization. followed the steps above and got the error Timed out waiting for transform from robot1_tf/base_link to map to become available before running costmap, tf error: canTransform: target_frame map does not exist

Comment by jayess on 2018-03-10:
@Kishore Kumar please create a new question and reference this question.

$\endgroup$
0
$\begingroup$

Rosanswers logo

Hi, I met a problem when I test your launch file,

  • IOError: [Errno 2] No such file or directory: '/opt/ros/indigo/share/turtlebot_description/urdf/turtlebot.urdf.xacro' while processing /home/yunfeilu330/catkin_ws/src/beginner_tutorials/launch/robots.launch: Invalid tag: Cannot load command parameter [robot_description]: command [/opt/ros/indigo/share/xacro/xacro.py /opt/ros/indigo/share/turtlebot_description/urdf/turtlebot.urdf.xacro] returned with code [1].

It seems that I don't have turtlebot.urdf.xacro, then what should I use to instead?


Originally posted by YunfeiLu with karma: 21 on 2015-04-18

This answer was NOT ACCEPTED on the original site

Post score: 2


Original comments

Comment by Ramez on 2015-06-24:
I got the same error, how did u fix it ? thank you

Comment by sina.cb on 2015-07-08:
You can use a command like this to load the urdf file

base, stacks and 3d_sensor are arguments that you can pass to it.

Comment by sina.cb on 2015-07-08:
My arguments look like this

$\endgroup$
0
$\begingroup$

Rosanswers logo

My navigation part asks for robot1/odom to map transform. I provide it through

<node pkg="tf" type="static_transform_publisher" name="odom_map_broadcaster" args="0 0 0 0 0 0 robot1/odom map 100"/>

but when i try and do it for my 2nd robot i.e. robot2/odom to map one of the two transforms stay and the other one crashes. So I only get either robot1/odom to map or robot2/odom to map transform at a time, and depending upon that only one navigation works the other one doesn't.

A similar problem is discussed in the answers but those solutions aren't working for me. Need help, stuck for days :)


Originally posted by Usman Arif with karma: 58 on 2015-09-16

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by MasterTsoutsos on 2019-02-09:
you need to do the opposite transform. map to robot1/odom and map to robot2/odom. you can have only one parent but many children

Comment by hunterlineage1 on 2023-02-21:
I also ran into a problem related to TF. I am using gmapping SLAM instead of amcl; gmapping slam creates the map and also localizes. I have the following error:

Timed out waiting for transform from base_footprint to map to become available before running costmap, tf error: canTransform: source_frame base_footprint does not exist.. canTransform returned after 0.1 timeout was 0.1.

Here is a question I posted with more details. Please help.

$\endgroup$

Your Answer

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