Transform error while launching multiple turtlebots in ROS NOETIC

30 views Asked by At

I am trying to launch 3 turtlebots following this : repo in ros noetic. this is my gazebo launch file:

<?xml version="1.0"?>
<launch>
  <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="11.466219"/>
  <arg name="first_tb3_y_pos" default="-7.267796"/>
  <arg name="first_tb3_z_pos" default="-0.000"/>
  <arg name="first_tb3_yaw"   default="1.621071"/>

  <arg name="second_tb3_x_pos" default="8.143804"/>
  <arg name="second_tb3_y_pos" default="0.032318"/>
  <arg name="second_tb3_z_pos" default="-0.001064"/>
  <arg name="second_tb3_yaw"   default="-0.309337"/>

  <arg name="third_tb3_x_pos" default="18.376935"/>
  <arg name="third_tb3_y_pos" default="-1.841782"/>
  <arg name="third_tb3_z_pos" default="-0.000988"/>
  <arg name="third_tb3_yaw"   default="2.441699"/>

  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <!-- <arg name="world_name" value="$(find turtlebot3_gazebo)/worlds/tb3_worlds/turtlebot3_world.world"/> -->
    <arg name="world_name" value="$(find turtlebot3_gazebo)/worlds/scene2.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 --inorder $(find turtlebot3_description)/urdf/turtlebot3_$(arg model).urdf.xacro" />

    <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher0" 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 --inorder $(find turtlebot3_description)/urdf/turtlebot3_$(arg model).urdf.xacro" />

    <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher1" 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 --inorder $(find turtlebot3_description)/urdf/turtlebot3_$(arg model).urdf.xacro" />

    <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher2" 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>

The tf tree of eahc robot is sepearte and the map fram eis missing on rviz which is showing global status error and nop transform error.

rviz error...

below is the tf tree:

tf tree

I tried multiple ways o flaunching the navigation stack but the tf tree remains seperate for each robot and there is no map frame.

1

There are 1 answers

0
Andrei Vukolov On

You have 3 separate transformation trees and odom subtree referring to /base_footprint:

Part of the tree

It would help if you separated the odometry generator for every robot in Gazebo to make odometry available for every robot.