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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


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

Seen: 409 times

Last updated: Jul 26 '20