Robotics StackExchange | Archived questions

Problems with spawning multiple Turtlebots

Hey,

I am just trying to let my Turtlebot3 learn how to navigate. I succesfully let the robot navigate in the normal worlds. Now I wanna try to teach the robots to navigate in a world with more than one robot. So the robots itself represent obstacles.

My problem is now to spawn more than one robot. I tried to follow this tutorial: https://www.theconstructsim.com/ros-qa-130-how-to-launch-multiple-robots-in-gazebo-simulator/ I modified it to the TB3 code and got the following: For the final launch file:

<launch>

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

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

</launch>

For the robots.launch:

<launch>

  <!-- BEGIN ROBOT 1-->
  <group ns="robot1">
    <param name="tf_prefix" value="robot1_tf" />
    <include file="one_robot.launch" >
      <arg name="x_pos" value="1" />
      <arg name="y_pos" value="1" />
      <arg name="z_pos" value="0" />
    </include>
  </group>

  <!-- BEGIN ROBOT 2-->
  <group ns="robot2">
    <param name="tf_prefix" value="robot2_tf" />
    <include file="one_robot.launch" >
      <arg name="x_pos" value="-1" />
      <arg name="y_pos" value="-1" />
      <arg name="z_pos" value="0" />

    </include>
  </group>

</launch>

For one_robot:

<launch>
  <arg name="model" default="$(env TURTLEBOT3_MODEL)" doc="model type [burger, waffle, waffle_pi]"/>
  <arg name="x_pos" default="0.0"/>
  <arg name="y_pos" default="0.0"/>
  <arg name="z_pos" default="0.0"/>

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

  <node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-urdf -model turtlebot3_burger -x $(arg x_pos) -y $(arg y_pos) -z $(arg z_pos) -param robot_description" />

</launch>

The following problem occurs:

while processing one_robot.launch:
Invalid roslaunch XML syntax: [Errno 2] No such file or directory: u'one_robot.launch'

Do you guys have an idea how to fix this issue?

Kind regards

Asked by Tima15 on 2019-11-29 12:06:25 UTC

Comments

Answers

In your file robots.launch:

include file="one_robot.launch"

there's no full path to one_robot.launch. You must provide it either using the substitution notation $(find foo_pkg)/one_robot.launch or by providing the entire string path.

Asked by davidem on 2019-12-01 11:08:51 UTC

Comments

I am also trying to launch multiple turtlebots at the same time.

one_robot.launch

robots.launch

<!-- BEGIN ROBOT 1-->

<!-- BEGIN ROBOT 2-->

</include>

main.launch

I am getting "SpawnModel: Failure - model name turtlebot3_waffle already exist." error. Do you have any ideas about how i can solve this?

Asked by ASAsarkaya on 2021-02-23 15:51:04 UTC

Comments