How to load the map for multiple robot navigation?
I have followed the steps in answer for this question to setup multiple robot navigation. Everything is working well except when i launch the navigation the map is not loaded and getting the below error. I have remapped map to /map but still the target frame seems to be map, how is this possible.
[WARN] [1520794132.318544579, 556.425000000]: Timed out waiting for transform from robot2_tf/base_link to map to become available before running costmap, tf error: canTransform: target_frame map does not exist.. canTransform returned after 0.1 timeout was 0.1.
[ WARN] [1520794132.400360318, 556.479000000]: Request for map failed; trying again...
So, how to load the map for multiple robots navigation and make them share the map.
My launch files are as follows:
Navigation of robots launch:
<launch>
<include file="$(find gazebo_ros)/launch/empty_world.launch">
</include>
<!-- include our robots -->
<include file="$(find robot_description)/launch/myrobots.launch"/>
Run the map server
<node name="map_server" pkg="map_server" type="map_server" args="$(find robot_description)/maps/map.yaml" respawn="false" >
<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 robot_description)/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 robot_description)/launch/move_base.launch" />
</group>
</launch>
multiple robots launch:
<launch>
<!-- No namespace here as we will share this description.
Access with slash at the beginning -->
<param name="robot_description" textfile="$(find robot_description)/urdf/myrobot.urdf" />
<!-- BEGIN ROBOT 1-->
<group ns="robot1">
<param name="tf_prefix" value="robot1_tf" />
<include file="$(find robot_description)/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 robot_description)/launch/one_robot.launch" >
<arg name="init_pose" value="-x 1 -y -1 -z 0" />
<arg name="robot_name" value="Robot2" />
</include>
</group>
</launch>
Move_base launch:
<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 robot_description)/src/costmap_common_params.yaml" command="load" ns="global_costmap"/>
<rosparam file="$(find robot_description)/src/costmap_common_params.yaml" command="load" ns="local_costmap" />
<rosparam file="$(find robot_description)/src/local_costmap_params.yaml" command="load" />
<rosparam file="$(find robot_description)/src/global_costmap_params.yaml" command="load" />
<rosparam file="$(find robot_description)/src/base_local_planner_params.yaml" command="load" />
<remap from="map" to="/map" />
</node>
</launch>
Edit 2: Tf frames:
rqt_graph:
Can you please update your question with the relevant launch files?
I have edited the question as per your request
I have the same problem here. Has anyone managed to solve it?
Did you resolve this problem? I am encountering the same problem.