Gazebo | Ignition | Community
Ask Your Question
0

Problems with spawning multiple Turtlebots

asked 2019-11-29 11:06:25 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

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-q... 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

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2019-12-01 10:08:51 -0600

davidem gravatar image

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.

edit flag offensive delete link more
0

answered 2021-02-23 14:51:04 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

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

one_robot.launch <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"/>

<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>

robots.launch <launch>

<group ns="robot1"> <include file="$(find multi_robot)/launch/one_robot.launch" &gt;="" <arg="" name="x_pos" value="1"/> <arg name="y_pos" value="1"/> <arg name="z_pos" value="0"/> </include> </group>

<group ns="robot2"> <include file="$(find multi_robot)/launch/one_robot.launch" &gt;="" <arg="" name="x_pos" value="-1"/> <arg name="y_pos" value="-1"/> <arg name="z_pos" value="0"/>

</include>

</group>

</launch>

main.launch <launch>

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

</launch>

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

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-11-29 11:06:25 -0600

Seen: 1,469 times

Last updated: Dec 01 '19