0
$\begingroup$

Rosanswers logo

I am trying to run move_base nodes for each of 3 turtlebot3s in ROS melodic and gazebo9. My approach is taken mainly from the "Multiple robots simulation and navigation" answer which gives instructions on how to simulate multiple turtlebot3s (3 in my case) using AMCL package and the navigation stack. AMCL package "track the pose of a robot against a known map" but in this case I am running gmapping SLAM on my 3 turtlebot3s. I am not using amcl package because I am using gmapping SLAM to do my localization and map building.

My objective is to run explore_lite on 3 turtlebot3s and using multirobot_map_merge to merge their individual maps. For now, I am trying to run move_base for each of the 3 turtlebot3s and use '2D Nav Goal' for each of their /move_base_simple/goal topics. When I run my multi_move_base.launch file, I get the following error:

[ WARN] [1676956640.385330213, 617.147000000]: 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.101 timeout was 0.1.

I am not able to solve this error. Here are my launch files:

roslaunch turtlebot3_gazebo multi_MAIN_turtlebot3.launch

uses multi_MAIN_turtlebot3.launch:

<launch>
  <!-- <param name="/use_sim_time" value="true"/> -->
  <arg name="model" default="$(env TURTLEBOT3_MODEL)" doc="model type [burger, waffle, waffle_pi]"/>
  <arg name="first_tb3"  default="tb3_0"/>
  <arg name="second_tb3" default="tb3_1"/>
  <arg name="third_tb3"  default="tb3_2"/>

  <arg name="first_tb3_x_pos" default="-7.0"/>
  <arg name="first_tb3_y_pos" default="-1.0"/>
  <arg name="first_tb3_z_pos" default=" 0.0"/>
  <arg name="first_tb3_yaw"   default=" 1.57"/>

  <arg name="second_tb3_x_pos" default=" 7.0"/>
  <arg name="second_tb3_y_pos" default="-1.0"/>
  <arg name="second_tb3_z_pos" default=" 0.0"/>
  <arg name="second_tb3_yaw"   default=" 1.57"/>

  <arg name="third_tb3_x_pos" default=" 0.5"/>
  <arg name="third_tb3_y_pos" default=" 3.0"/>
  <arg name="third_tb3_z_pos" default=" 0.0"/>
  <arg name="third_tb3_yaw"   default=" 0.0"/>

  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="$(find turtlebot3_gazebo)/worlds/turtlebot3_house.world"/>
    <arg name="paused" value="false"/>
    <arg name="use_sim_time" value="true"/>
    <arg name="gui" value="true"/>
    <arg name="headless" value="false"/>
    <arg name="debug" value="false"/>
  </include>  

  <group ns = "$(arg first_tb3)">
    <param name="robot_description" command="$(find xacro)/xacro $(find turtlebot3_description)/urdf/turtlebot3_$(arg model).urdf.xacro" />

    <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" output="screen">
      <param name="publish_frequency" type="double" value="50.0" />
      <param name="tf_prefix" value="$(arg first_tb3)" />
    </node>
    
    <node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-urdf -model $(arg first_tb3) -x $(arg first_tb3_x_pos) -y $(arg first_tb3_y_pos) -z $(arg first_tb3_z_pos) -Y $(arg first_tb3_yaw) -param robot_description" />
  </group>

  <group ns = "$(arg second_tb3)">
    <param name="robot_description" command="$(find xacro)/xacro $(find turtlebot3_description)/urdf/turtlebot3_$(arg model).urdf.xacro" />

    <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" output="screen">
      <param name="publish_frequency" type="double" value="50.0" />
      <param name="tf_prefix" value="$(arg second_tb3)" />
    </node>

    <node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-urdf -model $(arg second_tb3) -x $(arg second_tb3_x_pos) -y $(arg second_tb3_y_pos) -z $(arg second_tb3_z_pos) -Y $(arg second_tb3_yaw) -param robot_description" />
  </group>

  <group ns = "$(arg third_tb3)">
    <param name="robot_description" command="$(find xacro)/xacro $(find turtlebot3_description)/urdf/turtlebot3_$(arg model).urdf.xacro" />

    <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" output="screen">
      <param name="publish_frequency" type="double" value="50.0" />
      <param name="tf_prefix" value="$(arg third_tb3)" />
    </node>

    <node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-urdf -model $(arg third_tb3) -x $(arg third_tb3_x_pos) -y $(arg third_tb3_y_pos) -z $(arg third_tb3_z_pos) -Y $(arg third_tb3_yaw) -param robot_description" />
  </group>

</launch>

roslaunch turtlebot3_slam multi_gmapping.launch

uses multi_gmapping.launch:

 <launch>
  <arg name="open_rviz" default="true"/>
  <param name="/use_sim_time" value="true"/>

  <!-- Launch the gmapping node for Turtlebot 3 with custom namespace -->
  <!-- <group ns="tb3_0"> -->
    <include file="$(find turtlebot3_gazebo)/launch/multi_turtlebot3_slam.launch">
      <arg name="ns" value="tb3_0"/>
    </include>
  <!-- </group> -->

  <!-- <group ns="tb3_1"> -->
    <include file="$(find turtlebot3_gazebo)/launch/multi_turtlebot3_slam.launch">
      <arg name="ns" value="tb3_1"/>
    </include>
  <!-- </group> -->

  <!-- <group ns="tb3_2"> -->
    <include file="$(find turtlebot3_gazebo)/launch/multi_turtlebot3_slam.launch">
      <arg name="ns" value="tb3_2"/>
    </include>
  <!-- </group> -->

  <include file="$(find turtlebot3_gazebo)/launch/multi_map_merge.launch"></include>

  <group if="$(arg open_rviz)"> 
    <node pkg="rviz" type="rviz" name="rviz" required="true"
          args="-d $(find turtlebot3_gazebo)/rviz/multi_turtlebot3_slam_MB.rviz"/>
  </group>

</launch>

multi_turtlebot3_slam.launch:

<launch>
  <arg name="ns" default="tb3_0"/>

  <!-- Gmapping -->
  <node pkg="gmapping" type="slam_gmapping" name="turtlebot3_slam_gmapping" output="screen" ns="$(arg ns)">
    <param name="base_frame" value="$(arg ns)/base_footprint"/>
    <param name="odom_frame" value="$(arg ns)/odom"/>
    <param name="map_frame"  value="$(arg ns)/map"/>
    <param name="map_update_interval" value="2.0"/>
    <param name="maxUrange" value="4.0"/>
    <param name="minimumScore" value="100"/>
    <param name="linearUpdate" value="0.2"/>
    <param name="angularUpdate" value="0.2"/>
    <param name="temporalUpdate" value="0.5"/>
    <param name="delta" value="0.05"/>
    <param name="lskip" value="0"/>
    <param name="particles" value="120"/>
    <param name="sigma" value="0.05"/>
    <param name="kernelSize" value="1"/>
    <param name="lstep" value="0.05"/>
    <param name="astep" value="0.05"/>
    <param name="iterations" value="5"/>
    <param name="lsigma" value="0.075"/>
    <param name="ogain" value="3.0"/>
    <param name="srr" value="0.01"/>
    <param name="srt" value="0.02"/>
    <param name="str" value="0.01"/>
    <param name="stt" value="0.02"/>
    <param name="resampleThreshold" value="0.5"/>
    <param name="xmin" value="-10.0"/>
    <param name="ymin" value="-10.0"/>
    <param name="xmax" value="10.0"/>
    <param name="ymax" value="10.0"/>
    <param name="llsamplerange" value="0.01"/>
    <param name="llsamplestep" value="0.01"/>
    <param name="lasamplerange" value="0.005"/>
    <param name="lasamplestep" value="0.005"/>
  </node>
</launch>

roslaunch turtlebot3_navigation multi_move_base.launch

uses multi_move_base.launch:

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



    <!-- Launch the move_base node for Turtlebot 3 with custom namespace -->
  <group ns="tb3_0">
    <!-- <param name="tf_prefix" value="tb3_0" /> -->
    <include file="$(find turtlebot3_navigation)/launch/move_base.launch">

        <arg name="cmd_vel_topic" value="tb3_0/cmd_vel" />
        <arg name="odom_topic" value="tb3_0/odom" />
        <arg name="move_forward_only" value="false"/>
    </include> 
  </group>

  <group ns="tb3_1">
    <!-- <param name="tf_prefix" value="tb3_1" /> -->
    <include file="$(find turtlebot3_navigation)/launch/move_base.launch">

        <arg name="cmd_vel_topic" value="tb3_1/cmd_vel" />
        <arg name="odom_topic" value="tb3_1/odom" />
        <arg name="move_forward_only" value="false"/>
    </include>
  </group>

  <group ns="tb3_2">
    <!-- <param name="tf_prefix" value="tb3_2" /> -->
    <include file="$(find turtlebot3_navigation)/launch/move_base.launch">

        <arg name="cmd_vel_topic" value="tb3_2/cmd_vel" />
        <arg name="odom_topic" value="tb3_2/odom" />
        <arg name="move_forward_only" value="false"/>
    </include>
  </group>

</launch>

and finally, my move_base.launch:

<launch>
  <!-- Arguments -->
  <arg name="model" default="$(env TURTLEBOT3_MODEL)" doc="model type [burger, waffle, waffle_pi]"/>
  <arg name="cmd_vel_topic" default="/cmd_vel" />
  <arg name="odom_topic" default="odom" />
  <arg name="move_forward_only" default="false"/>

  <!-- move_base -->
  <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
    <param name="base_local_planner" value="dwa_local_planner/DWAPlannerROS" />
    <rosparam file="$(find turtlebot3_navigation)/param/costmap_common_params_$(arg model).yaml" command="load" ns="global_costmap" />
    <rosparam file="$(find turtlebot3_navigation)/param/costmap_common_params_$(arg model).yaml" command="load" ns="local_costmap" />
    <rosparam file="$(find turtlebot3_navigation)/param/local_costmap_params.yaml" command="load" />
    <rosparam file="$(find turtlebot3_navigation)/param/global_costmap_params.yaml" command="load" />
    <rosparam file="$(find turtlebot3_navigation)/param/move_base_params.yaml" command="load" />
    <rosparam file="$(find turtlebot3_navigation)/param/dwa_local_planner_params_$(arg model).yaml" command="load" />
    <remap from="cmd_vel" to="$(arg cmd_vel_topic)"/>
    <remap from="odom" to="$(arg odom_topic)"/>
    <remap from="map" to="/map" />
    <remap from="base_footprint" to="/base_footprint" />
    <param name="DWAPlannerROS/min_vel_x" value="0.0" if="$(arg move_forward_only)" />
  </node>
</launch>

Originally posted by hunterlineage1 on ROS Answers with karma: 24 on 2023-02-21

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The names of the map topics do not appear to match.

The map topic that move_base is trying to subscribe to is /map. In contrast, the map topic published by gmapping should be /tb3_1/map etc., not /map.

There is progress to be made in aligning them. You could try removing <remap from="map" to="/map" /> from move_base.launch.

Before you do that, we recommend that you check the list of topics to see who the publisher and subscribers are.


Originally posted by miura with karma: 1908 on 2023-02-26

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by hunterlineage1 on 2023-03-01:
This helps. So previously my move_base_simple/goal for each turtlebot3 was being set on the global /map topic. This is undesired because the /map is a result of the combination of /tb3_0/map, /tb3_1/map, and /tb3_2/map using multirobot_map_merge package. When I removed <remap from="map" to="/map" /> the move_base_simple/goal for each turtlebot3 was sent to /tb3_0/map, /tb3_1/map,and/tb3_2/map` respectively.

$\endgroup$

Your Answer

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