Multiple robots simulation with amcl navigation

asked 2020-04-30 01:35:30 -0500

zihong_yan gravatar image

updated 2020-04-30 01:42:23 -0500

Hi,

I am trying to set two robots on the map and use amcl navigation for each of them. As a role model, I used this (it deals with the same situation in Gazebo).But it someting with the tf tree,no map to odom both. one of them my problem:

[ WARN] [1588227857.541390678, 23.288000000]: Timed out waiting for transform from robot_0/base_footprint to robot_0/map to become available before running costmap, tf error: canTransform: target_frame robot_0/map does not exist.. canTransform returned after 0.1 timeout was 0.1.
[ WARN] [1588227857.566220754, 23.306000000]: Timed out waiting for transform from robot_1/base_footprint to robot_1/map to become available before running costmap, tf error: canTransform: target_frame robot_1/map does not exist.. canTransform returned after 0.1 timeout was 0.1.

my launch files:
one_robot.launch:

    <launch>
    <arg name="robot_name"/>
    <arg name="init_pose"/>
    <node name="spawn_minibot_model" pkg="gazebo_ros" 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="robot_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>

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-->
<arg name="model" default="$(env TURTLEBOT3_MODEL)" doc="model type [burger, waffle, waffle_pi]"/>

<group ns="robot_0">
    <param name="tf_prefix" value="robot_0" />
    <param name="robot_description" command="$(find xacro)/xacro --inorder $(find turtlebot3_description)/urdf/turtlebot3_$(arg model).urdf.xacro" />
    <include file="$(find turtlebot3_gazebo)/launch/one_robot.launch" >
        <arg name="init_pose" value="-x 1 -y 1 -z 0" />
        <arg name="robot_name"  value="robot_0" />
    </include>
</group>

<!-- BEGIN ROBOT 2-->
<group ns="robot_1">
    <param name="tf_prefix" value="robot_1" />
    <param name="robot_description" command="$(find xacro)/xacro --inorder $(find turtlebot3_description)/urdf/turtlebot3_$(arg model).urdf.xacro" />
    <include file="$(find turtlebot3_gazebo)/launch/one_robot.launch" >
        <arg name="init_pose" value="-x -1 -y 2 -z 0" />
        <arg name="robot_name"  value="robot_1" />
    </include>
</group>

</launch> new_simulation.launch:

    <launch>
    <arg name="model" default="$(env TURTLEBOT3_MODEL)" doc="model type [burger, waffle, waffle_pi]"/>
    <param name="/use_sim_time" value="true" />
  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="$(find turtlebot3_gazebo)/worlds/turtlebot3_world.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>

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

  <node pkg="gazebo_ros" type="spawn_model" name="spawn_urdf"  args="$(find turtlebot3_gazebo)/worlds/turtlebot3_world.world" respawn="false" output="screen" />

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

move_base.launch:

    <launch>
  <!-- Arguments -->
  <arg name="model" default ...
(more)
edit retag flag offensive close merge delete

Comments

Normally in multi-robot navigation (if you are running on simulation) you must have only 1 map frame which is shared across all robots, and connected to each robot's odom frame by their own amcl. So publish one map only and have you navigation setup for multiple robots.

Ammar Albakri gravatar image Ammar Albakri  ( 2023-02-01 08:05:32 -0500 )edit