ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Move_base namespace issue with multi robot simulation

asked 2020-03-19 23:05:53 -0500

roshea6 gravatar image

updated 2020-07-28 00:27:04 -0500

jayess gravatar image

Hey All,

I'm trying to setup a simulation that has multiple turlebot3s running with move_base in a gazebo environment. I'm able to get 1 working just fine but when I try to scale up to multiple robots I run into issues with move_base not working when launched from withing a namespace. The robots will spawn just fine but move_base will continuously publish the following warning:

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've messed with a bunch of different things and originally followed this ([]) answer but haven't been able to make any progress.

Unfortunately I don't have enough points to upload the image of my tf tree but there is the following connection

[map] ----(tb3_0/amcl)-----> [tb3_0/odom] ------(gazebo)----->[tb3_0/base_footprint]-------(tb3_0/robot_state_publisher)---->[tb3_0/base_link]

This makes is seem like there is definitely a transform between the base_footprint and the map but for some reason move_base can't use it. However, the transform from base_footprint to base_lin only appears to be published once at the very beginning and never again which could cause problems.

Here is the launch file I'm using to try to launch everything. I changed it to one turtlebot3 to try to get move_base launching from within a namespace launching correctly first.

<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="-2.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=" 0.0"/>

<arg name="map_file" default="$(find multi_robot_plan)/map/turtle_arena_map.yaml"/>
<arg name="move_forward_only" default="false"/>
<arg name="cmd_vel_topic" default="/cmd_vel" />
<arg name="odom_topic" default="odom" />

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

<!-- Gazebo world -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="$(find turtlebot3_gazebo)/worlds/"/>
    <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"/>

<!-- Map server -->
<node pkg="map_server" name="map_server" type="map_server" args="$(arg map_file)">
    <param name="frame_id" value="/map"/>

<!-- First robot -->
<group ns = "$(arg first_tb3)">
    <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 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" />

    <!-- AMCL -->
    <include file="$(find turtlebot3_navigation)/launch/amcl ...
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-07-26 00:02:11 -0500

Julian98 gravatar image

updated 2020-07-26 00:03:27 -0500

The reason for this is probably the fact, that the move_base node is looking for base_footprint in the global namespace. My solution for this was to overwrite the parameters in the yaml files you load in via rosparam with params:

<group ns="$(arg robot_name)">
        <param name="tf_prefix" value="$(arg robot_name)" />

        <!-- Other stuff like loading in the model etc. -->

        <node pkg="fake_localization" type="fake_localization" name="fake_localization" respawn="false" output="screen">
            <param name="odom_frame_id" value="$(arg robot_name)/odom" />
            <param name="base_frame_id" value="$(arg robot_name)/base_footprint" />
            <remap from="base_pose_ground_truth" to="/$(arg robot_name)/odom"/>
            <param name="global_frame_id" value="/map"/>

        <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 [package_name])/param/costmap_common_params_$(arg model).yaml" command="load" ns="global_costmap" />
            <rosparam file="$(find [package_name])/param/costmap_common_params_$(arg model).yaml" command="load" ns="local_costmap" />
            <rosparam file="$(find [package_name])/param/local_costmap_params.yaml" command="load" />
            <rosparam file="$(find [package_name])/param/global_costmap_params.yaml" command="load" />
            <rosparam file="$(find [package_name])/param/move_base_params.yaml" command="load" />
            <rosparam file="$(find [package_name])/param/dwa_local_planner_params_$(arg model).yaml" command="load" />

            <param name="controller_frequency" value="10.0" />
            <param name="global_costmap/robot_base_frame" value="$(arg robot_name)/base_footprint"/>
            <param name="local_costmap/robot_base_frame" value="$(arg robot_name)/base_footprint"/>
            <param name="local_costmap/global_frame" value="$(arg robot_name)/odom"/>

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

where the argument with name robot_name is the name of the robot. Hope that helps :)

edit flag offensive delete link more


This helped to remove 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.101 timeout was 0.1.

But now, when I set 2D Nav Goal for one of the turtlebot3s, it goes through the following steps: 1. Stays at [ INFO] [1676963896.349457803, 595.862000000]: Got new plan for a few seconds 2. Then goes to [ WARN] [1676963893.612169307, 594.362000000]: Clearing both costmaps to unstuck robot (3.00m). 3. Then goes to [ WARN] [1676963911.590496967, 604.563000000]: Rotate recovery behavior started.and gets stuck

None of the 3 turtlebot3s are showing any kind of motion in gazebo. Please help. @Julian98@jayess

hunterlineage1 gravatar image hunterlineage1  ( 2023-02-21 01:22:32 -0500 )edit

Question Tools



Asked: 2020-03-19 23:05:53 -0500

Seen: 1,065 times

Last updated: Jul 26 '20